use of io.sf.carte.doc.dom4j.CSSStylableElement in project xwiki-platform by xwiki.
the class PdfExportImpl method applyInlineStyle.
/**
* Recursively inline the computed style that applies to a DOM Element into the {@code style} attribute of that
* Element.
*
* @param element the Element whose style should be inlined
*/
private void applyInlineStyle(Element element) {
for (int i = 0; i < element.nodeCount(); i++) {
org.dom4j.Node node = element.node(i);
if (node instanceof CSSStylableElement) {
CSSStylableElement styleElement = (CSSStylableElement) node;
CSSStyleDeclaration style = styleElement.getComputedStyle();
if (style != null && StringUtils.isNotEmpty(style.getCssText())) {
styleElement.addAttribute("style", style.getCssText());
}
}
if (node instanceof Element) {
applyInlineStyle((Element) node);
}
}
}
Aggregations