REGRESSION: SVG clip-path doesn't work on root <svg>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Aug 2016 00:30:22 +0000 (00:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Aug 2016 00:30:22 +0000 (00:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=129180

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-08-23
Reviewed by Tim Horton.

Source/WebCore:

Build the resources cache for the RenderSVGRoot element when it's been
inserted in the render tree. Remove the resources cache before removing
the RenderSVGRoot from the render tree. No worries for the child <svg>
elements since their renderers are of type RenderSVGViewportContainer.

Tests: svg/clip-path/clip-path-on-svg-003.svg
       svg/clip-path/clip-path-on-svg-004.svg

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::insertedIntoTree):
(WebCore::RenderSVGRoot::willBeRemovedFromTree):
* rendering/svg/RenderSVGRoot.h:
These changes are very similar to what we do for adding and removing the
child SVG elements in RenderSVGRoot::addChild() and removeChild().

LayoutTests:

* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* svg/clip-path/clip-path-on-svg-003-expected.svg: Added.
* svg/clip-path/clip-path-on-svg-003.svg: Added.
* svg/clip-path/clip-path-on-svg-004-expected.svg: Added.
* svg/clip-path/clip-path-on-svg-004.svg: Added.

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/svg/clip-path/clip-path-on-svg-003-expected.svg [new file with mode: 0644]
LayoutTests/svg/clip-path/clip-path-on-svg-003.svg [new file with mode: 0644]
LayoutTests/svg/clip-path/clip-path-on-svg-004-expected.svg [new file with mode: 0644]
LayoutTests/svg/clip-path/clip-path-on-svg-004.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.h

index 5887837..0ecd89c 100644 (file)
@@ -1,3 +1,20 @@
+2016-08-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        REGRESSION: SVG clip-path doesn't work on root <svg>
+        https://bugs.webkit.org/show_bug.cgi?id=129180
+
+        Reviewed by Tim Horton.
+
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/ios-simulator/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/win/TestExpectations:
+        * svg/clip-path/clip-path-on-svg-003-expected.svg: Added.
+        * svg/clip-path/clip-path-on-svg-003.svg: Added.
+        * svg/clip-path/clip-path-on-svg-004-expected.svg: Added.
+        * svg/clip-path/clip-path-on-svg-004.svg: Added.
+
 2016-08-23  Chris Dumez  <cdumez@apple.com>
 
         HTMLAreaElement should have a stringifier
index 3a8c5e9..fc24b74 100644 (file)
@@ -949,10 +949,6 @@ webkit.org/b/125517 compositing/regions/z-index-update.html [ Crash Pass ]
 
 webkit.org/b/125573 compositing/backgrounds/fixed-backgrounds.html [ Crash Pass ]
 
-# Regressions in svg/clip-path
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-001.svg [ ImageOnlyFailure Pass ]
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-002.svg [ ImageOnlyFailure Pass ]
-
 webkit.org/b/119789 fast/events/touch/touch-inside-iframe.html [ Crash Pass ]
 
 webkit.org/b/133305 fast/text/mark-matches-rendering.html [ ImageOnlyFailure Pass ]
