Title: [287710] trunk
Revision
287710
Author
[email protected]
Date
2022-01-06 12:04:41 -0800 (Thu, 06 Jan 2022)

Log Message

REGRESSION(r285618):A crash may happen when calculating the color-interpolation of a referenced SVG filter
https://bugs.webkit.org/show_bug.cgi?id=234918
rdar://86928631

Reviewed by Simon Fraser.

Source/WebCore:

When building a referenced SVGFilter, the color-interpolation property
of the effect element is needed. If the effect element does not have a
renderer, we fallback to the computed style property value. And if the
SVG filter is inside an <iframe> which has media queries, a Document::
updateLayout() will be forced. Building the SVGFilter should not invoke
an updateLayout() since this may not be safe and out of order.

Test: css3/filters/reference-filter-color-interpolation-update-layout.html

* svg/graphics/filters/SVGFilterBuilder.cpp:
(WebCore::colorInterpolationForElement):

LayoutTests:

* css3/filters/reference-filter-color-interpolation-update-layout-expected.txt: Added.
* css3/filters/reference-filter-color-interpolation-update-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287709 => 287710)


--- trunk/LayoutTests/ChangeLog	2022-01-06 20:01:46 UTC (rev 287709)
+++ trunk/LayoutTests/ChangeLog	2022-01-06 20:04:41 UTC (rev 287710)
@@ -1,3 +1,14 @@
+2022-01-06  Said Abou-Hallawa  <[email protected]>
+
+        REGRESSION(r285618):A crash may happen when calculating the color-interpolation of a referenced SVG filter
+        https://bugs.webkit.org/show_bug.cgi?id=234918
+        rdar://86928631
+
+        Reviewed by Simon Fraser.
+
+        * css3/filters/reference-filter-color-interpolation-update-layout-expected.txt: Added.
+        * css3/filters/reference-filter-color-interpolation-update-layout.html: Added.
+
 2022-01-06  Alan Bujtas  <[email protected]>
 
         Tighten test expectation for imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-transform.html

Added: trunk/LayoutTests/css3/filters/reference-filter-color-interpolation-update-layout-expected.txt (0 => 287710)


--- trunk/LayoutTests/css3/filters/reference-filter-color-interpolation-update-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/reference-filter-color-interpolation-update-layout-expected.txt	2022-01-06 20:04:41 UTC (rev 287710)
@@ -0,0 +1,3 @@
+This test passes if it does not crash.
+
+

Added: trunk/LayoutTests/css3/filters/reference-filter-color-interpolation-update-layout.html (0 => 287710)


--- trunk/LayoutTests/css3/filters/reference-filter-color-interpolation-update-layout.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/reference-filter-color-interpolation-update-layout.html	2022-01-06 20:04:41 UTC (rev 287710)
@@ -0,0 +1,33 @@
+<body>
+    <p>This test passes if it does not crash.</p>
+    <iframe srcdoc='
+        <html>
+            <style>
+                @media only screen and (max-width: 600px) {
+                    body {
+                        background-color: lightblue;
+                    }
+                }
+                .blurred-box {
+                    width: 100px;
+                    height: 100px;
+                    display: inline-block;
+                    background-color: green;
+                    filter: url(#blur-filter);
+                }
+            </style>
+            <body>
+                <svg style="display: none;">
+                    <filter id="blur-filter">
+                        <feGaussianBlur stdDeviation="2"/>
+                    </filter>
+                </svg>
+                <div class="blurred-box"></div>
+            </body>
+        </html>'>
+    </iframe>
+    <script>
+        if (window.testRunner)
+            window.testRunner.dumpAsText(true);
+    </script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (287709 => 287710)


--- trunk/Source/WebCore/ChangeLog	2022-01-06 20:01:46 UTC (rev 287709)
+++ trunk/Source/WebCore/ChangeLog	2022-01-06 20:04:41 UTC (rev 287710)
@@ -1,3 +1,23 @@
+2022-01-06  Said Abou-Hallawa  <[email protected]>
+
+        REGRESSION(r285618):A crash may happen when calculating the color-interpolation of a referenced SVG filter
+        https://bugs.webkit.org/show_bug.cgi?id=234918
+        rdar://86928631
+
+        Reviewed by Simon Fraser.
+
+        When building a referenced SVGFilter, the color-interpolation property
+        of the effect element is needed. If the effect element does not have a
+        renderer, we fallback to the computed style property value. And if the
+        SVG filter is inside an <iframe> which has media queries, a Document::
+        updateLayout() will be forced. Building the SVGFilter should not invoke
+        an updateLayout() since this may not be safe and out of order.
+
+        Test: css3/filters/reference-filter-color-interpolation-update-layout.html
+
+        * svg/graphics/filters/SVGFilterBuilder.cpp:
+        (WebCore::colorInterpolationForElement):
+
 2022-01-06  Antoine Quint  <[email protected]>
 
         Remove Animation::operator=

Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp (287709 => 287710)


--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp	2022-01-06 20:01:46 UTC (rev 287709)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp	2022-01-06 20:04:41 UTC (rev 287710)
@@ -70,7 +70,7 @@
         return renderer->style().svgStyle().colorInterpolationFilters();
 
     // Try to determine the property value from the computed style.
-    if (auto value = ComputedStyleExtractor(&element).propertyValue(CSSPropertyColorInterpolationFilters)) {
+    if (auto value = ComputedStyleExtractor(&element).propertyValue(CSSPropertyColorInterpolationFilters, DoNotUpdateLayout)) {
         if (is<CSSPrimitiveValue>(value))
             return downcast<CSSPrimitiveValue>(*value);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to