REGRESSION (r188647): Teamtreehouse website sidebar buttons are not rendered
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Mar 2016 01:55:45 +0000 (01:55 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Mar 2016 01:55:45 +0000 (01:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155400
<rdar://problem/24818602>

Reviewed by Anders Carlsson.

Source/WebCore:

When we unprefixed CSS filters we accidentally
stopped SVG elements that use the CSS filter shorthands
from rendering. We still don't actually support
the shorthands in this case, but we should render
the element without the filter.

Tests: css3/filters/filters-on-svg-element.html
       css3/filters/filters-on-svg-root.html

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::hasReferenceFilterOnly): Add
this new function that tells us if we have the
style of filter that we can handle in SVG content.
* rendering/style/RenderStyle.h:
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::prepareToRenderSVGContent):
We can mark an element as ready to render if it
has a shorthand filter.

LayoutTests:

Add tests with SVG content that uses CSS filter
shorthands. These particular filters are no-ops
so should not affect rendering. If they actually
tried to do something you wouldn't see them work
until we enable shorthand filters on SVG content.

* css3/filters/filters-on-svg-element-expected.html: Added.
* css3/filters/filters-on-svg-element.html: Added.
* css3/filters/filters-on-svg-root-expected.html: Added.
* css3/filters/filters-on-svg-root.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198075 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/css3/filters/filters-on-svg-element-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/filters-on-svg-element.html [new file with mode: 0644]
LayoutTests/css3/filters/filters-on-svg-root-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/filters-on-svg-root.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/svg/SVGRenderingContext.cpp

index 70a781d..f368d0f 100644 (file)
@@ -1,3 +1,22 @@
+2016-03-12  Dean Jackson  <dino@apple.com>
+
+        REGRESSION (r188647): Teamtreehouse website sidebar buttons are not rendered
+        https://bugs.webkit.org/show_bug.cgi?id=155400
+        <rdar://problem/24818602>
+
+        Reviewed by Anders Carlsson.
+
+        Add tests with SVG content that uses CSS filter
+        shorthands. These particular filters are no-ops
+        so should not affect rendering. If they actually
+        tried to do something you wouldn't see them work
+        until we enable shorthand filters on SVG content.
+
+        * css3/filters/filters-on-svg-element-expected.html: Added.
+        * css3/filters/filters-on-svg-element.html: Added.
+        * css3/filters/filters-on-svg-root-expected.html: Added.
+        * css3/filters/filters-on-svg-root.html: Added.
+
 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [OS X] Scrollbars of overflow:scroll divs should appear on the left on RTL systems
 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [OS X] Scrollbars of overflow:scroll divs should appear on the left on RTL systems
