Bug 1501057 - Trivial clipPaths should respect visibility=hidden r=dholbert
authorlongsonr <longsonr@gmail.com>
Wed, 24 Oct 2018 06:01:57 +0100
changeset 491049 915d77bbcf8b9eafb9a51af01e06c146175f1dfc
parent 491048 c1f0dc8791b7d774225f3fdb7502bcd7d07fb4be
child 491050 460f9791ba8a7c40171fe8762bb827c59c83e9e3
child 491057 3a314e76d8c148e223cf683b15ba2a357ebe4b42
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersdholbert
bugs1501057
milestone65.0a1
Bug 1501057 - Trivial clipPaths should respect visibility=hidden r=dholbert
layout/reftests/svg/clipPath-basic-08.svg
layout/reftests/svg/reftest.list
layout/svg/nsSVGClipPathFrame.cpp
testing/web-platform/meta/css/css-masking/clip-path-svg-content/clip-path-content-invisible.svg.ini
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/clipPath-basic-08.svg
@@ -0,0 +1,22 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
+
+  <title>Testcase for basic clipPath</title>
+
+  <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=1501057 -->
+
+  <defs>
+    <clipPath id="clip1">
+      <rect width="100%" height="100%" visibility="hidden"/>
+    </clipPath>
+    <clipPath id="clip2">
+      <rect width="100%" height="100%" visibility="hidden"/>
+      <rect width="100%" height="100%" visibility="hidden"/>
+    </clipPath>
+  </defs>
+
+  <rect width="100%" height="100%" fill="lime"/>
+
+  <rect width="100%" height="50%" fill="red" clip-path="url(#clip1)"/>
+  <rect width="100%" y="50%" height="50%" fill="red" clip-path="url(#clip2)"/>
+
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -72,16 +72,17 @@ fuzzy-if(/^Windows\x20NT\x2010\.0/.test(
 == clipPath-and-transform-01.svg pass.svg
 == clipPath-basic-01.svg pass.svg
 == clipPath-basic-02.svg pass.svg
 == clipPath-basic-03.svg pass.svg
 == clipPath-basic-04.svg pass.svg
 == clipPath-basic-05.svg pass.svg
 == clipPath-basic-06.svg pass.svg
 == clipPath-basic-07.svg pass.svg
+== clipPath-basic-08.svg pass.svg
 == clipPath-on-outflowElement-01a.html clipPath-on-outflowElement-01-ref.html
 == clipPath-on-outflowElement-01b.html clipPath-on-outflowElement-01-ref.html
 fuzzy(0-1,0-32400) == clipPath-on-outflowElement-02a.html clipPath-on-outflowElement-02-ref.html
 fuzzy(0-1,0-32400) == clipPath-on-outflowElement-02b.html clipPath-on-outflowElement-02-ref.html
 == clipPath-polygon-01.svg pass.svg
 == clipPath-polygon-elementFromPoint-01.svg pass.svg
 != clipPath-on-thin-object.svg about:blank
 == clipPath-winding-01.svg pass.svg
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -51,17 +51,17 @@ nsSVGClipPathFrame::ApplyClipPath(gfxCon
 
   RefPtr<Path> clipPath;
 
   nsSVGDisplayableFrame* singleClipPathChild = nullptr;
   IsTrivial(&singleClipPathChild);
 
   if (singleClipPathChild) {
     SVGGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild);
-    if (pathFrame) {
+    if (pathFrame && pathFrame->StyleVisibility()->IsVisible()) {
       SVGGeometryElement* pathElement =
         static_cast<SVGGeometryElement*>(pathFrame->GetContent());
       gfxMatrix toChildsUserSpace = pathElement->
         PrependLocalTransformsTo(GetClipPathTransform(aClippedFrame) * aMatrix,
                                  eUserSpaceToParent);
       gfxMatrix newMatrix =
         aContext.CurrentMatrixDouble().PreMultiply(toChildsUserSpace).NudgeToIntegers();
       if (!newMatrix.IsSingular()) {
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-masking/clip-path-svg-content/clip-path-content-invisible.svg.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[clip-path-content-invisible.svg]
-  expected: FAIL