diff --git a/echosvg-test/src/test/java/io/sf/carte/echosvg/test/svg/StyleBypassRenderingTest.java b/echosvg-test/src/test/java/io/sf/carte/echosvg/test/svg/StyleBypassRenderingTest.java index b65a01dfb..0b2f217a6 100644 --- a/echosvg-test/src/test/java/io/sf/carte/echosvg/test/svg/StyleBypassRenderingTest.java +++ b/echosvg-test/src/test/java/io/sf/carte/echosvg/test/svg/StyleBypassRenderingTest.java @@ -1359,6 +1359,11 @@ public void testCSS3Print() throws TranscoderException, IOException { testPrint("samples/tests/spec2/styling/css3.html", 5); } + @Test + public void testCSS3AlternateStylesheet() throws TranscoderException, IOException { + testAlternate("samples/tests/spec2/styling/css3.html", "Gray", false, 5); + } + @Test public void testCSS3Dark() throws TranscoderException, IOException { testDark("samples/tests/spec2/styling/css3.html", 5); diff --git a/echosvg-transcoder/src/main/java/io/sf/carte/echosvg/transcoder/util/CSSTranscodingHelper.java b/echosvg-transcoder/src/main/java/io/sf/carte/echosvg/transcoder/util/CSSTranscodingHelper.java index df0563618..914b5bcc7 100644 --- a/echosvg-transcoder/src/main/java/io/sf/carte/echosvg/transcoder/util/CSSTranscodingHelper.java +++ b/echosvg-transcoder/src/main/java/io/sf/carte/echosvg/transcoder/util/CSSTranscodingHelper.java @@ -780,7 +780,7 @@ private void transcodeDOMDocument(DOMDocument document, TranscoderOutput output, // If there is an alternate style sheet, set it if (alt != null && (alt = alt.trim()).length() != 0) { - document.enableStyleSheetsForSet(alt); + document.setSelectedStyleSheetSet(alt); } // Now fill the SVG document with computed styles diff --git a/samples/tests/resources/style/gray.css b/samples/tests/resources/style/gray.css new file mode 100644 index 000000000..5ee6e399f --- /dev/null +++ b/samples/tests/resources/style/gray.css @@ -0,0 +1,11 @@ +circle { + fill: #9a9a9a60 ! important; + stroke-width: 8px ! important; +} +ellipse { + fill: #7070704f ! important; + stroke-width: calc(2px + 0.2em) ! important; +} +text { + font-size: calc(2*5pt + .36em) ! important; +} diff --git a/samples/tests/spec2/styling/css3.html b/samples/tests/spec2/styling/css3.html index 4154d97d4..b28913094 100644 --- a/samples/tests/spec2/styling/css3.html +++ b/samples/tests/spec2/styling/css3.html @@ -27,6 +27,7 @@
+