CSSCompiler compiler = StylingFactory.getDefaultInstance()
.createDeviceCSSCompiler(DeviceOutlook.OPTIMISTIC);
CompiledStyleSheet deviceStyleSheet = compiler.compile(
new StringReader(deviceCSS), null);
PropertyDetailsSet detailsSet =
PropertyDetailsSetHelper.getDetailsSet(indexedProperties);
ShorthandSet supportedShorthands = new MutableShorthandSet();
InputPropertiesOptimizer propertiesOptimizer =
new PropertiesOptimizer(detailsSet,
contextMock, supportedShorthands);
ExtractorContext context = new ExtractorContext() {
DefaultCSSVersion cssVersion = new DefaultCSSVersion("test"); {
cssVersion.addPseudoSelectorId(new String[] {
PseudoClassTypeEnum.HOVER.getType()
});
cssVersion.markImmutable();
}
public AssetResolver getAssetResolver() {
return null;
}
public boolean generateTypeRules() {
return true;
}
public CSSVersion getCSSVersion() {
return cssVersion;
}
};
StyledDOMOptimizer normalizer =
new DefaultStyledDOMOptimizer(propertiesOptimizer,
detailsSet.getRootStyleValues(),
deviceStyleSheet,
context);
OutputStyledElementList elementList = normalizer.optimize(actualXml);
String actualStyledElements = renderStyledElements(elementList);