WebKit Bugzilla
Attachment 343839 Details for
Bug 185829
: [css-masking] Fully support -webkit-clip-path on SVG elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185829-20180628220727.patch (text/plain), 26.71 KB, created by
Dirk Schulze
on 2018-06-28 13:07:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dirk Schulze
Created:
2018-06-28 13:07:28 PDT
Size:
26.71 KB
patch
obsolete
>Subversion Revision: 233303 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8df6c9c4b788a522514aaabc4f4bdd39e0599e46..16242d772439eef05c3eb91c7e55beed36a7b01b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2018-06-28 Dirk Schulze <krit@webkit.org> >+ >+ [css-masking] Fully support -webkit-clip-path on SVG elements >+ https://bugs.webkit.org/show_bug.cgi?id=185829 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ -webkit-clip-path contributes to SVG elements with boxes, shapes and now with >+ element references to <clipPath> elements as well. Make sure that all types >+ contribute to hit-testing of the SVG element as well as they should. >+ >+ Tests: svg/clip-path/webkit-clip-path-after-expected.svg >+ svg/clip-path/webkit-clip-path-after.svg >+ svg/clip-path/webkit-clip-path-before-expected.svg >+ svg/clip-path/webkit-clip-path-before.svg >+ svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html >+ svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html >+ svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html >+ svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html >+ >+ * rendering/svg/SVGRenderSupport.cpp: Share code as much as possible. >+ (WebCore::clipPathReferenceBox): >+ (WebCore::isPointInCSSClippingArea): Take -webkit-clip-path into account. >+ (WebCore::SVGRenderSupport::clipContextToCSSClippingArea): >+ (WebCore::SVGRenderSupport::pointInClippingArea): >+ * rendering/svg/SVGRenderSupport.h: >+ * rendering/svg/SVGRenderingContext.cpp: Clip to -webkit-clip-path boxes, shapes and references. >+ (WebCore::SVGRenderingContext::prepareToRenderSVGContent): >+ * rendering/svg/SVGResources.cpp: Add -webkit-clip-path references to cached resources. Mimic SVG clip-path. >+ (WebCore::SVGResources::buildCachedResources): >+ > 2018-06-28 Dirk Schulze <krit@webkit.org> > > [css-masking] Update clip-path box mapping to unified box >diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp >index 0864587fff961d6c1ab283878ab91fdd2d28764a..cad4fa2ccfa02b0065c8a80b3949aa2ce7fe4780 100644 >--- a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp >+++ b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp >@@ -5,6 +5,7 @@ > * Copyright (C) 2009 Google, Inc. All rights reserved. > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> > * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. >+ * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -404,8 +405,67 @@ bool SVGRenderSupport::filtersForceContainerLayout(const RenderElement& renderer > return true; > } > >+inline FloatRect clipPathReferenceBox(const RenderElement& renderer, const CSSBoxType& boxType) >+{ >+ // Depends on https://bugs.webkit.org/show_bug.cgi?id=185797 >+ FloatRect referenceBox { }; >+ if (boxType == CSSBoxType::StrokeBox || boxType == CSSBoxType::BorderBox >+ || boxType == CSSBoxType::MarginBox) >+ { >+ // FIXME: strokeBoundingBox() takes dasharray into account but shouldn't. >+ referenceBox = renderer.strokeBoundingBox(); >+ } else if (boxType == CSSBoxType::ViewBox && renderer.element()) { >+ FloatSize viewportSize; >+ SVGLengthContext(downcast<SVGElement>(renderer.element())).determineViewport(viewportSize); >+ referenceBox.setWidth(viewportSize.width()); >+ referenceBox.setHeight(viewportSize.height()); >+ } else >+ referenceBox = renderer.objectBoundingBox(); >+ return referenceBox; >+} >+ >+inline bool isPointInCSSClippingArea(const RenderElement& renderer, const FloatPoint& point) >+{ >+ ClipPathOperation* clipPathOperation = renderer.style().clipPath(); >+ if (is<ShapeClipPathOperation>(clipPathOperation)) { >+ auto& clipPath = downcast<ShapeClipPathOperation>(*clipPathOperation); >+ FloatRect referenceBox {clipPathReferenceBox(renderer, clipPath.referenceBox())}; >+ if (!referenceBox.contains(point)) >+ return false; >+ return clipPath.pathForReferenceRect(referenceBox).contains(point, clipPath.windRule()); >+ } >+ if (is<BoxClipPathOperation>(clipPathOperation)) { >+ auto& clipPath = downcast<BoxClipPathOperation>(*clipPathOperation); >+ FloatRect referenceBox {clipPathReferenceBox(renderer, clipPath.referenceBox())}; >+ if (!referenceBox.contains(point)) >+ return false; >+ return clipPath.pathForReferenceRect(FloatRoundedRect {referenceBox}).contains(point); >+ } >+ >+ return true; >+} >+ >+void SVGRenderSupport::clipContextToCSSClippingArea(GraphicsContext& context, const RenderElement& renderer) >+{ >+ ClipPathOperation* clipPathOperation = renderer.style().clipPath(); >+ if (is<ShapeClipPathOperation>(clipPathOperation)) { >+ auto& clipPath = downcast<ShapeClipPathOperation>(*clipPathOperation); >+ FloatRect referenceBox {clipPathReferenceBox(renderer, clipPath.referenceBox())}; >+ context.clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule()); >+ } >+ if (is<BoxClipPathOperation>(clipPathOperation)) { >+ auto& clipPath = downcast<BoxClipPathOperation>(*clipPathOperation); >+ FloatRect referenceBox {clipPathReferenceBox(renderer, clipPath.referenceBox())}; >+ context.clipPath(clipPath.pathForReferenceRect(FloatRoundedRect {referenceBox})); >+ } >+} >+ > bool SVGRenderSupport::pointInClippingArea(const RenderElement& renderer, const FloatPoint& point) > { >+ ClipPathOperation* clipPathOperation = renderer.style().clipPath(); >+ if (is<ShapeClipPathOperation>(clipPathOperation) || is<BoxClipPathOperation>(clipPathOperation)) >+ return isPointInCSSClippingArea(renderer, point); >+ > // We just take clippers into account to determine if a point is on the node. The Specification may > // change later and we also need to check maskers. > auto* resources = SVGResourcesCache::cachedResourcesForRenderer(renderer); >diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.h b/Source/WebCore/rendering/svg/SVGRenderSupport.h >index d6ff72d7cf28e7c877c4cbcda2d11cf528f31dfb..b3533395f220466a4db4d1b3edd3343f35860a49 100644 >--- a/Source/WebCore/rendering/svg/SVGRenderSupport.h >+++ b/Source/WebCore/rendering/svg/SVGRenderSupport.h >@@ -80,6 +80,8 @@ public: > // Determines if any ancestor's transform has changed. > static bool transformToRootChanged(RenderElement*); > >+ static void clipContextToCSSClippingArea(GraphicsContext&, const RenderElement& renderer); >+ > // Helper functions to keep track of whether a renderer has an SVG shadow applied. > static bool rendererHasSVGShadow(const RenderObject&); > static void setRendererHasSVGShadow(RenderObject&, bool hasShadow); >diff --git a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp >index 764248989d7fa47e20e2dac300b91c2c3e6c7e56..2baa2f1bbe31ba631f21673317a12b1b414f793f 100644 >--- a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp >+++ b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp >@@ -5,6 +5,7 @@ > * Copyright (C) 2009 Google, Inc. All rights reserved. > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> > * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. >+ * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -134,23 +135,9 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderElement& renderer, Pai > } > > ClipPathOperation* clipPathOperation = style.clipPath(); >- if (is<ShapeClipPathOperation>(clipPathOperation)) { >- auto& clipPath = downcast<ShapeClipPathOperation>(*clipPathOperation); >- FloatRect referenceBox; >- if (clipPath.referenceBox() == CSSBoxType::StrokeBox || clipPath.referenceBox() == CSSBoxType::MarginBox >- || clipPath.referenceBox() == CSSBoxType::BorderBox) >- { >- // FIXME: strokeBoundingBox() takes dasharray into account but shouldn't. >- referenceBox = renderer.strokeBoundingBox(); >- } else if (clipPath.referenceBox() == CSSBoxType::ViewBox && renderer.element()) { >- FloatSize viewportSize; >- SVGLengthContext(downcast<SVGElement>(renderer.element())).determineViewport(viewportSize); >- referenceBox.setWidth(viewportSize.width()); >- referenceBox.setHeight(viewportSize.height()); >- } else >- referenceBox = renderer.objectBoundingBox(); >- m_paintInfo->context().clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule()); >- } >+ bool hasCSSClipping = is<ShapeClipPathOperation>(clipPathOperation) || is<BoxClipPathOperation>(clipPathOperation); >+ if (hasCSSClipping) >+ SVGRenderSupport::clipContextToCSSClippingArea(m_paintInfo->context(), renderer); > > auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*m_renderer); > if (!resources) { >@@ -172,7 +159,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderElement& renderer, Pai > } > > RenderSVGResourceClipper* clipper = resources->clipper(); >- if (!clipPathOperation && clipper) { >+ if (!hasCSSClipping && clipper) { > GraphicsContext* contextPtr = &m_paintInfo->context(); > bool result = clipper->applyResource(*m_renderer, style, contextPtr, RenderSVGResourceMode::ApplyToDefault); > m_paintInfo->setContext(*contextPtr); >diff --git a/Source/WebCore/rendering/svg/SVGResources.cpp b/Source/WebCore/rendering/svg/SVGResources.cpp >index 68fae6181be5cc935e6aad5b7e785cb2cf2722d6..a2cc4bad9bf9856d61211d74e6576ff1bd09100c 100644 >--- a/Source/WebCore/rendering/svg/SVGResources.cpp >+++ b/Source/WebCore/rendering/svg/SVGResources.cpp >@@ -20,6 +20,7 @@ > #include "config.h" > #include "SVGResources.h" > >+#include "ClipPathOperation.h" > #include "FilterOperation.h" > #include "RenderSVGResourceClipper.h" > #include "RenderSVGResourceFilter.h" >@@ -220,6 +221,15 @@ bool SVGResources::buildCachedResources(const RenderElement& renderer, const Ren > foundResources = true; > else > registerPendingResource(extensions, id, element); >+ } else if (is<ReferenceClipPathOperation>(style.clipPath())) { >+ // FIXME: -webkit-clip-path should support external resources >+ // https://bugs.webkit.org/show_bug.cgi?id=127032 >+ auto& clipPath = downcast<ReferenceClipPathOperation>(*style.clipPath()); >+ AtomicString id(clipPath.fragment()); >+ if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id))) >+ foundResources = true; >+ else >+ registerPendingResource(extensions, id, element); > } > > if (style.hasFilter()) { >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 0d1eff47fc90e567913564f7eb5d24ff6d48bceb..6df77f7dc4dc241e0cab68d6e66d20624e06bbf7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,26 @@ >+2018-06-28 Dirk Schulze <krit@webkit.org> >+ >+ [css-masking] Fully support -webkit-clip-path on SVG elements >+ https://bugs.webkit.org/show_bug.cgi?id=185829 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test -webkit-clip-path element references on SVG elements. Make sure, -webkit-clip-path >+ contributes to hit testing for element references and basic shapes. >+ >+ * svg/clip-path/webkit-clip-path-after-expected.svg: Added. >+ * svg/clip-path/webkit-clip-path-after.svg: Added. >+ * svg/clip-path/webkit-clip-path-before-expected.svg: Added. >+ * svg/clip-path/webkit-clip-path-before.svg: Added. >+ * svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting-expected.txt: Added. >+ * svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html: Added. >+ * svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting-expected.txt: Added. >+ * svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html: Added. >+ * svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting-expected.txt: Added. >+ * svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html: Added. >+ * svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting-expected.txt: Added. >+ * svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html: Added. >+ > 2018-06-28 Dirk Schulze <krit@webkit.org> > > [css-masking] Update clip-path box mapping to unified box >diff --git a/LayoutTests/svg/clip-path/webkit-clip-path-after-expected.svg b/LayoutTests/svg/clip-path/webkit-clip-path-after-expected.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..75471cab1a05892d7bfc60fb0c31d27f8fd02eb3 >--- /dev/null >+++ b/LayoutTests/svg/clip-path/webkit-clip-path-after-expected.svg >@@ -0,0 +1,3 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+<circle cx="100" cy="100" r="100" fill="green"/> >+</svg> >\ No newline at end of file >diff --git a/LayoutTests/svg/clip-path/webkit-clip-path-after.svg b/LayoutTests/svg/clip-path/webkit-clip-path-after.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..036c0e9183dcb2e813c28769111cfeb438e7d3fb >--- /dev/null >+++ b/LayoutTests/svg/clip-path/webkit-clip-path-after.svg >@@ -0,0 +1,6 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+<rect width="200" height="200" fill="green" style="-webkit-clip-path: url(#clip1)"/> >+<clipPath id="clip1"> >+ <circle cx="100" cy="100" r="100"/> >+</clipPath> >+</svg> >\ No newline at end of file >diff --git a/LayoutTests/svg/clip-path/webkit-clip-path-before-expected.svg b/LayoutTests/svg/clip-path/webkit-clip-path-before-expected.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..75471cab1a05892d7bfc60fb0c31d27f8fd02eb3 >--- /dev/null >+++ b/LayoutTests/svg/clip-path/webkit-clip-path-before-expected.svg >@@ -0,0 +1,3 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+<circle cx="100" cy="100" r="100" fill="green"/> >+</svg> >\ No newline at end of file >diff --git a/LayoutTests/svg/clip-path/webkit-clip-path-before.svg b/LayoutTests/svg/clip-path/webkit-clip-path-before.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..0110e23df7595e1fb1f9410da4a9ff55904398ec >--- /dev/null >+++ b/LayoutTests/svg/clip-path/webkit-clip-path-before.svg >@@ -0,0 +1,6 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+<clipPath id="clip1"> >+ <circle cx="100" cy="100" r="100"/> >+</clipPath> >+<rect width="200" height="200" fill="green" style="-webkit-clip-path: url(#clip1)"/> >+</svg> >\ No newline at end of file >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting-expected.txt b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5b11bd7cd9e800ee3deb505ca66c58b05ad7b2ec >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting-expected.txt >@@ -0,0 +1,12 @@ >+SVG 1.1 dynamic update tests >+ >+Tests hitTesting on clipped Elements. Clipped areas shouldn't throw a hit. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Hit thrown on not clipped area of rect. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..78a8275b68f1496a4b0406bff7435d061d1c29eb >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html >@@ -0,0 +1,57 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<script src="resources/SVGTestCase.js"></script> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../../fast/repaint/resources/repaint.js"></script> >+</head> >+<body onload="runRepaintTest()"> >+<h1>SVG 1.1 dynamic update tests</h1> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+// [Name] SVGClipPathElement-svgdom-clipPathUnits-prop.js >+// [Expected rendering result] green circle - and a series of PASS messages >+ >+description("Tests hitTesting on clipped Elements. Clipped areas shouldn't throw a hit.") >+createSVGTestCase(); >+ >+var defsElement = createSVGElement("defs"); >+rootSVGElement.appendChild(defsElement); >+ >+var clipPathElement = createSVGElement("clipPath"); >+clipPathElement.setAttribute("id", "clipper"); >+ >+var clipRectElement = createSVGElement("rect"); >+clipRectElement.setAttribute("width", "50"); >+clipRectElement.setAttribute("height", "100"); >+clipPathElement.appendChild(clipRectElement); >+ >+defsElement.appendChild(clipPathElement); >+ >+var backgroundRect = createSVGElement("rect"); >+backgroundRect.setAttribute("width", "100"); >+backgroundRect.setAttribute("height", "100"); >+backgroundRect.setAttribute("fill", "green"); >+backgroundRect.setAttribute("onclick", "testPassed('Hit thrown on not clipped area of rect.'); completeTest()"); >+rootSVGElement.appendChild(backgroundRect); >+ >+var foregroundRect = createSVGElement("rect"); >+foregroundRect.setAttribute("width", "100"); >+foregroundRect.setAttribute("height", "100"); >+foregroundRect.setAttribute("fill", "green"); >+foregroundRect.setAttribute("style", "-webkit-clip-path: url(#clipper)"); >+foregroundRect.setAttribute("onclick", "testFailed('Clipped are of rect throw a hit'); completeTest();"); >+rootSVGElement.appendChild(foregroundRect); >+ >+// Two rects are drawn. One in the background and one in the foreground. The rect >+// in the foreground gets clipped, so on hittesting, the background rect should >+// throw a hit. >+function repaintTest() { >+ clickAt(75, 50); >+} >+ >+var successfullyParsed = true; >+</script> >+</body> >+</html> >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting-expected.txt b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5b11bd7cd9e800ee3deb505ca66c58b05ad7b2ec >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting-expected.txt >@@ -0,0 +1,12 @@ >+SVG 1.1 dynamic update tests >+ >+Tests hitTesting on clipped Elements. Clipped areas shouldn't throw a hit. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Hit thrown on not clipped area of rect. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f83e2df5a827cf0d99ed9ea914dfd8f2b8ca2338 >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html >@@ -0,0 +1,44 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<script src="resources/SVGTestCase.js"></script> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../../fast/repaint/resources/repaint.js"></script> >+</head> >+<body onload="runRepaintTest()"> >+<h1>SVG 1.1 dynamic update tests</h1> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+// [Name] SVGClipPathElement-svgdom-clipPathUnits-prop.js >+// [Expected rendering result] green circle - and a series of PASS messages >+ >+description("Tests hitTesting on clipped Elements. Clipped areas shouldn't throw a hit.") >+createSVGTestCase(); >+ >+var backgroundRect = createSVGElement("rect"); >+backgroundRect.setAttribute("width", "100"); >+backgroundRect.setAttribute("height", "100"); >+backgroundRect.setAttribute("fill", "green"); >+backgroundRect.setAttribute("onclick", "testPassed('Hit thrown on not clipped area of rect.'); completeTest()"); >+rootSVGElement.appendChild(backgroundRect); >+ >+var foregroundRect = createSVGElement("rect"); >+foregroundRect.setAttribute("width", "100"); >+foregroundRect.setAttribute("height", "100"); >+foregroundRect.setAttribute("fill", "green"); >+foregroundRect.setAttribute("style", "-webkit-clip-path: path('M0,0L50,0L50,100L0,100z')"); >+foregroundRect.setAttribute("onclick", "testFailed('Clipped are of rect throw a hit'); completeTest();"); >+rootSVGElement.appendChild(foregroundRect); >+ >+// Two rects are drawn. One in the background and one in the foreground. The rect >+// in the foreground gets clipped, so on hittesting, the background rect should >+// throw a hit. >+function repaintTest() { >+ clickAt(75, 50); >+} >+ >+var successfullyParsed = true; >+</script> >+</body> >+</html> >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting-expected.txt b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6952d304d28ad9cb17c6c0a0d384483224a8d4d2 >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting-expected.txt >@@ -0,0 +1,12 @@ >+SVG 1.1 dynamic update tests >+ >+Tests hitTesting on clipped Elements. Clip-path gets CSS transformed. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Hit thrown on not clipped area of rect. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..edc83dc7628ff330662eec833daa897d15451c08 >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html >@@ -0,0 +1,50 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<script src="resources/SVGTestCase.js"></script> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../../fast/repaint/resources/repaint.js"></script> >+</head> >+<body onload="runRepaintTest()"> >+<h1>SVG 1.1 dynamic update tests</h1> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+// [Name] SVGClipPathElement-transform-influences-hitTesting.js >+// [Expected rendering result] green circle - and a series of PASS messages >+ >+description("Tests hitTesting on clipped Elements. Clip-path gets CSS transformed.") >+createSVGTestCase(); >+ >+var defsElement = createSVGElement("defs"); >+rootSVGElement.appendChild(defsElement); >+ >+var clipPathElement = createSVGElement("clipPath"); >+clipPathElement.setAttribute("id", "clipper"); >+ >+var clipRectElement = createSVGElement("rect"); >+clipRectElement.setAttribute("width", "5"); >+clipRectElement.setAttribute("height", "5"); >+clipRectElement.setAttribute("style", "-webkit-transform: scale(20)"); >+clipPathElement.appendChild(clipRectElement); >+ >+defsElement.appendChild(clipPathElement); >+ >+var foregroundRect = createSVGElement("rect"); >+foregroundRect.setAttribute("width", "100"); >+foregroundRect.setAttribute("height", "100"); >+foregroundRect.setAttribute("fill", "green"); >+foregroundRect.setAttribute("style", "-webkit-clip-path: url(#clipper)"); >+foregroundRect.setAttribute("onclick", "testPassed('Hit thrown on not clipped area of rect.'); completeTest();"); >+rootSVGElement.appendChild(foregroundRect); >+ >+// The clipPath gets scaled by 20. This should influence the hit testing, >+// since the area of the clipped content is affected as well. >+function repaintTest() { >+ clickAt(75, 50); >+} >+ >+var successfullyParsed = true; >+</script> >+</body> >+</html> >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting-expected.txt b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..11e4d9dbbc8e51ff358f2c831bc54cff5ce16bf4 >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting-expected.txt >@@ -0,0 +1,12 @@ >+SVG 1.1 dynamic update tests >+ >+Tests hitTesting on clipped Elements. Clip-path gets transformed. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Hit thrown on not clipped area of rect. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b7dfb242d1cb216a4dbb529a667ffc37699047dd >--- /dev/null >+++ b/LayoutTests/svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html >@@ -0,0 +1,50 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<script src="resources/SVGTestCase.js"></script> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../../fast/repaint/resources/repaint.js"></script> >+</head> >+<body onload="runRepaintTest()"> >+<h1>SVG 1.1 dynamic update tests</h1> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+// [Name] SVGClipPathElement-transform-influences-hitTesting.js >+// [Expected rendering result] green circle - and a series of PASS messages >+ >+description("Tests hitTesting on clipped Elements. Clip-path gets transformed.") >+createSVGTestCase(); >+ >+var defsElement = createSVGElement("defs"); >+rootSVGElement.appendChild(defsElement); >+ >+var clipPathElement = createSVGElement("clipPath"); >+clipPathElement.setAttribute("id", "clipper"); >+ >+var clipRectElement = createSVGElement("rect"); >+clipRectElement.setAttribute("width", "5"); >+clipRectElement.setAttribute("height", "5"); >+clipRectElement.setAttribute("transform", "scale(20)"); >+clipPathElement.appendChild(clipRectElement); >+ >+defsElement.appendChild(clipPathElement); >+ >+var foregroundRect = createSVGElement("rect"); >+foregroundRect.setAttribute("width", "100"); >+foregroundRect.setAttribute("height", "100"); >+foregroundRect.setAttribute("fill", "green"); >+foregroundRect.setAttribute("style", "-webkit-clip-path: url(#clipper)"); >+foregroundRect.setAttribute("onclick", "testPassed('Hit thrown on not clipped area of rect.'); completeTest();"); >+rootSVGElement.appendChild(foregroundRect); >+ >+// The clipPath gets scaled by 20. This should influence the hit testing, >+// since the area of the clipped content is affected as well. >+function repaintTest() { >+ clickAt(75, 50); >+} >+ >+var successfullyParsed = true; >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185829
:
343839
|
343864
|
343875
|
343895
|
343897
|
343912
|
345032