diff --git a/LayoutTests/css3/filters/filters-on-svg-element-expected.html b/LayoutTests/css3/filters/filters-on-svg-element-expected.html
new file mode 100644 (file)
index 0000000..fecb5f3
--- /dev/null
@@ -0,0 +1,4 @@
+<svg viewBox="0 0 20 20" width="100px" height="100px">
+    <rect width="20" height="20" fill="red"/>
+    <circle cx="10" cy="10" r="8"/>
+</svg>
diff --git a/LayoutTests/css3/filters/filters-on-svg-element.html b/LayoutTests/css3/filters/filters-on-svg-element.html
new file mode 100644 (file)
index 0000000..5fba21a
--- /dev/null
@@ -0,0 +1,9 @@
+<style>
+rect {
+    filter: blur(0);
+}
+</style>
+<svg viewBox="0 0 20 20" width="100px" height="100px">
+    <rect width="20" height="20" fill="red"/>
+    <circle cx="10" cy="10" r="8"/>
+</svg>
diff --git a/LayoutTests/css3/filters/filters-on-svg-root-expected.html b/LayoutTests/css3/filters/filters-on-svg-root-expected.html
new file mode 100644 (file)
index 0000000..fecb5f3
--- /dev/null
@@ -0,0 +1,4 @@
+<svg viewBox="0 0 20 20" width="100px" height="100px">
+    <rect width="20" height="20" fill="red"/>
+    <circle cx="10" cy="10" r="8"/>
+</svg>
diff --git a/LayoutTests/css3/filters/filters-on-svg-root.html b/LayoutTests/css3/filters/filters-on-svg-root.html
new file mode 100644 (file)
index 0000000..217a995
--- /dev/null
@@ -0,0 +1,9 @@
+<style>
+svg {
+    filter: blur(0);
+}
+</style>
+<svg viewBox="0 0 20 20" width="100px" height="100px">
+    <rect width="20" height="20" fill="red"/>
+    <circle cx="10" cy="10" r="8"/>
+</svg>
index 6b05898..cdbbae3 100644 (file)
@@ -1,3 +1,30 @@
+2016-03-12  Dean Jackson  <dino@apple.com>
+
+        REGRESSION (r188647): Teamtreehouse website sidebar buttons are not rendered
+        https://bugs.webkit.org/show_bug.cgi?id=155400
+        <rdar://problem/24818602>
+
+        Reviewed by Anders Carlsson.
+
+        When we unprefixed CSS filters we accidentally
+        stopped SVG elements that use the CSS filter shorthands
+        from rendering. We still don't actually support
+        the shorthands in this case, but we should render
+        the element without the filter.
+
+        Tests: css3/filters/filters-on-svg-element.html
+               css3/filters/filters-on-svg-root.html
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::hasReferenceFilterOnly): Add
+        this new function that tells us if we have the
+        style of filter that we can handle in SVG content.
+        * rendering/style/RenderStyle.h:
+        * rendering/svg/SVGRenderingContext.cpp:
+        (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
+        We can mark an element as ready to render if it
+        has a shorthand filter.
+
 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Delete dead SVG Font code
 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Delete dead SVG Font code
index e609075..5fbb72a 100644 (file)
@@ -1974,6 +1974,22 @@ void RenderStyle::setScrollSnapCoordinates(Vector<LengthSize> coordinates)
 
 #endif
 
 
 #endif
 
+bool RenderStyle::hasReferenceFilterOnly() const
+{
+    if (!hasFilter())
+        return false;
+
+    const FilterOperations& filterOperations = rareNonInheritedData->m_filter->m_operations;
+    if (filterOperations.size() != 1)
+        return false;
+
+    const FilterOperation& filterOperation = *filterOperations.at(0);
+    if (filterOperation.type() != FilterOperation::REFERENCE)
+        return false;
+
+    return true;
+}
+
 void RenderStyle::checkVariablesInCustomProperties()
 {
     if (!rareInheritedData->m_customProperties->containsVariables())
 void RenderStyle::checkVariablesInCustomProperties()
 {
     if (!rareInheritedData->m_customProperties->containsVariables())
index ed17e76..5ddc10d 100644 (file)
@@ -1161,6 +1161,7 @@ public:
     FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
     const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
     bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
     FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
     const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
     bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
+    bool hasReferenceFilterOnly() const;
 
 #if ENABLE(FILTERS_LEVEL_2)
     FilterOperations& mutableBackdropFilter() { return rareNonInheritedData.access()->m_backdropFilter.access()->m_operations; }
 
 #if ENABLE(FILTERS_LEVEL_2)
     FilterOperations& mutableBackdropFilter() { return rareNonInheritedData.access()->m_backdropFilter.access()->m_operations; }
index 537fef9..879513c 100644 (file)
@@ -153,7 +153,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderElement& renderer, Pai
 
     auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*m_renderer);
     if (!resources) {
 
     auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*m_renderer);
     if (!resources) {
-        if (style.hasFilter())
+        if (style.hasReferenceFilterOnly())
             return;
 
         m_renderingFlags |= RenderingPrepared;
             return;
 
         m_renderingFlags |= RenderingPrepared;