use of com.helger.css.decl.CSSExpressionMemberTermURI in project jmeter by apache.
the class CssParserCacheLoader method load.
@Override
public URLCollection load(Triple<String, URL, Charset> triple) throws Exception {
final String cssContent = triple.getLeft();
final URL baseUrl = triple.getMiddle();
final Charset charset = triple.getRight();
final CSSReaderSettings readerSettings = new CSSReaderSettings().setBrowserCompliantMode(true).setFallbackCharset(charset).setCSSVersion(ECSSVersion.CSS30).setCustomErrorHandler(new LoggingCSSParseErrorHandler()).setCustomExceptionHandler(new CSSParseExceptionCallback(baseUrl));
if (IGNORE_ALL_CSS_ERRORS) {
readerSettings.setInterpretErrorHandler(new DoNothingCSSInterpretErrorHandler());
}
final CascadingStyleSheet aCSS = CSSReader.readFromStringReader(cssContent, readerSettings);
final URLCollection urls = new URLCollection(new ArrayList<>());
if (aCSS == null) {
LOG.warn("Failed parsing CSS: " + baseUrl + ", got null CascadingStyleSheet");
return urls;
}
CSSVisitor.visitCSSUrl(aCSS, new DefaultCSSUrlVisitor() {
@Override
public void onImport(CSSImportRule rule) {
final String location = rule.getLocationString();
if (!StringUtils.isEmpty(location)) {
urls.addURL(location, baseUrl);
}
}
// Call for URLs outside of URLs
@Override
public void onUrlDeclaration(final ICSSTopLevelRule aTopLevelRule, final CSSDeclaration aDeclaration, final CSSExpressionMemberTermURI aURITerm) {
// NOOP
// Browser fetch such urls only when CSS rule matches
// so we disable this code
}
});
return urls;
}
use of com.helger.css.decl.CSSExpressionMemberTermURI in project ph-css by phax.
the class CSSVisitorForUrl method onDeclaration.
public void onDeclaration(@Nonnull final CSSDeclaration aDeclaration) {
final ICSSTopLevelRule aTopLevelRule = m_aTopLevelRule.isEmpty() ? null : m_aTopLevelRule.peek();
final CSSExpression aExpr = aDeclaration.getExpression();
for (final ICSSExpressionMember aMember : aExpr.getAllMembers()) if (aMember instanceof CSSExpressionMemberTermURI) {
final CSSExpressionMemberTermURI aExprTerm = (CSSExpressionMemberTermURI) aMember;
m_aVisitor.onUrlDeclaration(aTopLevelRule, aDeclaration, aExprTerm);
}
}
use of com.helger.css.decl.CSSExpressionMemberTermURI in project ph-css by phax.
the class WikiVisitDataUrls method readFromStyleAttributeWithAPI.
public void readFromStyleAttributeWithAPI() {
final String sStyle = "@import '/folder/foobar.css';\n" + "div{background:fixed url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9EFBAoYMhVvMQIAAAAtSURBVHicY/z//z8DHoBH+v///yy4FDEyMjIwMDDhM3lgpaEuh7gTEzDiDxYA9HEPDF90e5YAAAAASUVORK5CYII=) !important;}\n" + "span { background-image:url('/my/folder/b.gif');}";
final CascadingStyleSheet aCSS = CSSReader.readFromString(sStyle, ECSSVersion.CSS30);
CSSVisitor.visitCSSUrl(aCSS, new DefaultCSSUrlVisitor() {
// Called for each import
@Override
public void onImport(@Nonnull final CSSImportRule aImportRule) {
System.out.println("Import: " + aImportRule.getLocationString());
}
// Call for URLs outside of URLs
@Override
public void onUrlDeclaration(@Nullable final ICSSTopLevelRule aTopLevelRule, @Nonnull final CSSDeclaration aDeclaration, @Nonnull final CSSExpressionMemberTermURI aURITerm) {
final CSSURI aURI = aURITerm.getURI();
if (aURI.isDataURL()) {
final CSSDataURL aDataURL = aURI.getAsDataURL();
System.out.println(aDeclaration.getProperty() + " - references data URL with " + aDataURL.getContentLength() + " bytes of content");
} else
System.out.println(aDeclaration.getProperty() + " - references regular URL: " + aURI.getURI());
}
});
}
use of com.helger.css.decl.CSSExpressionMemberTermURI in project ph-css by phax.
the class CSSReader30SpecialFuncTest method testReadExpressions.
@Test
public void testReadExpressions() {
final ECSSVersion eVersion = ECSSVersion.CSS30;
final CSSWriterSettings aCSSWS = new CSSWriterSettings(eVersion, false);
final Charset aCharset = StandardCharsets.UTF_8;
final File aFile = new File("src/test/resources/testfiles/css30/good/artificial/test-expression.css");
final CascadingStyleSheet aCSS = CSSReader.readFromFile(aFile, aCharset, eVersion);
assertNotNull(aCSS);
assertEquals(1, aCSS.getRuleCount());
assertEquals(1, aCSS.getStyleRuleCount());
final CSSStyleRule aSR = aCSS.getStyleRuleAtIndex(0);
assertEquals("div", aSR.getSelectorsAsCSSString(aCSSWS, 0));
assertEquals(23, aSR.getDeclarationCount());
int i = 0;
for (final CSSDeclaration aDecl : aSR.getAllDeclarations()) {
final String sExpectedName = Character.toString((char) ('a' + i));
assertEquals(sExpectedName, aDecl.getProperty());
++i;
}
CSSDeclaration aDecl;
ICSSExpressionMember aMember;
// a: -5
aDecl = aSR.getDeclarationOfPropertyName("a");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5", aMember.getAsCSSString(aCSSWS));
// b: +5
aDecl = aSR.getDeclarationOfPropertyName("b");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5", aMember.getAsCSSString(aCSSWS));
// c: 5
aDecl = aSR.getDeclarationOfPropertyName("c");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5", aMember.getAsCSSString(aCSSWS));
// d: -5.12
aDecl = aSR.getDeclarationOfPropertyName("d");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5.12", aMember.getAsCSSString(aCSSWS));
// e: +5.12
aDecl = aSR.getDeclarationOfPropertyName("e");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5.12", aMember.getAsCSSString(aCSSWS));
// f: 5.12
aDecl = aSR.getDeclarationOfPropertyName("f");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5.12", aMember.getAsCSSString(aCSSWS));
// g: -5.12%
aDecl = aSR.getDeclarationOfPropertyName("g");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5.12%", aMember.getAsCSSString(aCSSWS));
// h: +5.12%
aDecl = aSR.getDeclarationOfPropertyName("h");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5.12%", aMember.getAsCSSString(aCSSWS));
// i: 5.12%
aDecl = aSR.getDeclarationOfPropertyName("i");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5.12%", aMember.getAsCSSString(aCSSWS));
// j: -5px
aDecl = aSR.getDeclarationOfPropertyName("j");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5px", aMember.getAsCSSString(aCSSWS));
// k: +5px
aDecl = aSR.getDeclarationOfPropertyName("k");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5px", aMember.getAsCSSString(aCSSWS));
// l: 5px
aDecl = aSR.getDeclarationOfPropertyName("l");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5px", aMember.getAsCSSString(aCSSWS));
// m: 'string1'
aDecl = aSR.getDeclarationOfPropertyName("m");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("'string1'", aMember.getAsCSSString(aCSSWS));
// n: "string2"
aDecl = aSR.getDeclarationOfPropertyName("n");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("\"string2\"", aMember.getAsCSSString(aCSSWS));
// o: abc
aDecl = aSR.getDeclarationOfPropertyName("o");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("abc", aMember.getAsCSSString(aCSSWS));
// p: from
aDecl = aSR.getDeclarationOfPropertyName("p");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("from", aMember.getAsCSSString(aCSSWS));
// q: to
aDecl = aSR.getDeclarationOfPropertyName("q");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("to", aMember.getAsCSSString(aCSSWS));
// r: url(a.gif)
aDecl = aSR.getDeclarationOfPropertyName("r");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermURI);
assertEquals("url(a.gif)", aMember.getAsCSSString(aCSSWS));
// s: #123
aDecl = aSR.getDeclarationOfPropertyName("s");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("#123", aMember.getAsCSSString(aCSSWS));
// t: function(5,6,abc)
aDecl = aSR.getDeclarationOfPropertyName("t");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberFunction);
assertEquals("function", ((CSSExpressionMemberFunction) aMember).getFunctionName());
// 3 parameters and 2 commas
assertEquals(5, ((CSSExpressionMemberFunction) aMember).getExpression().getMemberCount());
assertEquals("function(5,6,abc)", aMember.getAsCSSString(aCSSWS));
// u: calc(4 + 5)
aDecl = aSR.getDeclarationOfPropertyName("u");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberMath);
// 2 values and 1 operator
assertEquals(3, ((CSSExpressionMemberMath) aMember).getMemberCount());
assertEquals("calc(4 + 5)", aMember.getAsCSSString(aCSSWS));
// v: inherit
aDecl = aSR.getDeclarationOfPropertyName("v");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("inherit", aMember.getAsCSSString(aCSSWS));
// w: u+1234
aDecl = aSR.getDeclarationOfPropertyName("w");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("u+1234", aMember.getAsCSSString(aCSSWS));
// Write result
final String sCSS = new CSSWriter(aCSSWS).getCSSAsString(aCSS);
assertNotNull(sCSS);
if (false)
s_aLogger.info(sCSS);
}
use of com.helger.css.decl.CSSExpressionMemberTermURI in project ph-css by phax.
the class CSSReader30FuncTest method testReadExpressions.
@Test
public void testReadExpressions() {
final ECSSVersion eVersion = ECSSVersion.CSS30;
final CSSWriterSettings aCSSWS = new CSSWriterSettings(eVersion, false);
final Charset aCharset = StandardCharsets.UTF_8;
final File aFile = new File("src/test/resources/testfiles/css30/good/artificial/test-expression.css");
final CascadingStyleSheet aCSS = CSSReader.readFromFile(aFile, aCharset, eVersion);
assertNotNull(aCSS);
assertEquals(1, aCSS.getRuleCount());
assertEquals(1, aCSS.getStyleRuleCount());
final CSSStyleRule aSR = aCSS.getStyleRuleAtIndex(0);
assertEquals("div", aSR.getSelectorsAsCSSString(aCSSWS, 0));
assertEquals(23, aSR.getDeclarationCount());
int i = 0;
for (final CSSDeclaration aDecl : aSR.getAllDeclarations()) {
final String sExpectedName = Character.toString((char) ('a' + i));
assertEquals(sExpectedName, aDecl.getProperty());
++i;
}
CSSDeclaration aDecl;
ICSSExpressionMember aMember;
// a: -5
aDecl = aSR.getDeclarationOfPropertyName("a");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5", aMember.getAsCSSString(aCSSWS));
// b: +5
aDecl = aSR.getDeclarationOfPropertyName("b");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5", aMember.getAsCSSString(aCSSWS));
// c: 5
aDecl = aSR.getDeclarationOfPropertyName("c");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5", aMember.getAsCSSString(aCSSWS));
// d: -5.12
aDecl = aSR.getDeclarationOfPropertyName("d");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5.12", aMember.getAsCSSString(aCSSWS));
// e: +5.12
aDecl = aSR.getDeclarationOfPropertyName("e");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5.12", aMember.getAsCSSString(aCSSWS));
// f: 5.12
aDecl = aSR.getDeclarationOfPropertyName("f");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5.12", aMember.getAsCSSString(aCSSWS));
// g: -5.12%
aDecl = aSR.getDeclarationOfPropertyName("g");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5.12%", aMember.getAsCSSString(aCSSWS));
// h: +5.12%
aDecl = aSR.getDeclarationOfPropertyName("h");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5.12%", aMember.getAsCSSString(aCSSWS));
// i: 5.12%
aDecl = aSR.getDeclarationOfPropertyName("i");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5.12%", aMember.getAsCSSString(aCSSWS));
// j: -5px
aDecl = aSR.getDeclarationOfPropertyName("j");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("-5px", aMember.getAsCSSString(aCSSWS));
// k: +5px
aDecl = aSR.getDeclarationOfPropertyName("k");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("+5px", aMember.getAsCSSString(aCSSWS));
// l: 5px
aDecl = aSR.getDeclarationOfPropertyName("l");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("5px", aMember.getAsCSSString(aCSSWS));
// m: 'string1'
aDecl = aSR.getDeclarationOfPropertyName("m");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("'string1'", aMember.getAsCSSString(aCSSWS));
// n: "string2"
aDecl = aSR.getDeclarationOfPropertyName("n");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("\"string2\"", aMember.getAsCSSString(aCSSWS));
// o: abc
aDecl = aSR.getDeclarationOfPropertyName("o");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("abc", aMember.getAsCSSString(aCSSWS));
// p: from
aDecl = aSR.getDeclarationOfPropertyName("p");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("from", aMember.getAsCSSString(aCSSWS));
// q: to
aDecl = aSR.getDeclarationOfPropertyName("q");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("to", aMember.getAsCSSString(aCSSWS));
// r: url(a.gif)
aDecl = aSR.getDeclarationOfPropertyName("r");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermURI);
assertEquals("url(a.gif)", aMember.getAsCSSString(aCSSWS));
// s: #123
aDecl = aSR.getDeclarationOfPropertyName("s");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("#123", aMember.getAsCSSString(aCSSWS));
// t: function(5,6,abc)
aDecl = aSR.getDeclarationOfPropertyName("t");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberFunction);
assertEquals("function", ((CSSExpressionMemberFunction) aMember).getFunctionName());
// 3 parameters and 2 commas
assertEquals(5, ((CSSExpressionMemberFunction) aMember).getExpression().getMemberCount());
assertEquals("function(5,6,abc)", aMember.getAsCSSString(aCSSWS));
// u: calc(4 + 5)
aDecl = aSR.getDeclarationOfPropertyName("u");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberMath);
// 2 values and 1 operator
assertEquals(3, ((CSSExpressionMemberMath) aMember).getMemberCount());
assertEquals("calc(4 + 5)", aMember.getAsCSSString(aCSSWS));
// v: inherit
aDecl = aSR.getDeclarationOfPropertyName("v");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("inherit", aMember.getAsCSSString(aCSSWS));
// w: u+1234
aDecl = aSR.getDeclarationOfPropertyName("w");
assertNotNull(aDecl);
assertEquals(1, aDecl.getExpression().getMemberCount());
aMember = aDecl.getExpression().getMemberAtIndex(0);
assertTrue(aMember instanceof CSSExpressionMemberTermSimple);
assertEquals("u+1234", aMember.getAsCSSString(aCSSWS));
// Write result
final String sCSS = new CSSWriter(aCSSWS).getCSSAsString(aCSS);
assertNotNull(sCSS);
if (false)
m_aLogger.info(sCSS);
}
Aggregations