index 8b15738..8fc16ec 100644 (file)
@@ -1274,8 +1274,6 @@ webkit.org/b/118665 fast/regions/top-overflow-out-of-second-region.html [ ImageO
 webkit.org/b/118665 fast/regions/webkit-flow-float-unable-to-push.html [ ImageOnlyFailure Pass ]
 
 # Regressions in svg/clip-path
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-001.svg [ ImageOnlyFailure Pass ]
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-002.svg [ ImageOnlyFailure Pass ]
 webkit.org/b/115440 svg/stroke/animated-non-scaling-stroke.html [ ImageOnlyFailure Pass ]
 
 webkit.org/b/105296 webaudio/delaynode-maxdelay.html [ Pass Failure ]
index adf20bf..a5fca64 100644 (file)
@@ -1115,8 +1115,6 @@ svg/carto.net/slider.svg [ Failure ]
 svg/carto.net/tabgroup.svg [ Failure ]
 svg/carto.net/textbox.svg [ Failure ]
 svg/carto.net/window.svg [ Failure ]
-svg/clip-path/clip-path-on-svg-001.svg [ ImageOnlyFailure ]
-svg/clip-path/clip-path-on-svg-002.svg [ ImageOnlyFailure ]
 svg/css/composite-shadow-example.html [ Failure ]
 svg/css/composite-shadow-with-opacity.html [ Failure ]
 svg/css/css-box-min-width.html [ Failure ]
index 55e518b..7390d3d 100644 (file)
@@ -775,10 +775,6 @@ webkit.org/b/50959 animations/play-state-suspend.html [ Pass Failure ]
 webkit.org/b/122040 animations/combo-transform-translate+scale.html [ Pass Failure ]
 webkit.org/b/128379 animations/suspend-resume-animation.html [ Pass Failure ]
 
-# Regressions in svg/clip-path
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-001.svg [ ImageOnlyFailure ]
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-002.svg [ ImageOnlyFailure ]
-
 # Skipped for ios-simulator as well:
 webkit.org/b/129758 js/dom/create-lots-of-workers.html [ Skip ]
 
index e1cede0..9cf8bef 100644 (file)
@@ -1883,10 +1883,6 @@ svg/batik/text/verticalTextOnPath.svg [ Failure ]
 svg/animations/animate-linear-discrete-additive.svg [ Pass Timeout ]
 svg/custom/use-display-none.svg [ Pass Timeout ]
 
-# Regressions in svg/clip-path
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-001.svg [ ImageOnlyFailure ]
-webkit.org/b/129180 svg/clip-path/clip-path-on-svg-002.svg [ ImageOnlyFailure ]
-
 svg/clip-path/mask-objectboundingbox-content-clip.svg [ ImageOnlyFailure ]
 svg/clip-path/mask-userspaceonuse-content-clip.svg [ ImageOnlyFailure ]
 svg/custom/inline-svg-in-xhtml.xml [ Failure ]
diff --git a/LayoutTests/svg/clip-path/clip-path-on-svg-003-expected.svg b/LayoutTests/svg/clip-path/clip-path-on-svg-003-expected.svg
new file mode 100644 (file)
index 0000000..246986f
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+    <rect x="25" y="25" width="150" height="150" fill="green"/>
+</svg>
diff --git a/LayoutTests/svg/clip-path/clip-path-on-svg-003.svg b/LayoutTests/svg/clip-path/clip-path-on-svg-003.svg
new file mode 100644 (file)
index 0000000..4ba9b2d
--- /dev/null
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg" clip-path="url(#clip1)">
+    <clipPath id="clip2">
+        <rect x="25" y="25" width="150" height="150"/>
+    </clipPath>
+    <clipPath id="clip1">
+        <rect x="50" y="50" width="100" height="100"/>
+    </clipPath>
+    <rect width="200" height="200" fill="green"/>
+    <script>
+        var svg = document.documentElement;
+        svg.setAttribute('clip-path','url(#clip2)');
+    </script>
+</svg>
diff --git a/LayoutTests/svg/clip-path/clip-path-on-svg-004-expected.svg b/LayoutTests/svg/clip-path/clip-path-on-svg-004-expected.svg
new file mode 100644 (file)
index 0000000..246986f
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+    <rect x="25" y="25" width="150" height="150" fill="green"/>
+</svg>
diff --git a/LayoutTests/svg/clip-path/clip-path-on-svg-004.svg b/LayoutTests/svg/clip-path/clip-path-on-svg-004.svg
new file mode 100644 (file)
index 0000000..c1f8b99
--- /dev/null
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" clip-path="url(#clip1)">
+    <clipPath id="clip2">
+        <rect x="25" y="25" width="175" height="175"/>
+    </clipPath>
+    <clipPath id="clip1">
+        <rect width="175" height="175"/>
+    </clipPath>
+    <svg clip-path="url(#clip2)">
+        <rect width="200" height="200" fill="green"/>
+    </svg>
+</svg>
index 0b77680..ba4dd0e 100644 (file)
@@ -1,3 +1,25 @@
+2016-08-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        REGRESSION: SVG clip-path doesn't work on root <svg>
+        https://bugs.webkit.org/show_bug.cgi?id=129180
+
+        Reviewed by Tim Horton.
+
+        Build the resources cache for the RenderSVGRoot element when it's been
+        inserted in the render tree. Remove the resources cache before removing
+        the RenderSVGRoot from the render tree. No worries for the child <svg>
+        elements since their renderers are of type RenderSVGViewportContainer.
+
+        Tests: svg/clip-path/clip-path-on-svg-003.svg
+               svg/clip-path/clip-path-on-svg-004.svg
+
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::insertedIntoTree):
+        (WebCore::RenderSVGRoot::willBeRemovedFromTree):
+        * rendering/svg/RenderSVGRoot.h:
+        These changes are very similar to what we do for adding and removing the
+        child SVG elements in RenderSVGRoot::addChild() and removeChild().
+
 2016-08-23  Chris Dumez  <cdumez@apple.com>
 
         HTMLAreaElement should have a stringifier
index d92b0e5..2ab5524 100644 (file)
@@ -298,6 +298,18 @@ void RenderSVGRoot::willBeDestroyed()
     RenderReplaced::willBeDestroyed();
 }
 
+void RenderSVGRoot::insertedIntoTree()
+{
+    RenderReplaced::insertedIntoTree();
+    SVGResourcesCache::clientWasAddedToTree(*this);
+}
+
+void RenderSVGRoot::willBeRemovedFromTree()
+{
+    SVGResourcesCache::clientWillBeRemovedFromTree(*this);
+    RenderReplaced::willBeRemovedFromTree();
+}
+
 void RenderSVGRoot::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     if (diff == StyleDifferenceLayout)
index 9569142..03644dc 100644 (file)
@@ -78,6 +78,10 @@ private:
     void paintReplaced(PaintInfo&, const LayoutPoint&) override;
 
     void willBeDestroyed() override;
+
+    void insertedIntoTree() override;
+    void willBeRemovedFromTree() override;
+
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     void addChild(RenderObject* child, RenderObject* beforeChild = 0) override;
     void removeChild(RenderObject&) override;