WebKit Bugzilla
Attachment 343747 Details for
Bug 129246
: -webkit-clip-path wrong offset for clipPath references
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-129246-20180627223235.patch (text/plain), 9.84 KB, created by
Dirk Schulze
on 2018-06-27 13:32:37 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Dirk Schulze
Created:
2018-06-27 13:32:37 PDT
Size:
9.84 KB
patch
obsolete
>Subversion Revision: 233269 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 65a75bb135ede6f9d3312b1dcfe4d435256bb073..b8c6bae47988d4d12c28da50116ead4efeabe131 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-05-20 Dirk Schulze <krit@webkit.org> >+ >+ -webkit-clip-path wrong offset for clipPath references >+ https://bugs.webkit.org/show_bug.cgi?id=129246 >+ >+ Reviewed by Simon Fraser. >+ >+ Compute the correct offset for reference clip-paths by reusing >+ some of the logic from basic shapes. >+ Makes reference based clip-path interoperable and follows the >+ spec. >+ >+ Test: css3/masking/clip-path-reference-2.html >+ >+ * rendering/RenderLayer.cpp: >+ (WebCore::computeReferenceBox): >+ (WebCore::RenderLayer::computeClipPath const): >+ (WebCore::RenderLayer::setupClipPath): >+ > 2018-06-27 Youenn Fablet <youenn@apple.com> > > Disable content blockers in NetworkLoadChecker except for ping loads >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index c56048bcdcb7441f1d49c7f90e9b49d0cf29f791..4a55ce6eab9cf707e3dfdf866ec0f56e6f30f9fb 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -4083,8 +4083,7 @@ bool RenderLayer::setupFontSubpixelQuantization(GraphicsContext& context, bool& > return false; > } > >-template <class ReferenceBoxClipPathOperation> >-static inline LayoutRect computeReferenceBox(const RenderObject& renderer, const ReferenceBoxClipPathOperation& clippingPath, const LayoutSize& offsetFromRoot, const LayoutRect& rootRelativeBounds) >+static inline LayoutRect computeReferenceBox(const RenderObject& renderer, const CSSBoxType& boxType, const LayoutSize& offsetFromRoot, const LayoutRect& rootRelativeBounds) > { > // FIXME: Support different reference boxes for inline content. > // https://bugs.webkit.org/show_bug.cgi?id=129047 >@@ -4093,7 +4092,7 @@ static inline LayoutRect computeReferenceBox(const RenderObject& renderer, const > > LayoutRect referenceBox; > const auto& box = downcast<RenderBox>(renderer); >- switch (clippingPath.referenceBox()) { >+ switch (boxType) { > case CSSBoxType::ContentBox: > referenceBox = box.contentBoxRect(); > referenceBox.move(offsetFromRoot); >@@ -4126,7 +4125,7 @@ Path RenderLayer::computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& > > if (is<ShapeClipPathOperation>(*style.clipPath())) { > auto& clipPath = downcast<ShapeClipPathOperation>(*style.clipPath()); >- FloatRect referenceBox = snapRectToDevicePixels(computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds), deviceSaleFactor); >+ FloatRect referenceBox = snapRectToDevicePixels(computeReferenceBox(renderer(), clipPath.referenceBox(), offsetFromRoot, rootRelativeBounds), deviceSaleFactor); > > windRule = clipPath.windRule(); > return clipPath.pathForReferenceRect(referenceBox); >@@ -4157,10 +4156,10 @@ bool RenderLayer::setupClipPath(GraphicsContext& context, const LayerPaintingInf > } > > auto& style = renderer().style(); >+ LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelOffset, LayoutPoint(), renderer().document().deviceScaleFactor())); > ASSERT(style.clipPath()); > if (is<ShapeClipPathOperation>(*style.clipPath()) || (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer()))) { > WindRule windRule; >- LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelOffset, LayoutPoint(), renderer().document().deviceScaleFactor())); > Path path = computeClipPath(paintingOffsetFromRoot, rootRelativeBounds, windRule); > context.save(); > context.clipPath(path, windRule); >@@ -4170,9 +4169,15 @@ bool RenderLayer::setupClipPath(GraphicsContext& context, const LayerPaintingInf > if (style.clipPath()->type() == ClipPathOperation::Reference) { > ReferenceClipPathOperation* referenceClipPathOperation = static_cast<ReferenceClipPathOperation*>(style.clipPath()); > Element* element = renderer().document().getElementById(referenceClipPathOperation->fragment()); >- if (element && element->hasTagName(SVGNames::clipPathTag) && element->renderer()) { >+ if (element && element->renderer() && is<RenderSVGResourceClipper>(element->renderer())) { > context.save(); >- downcast<RenderSVGResourceClipper>(*element->renderer()).applyClippingToContext(renderer(), rootRelativeBounds, paintingInfo.paintDirtyRect, context); >+ float deviceSaleFactor = renderer().document().deviceScaleFactor(); >+ FloatRect referenceBox = snapRectToDevicePixels(computeReferenceBox(renderer(), CSSBoxType::ContentBox, paintingOffsetFromRoot, rootRelativeBounds), deviceSaleFactor); >+ FloatPoint offset {referenceBox.location()}; >+ context.translate(offset); >+ FloatRect svgReferenceBox {FloatPoint(), referenceBox.size()}; >+ downcast<RenderSVGResourceClipper>(*element->renderer()).applyClippingToContext(renderer(), svgReferenceBox, paintingInfo.paintDirtyRect, context); >+ context.translate(FloatPoint(-offset.x(), -offset.y())); > return true; > } > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a81e298e8ff616ee247a6dca79a1607dcf367bad..75feec725f42dfdeb975fcf43f229017236025e7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-20 Dirk Schulze <krit@webkit.org> >+ >+ -webkit-clip-path wrong offset for clipPath references >+ https://bugs.webkit.org/show_bug.cgi?id=129246 >+ >+ Reviewed by Simon Fraser. >+ >+ Add test for reference clip-path offset. Correct a broken test. >+ All tests in the repo for references are interoperable between Gecko, Blink >+ and WebKit now. >+ >+ * css3/masking/clip-path-reference-2-expected.html: Added. >+ * css3/masking/clip-path-reference-2.html: Added. >+ * css3/masking/clip-path-reference-userSpaceOnUse-expected.html: >+ * css3/masking/clip-path-reference-userSpaceOnUse.html: >+ > 2018-06-27 Youenn Fablet <youenn@apple.com> > > Disable content blockers in NetworkLoadChecker except for ping loads >diff --git a/LayoutTests/css3/masking/clip-path-reference-2-expected.html b/LayoutTests/css3/masking/clip-path-reference-2-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..643a21800b17dd398ddd1290efd6d3471e1947ce >--- /dev/null >+++ b/LayoutTests/css3/masking/clip-path-reference-2-expected.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+<style> >+ >+#div1 { >+ width: 200px; >+ height: 200px; >+ -webkit-clip-path: circle(); >+ background-color: green; >+} >+#div2 { >+ width: 200px; >+ height: 200px; >+ -webkit-clip-path: ellipse(150px 75px at 150px 75px); >+ background-color: green; >+} >+* { >+ padding: 0; >+ margin: 0; >+} >+</style> >+<div id="div1"></div> >+<div id="div2"></div> >+<svg> >+ <clipPath id="clip"> >+ <ellipse cx="100" cy="100" rx="100" ry="100"/> >+ </clipPath> >+ <clipPath id="clip2"> >+ <ellipse cx="50%" cy="50%" rx="50%" ry="50%"/> >+ </clipPath> >+</svg> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/css3/masking/clip-path-reference-2.html b/LayoutTests/css3/masking/clip-path-reference-2.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ffb34a244a3ce666e7debf89ffdd6caa8f87418e >--- /dev/null >+++ b/LayoutTests/css3/masking/clip-path-reference-2.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+<style> >+ >+#div1 { >+ width: 200px; >+ height: 200px; >+ -webkit-clip-path: url("#clip"); >+ background-color: green; >+} >+#div2 { >+ width: 200px; >+ height: 200px; >+ -webkit-clip-path: url("#clip2"); >+ background-color: green; >+} >+* { >+ padding: 0; >+ margin: 0; >+} >+</style> >+<div id="div1"></div> >+<div id="div2"></div> >+<svg> >+ <clipPath id="clip"> >+ <ellipse cx="100" cy="100" rx="100" ry="100"/> >+ </clipPath> >+ <clipPath id="clip2"> >+ <ellipse cx="50%" cy="50%" rx="50%" ry="50%"/> >+ </clipPath> >+</svg> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse-expected.html b/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse-expected.html >index 3a98e48be2f1eb72a657f5d3e795334f25a8cc13..e9622cbc9df68b9272979fb2727e764409180283 100644 >--- a/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse-expected.html >+++ b/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse-expected.html >@@ -7,13 +7,13 @@ > width: 180px; > height: 180px; > border: 1px solid black; >- background-color: red; >+ background-color: blue; > margin-top: 104px; > } > #clip-ref { > width: 32px; > height: 32px; >- margin: 74px; >+ margin: 75px; > background-color: green; > } > </style> >diff --git a/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse.html b/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse.html >index 4c4eeb98c474d97c3b881bae4df61e61b5675a0e..33ea9049c39086e1b7e935793267656aa313ad38 100644 >--- a/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse.html >+++ b/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse.html >@@ -7,7 +7,7 @@ > width: 180px; > height: 180px; > border: 1px solid black; >- background-color: red; >+ background-color: blue; > } > #clip { > width: 160px; >@@ -16,18 +16,12 @@ > background-color: green; > -webkit-clip-path: url(#c2); > } >-#clip-ref { >- width: 32px; >- height: 32px; >- margin: 74px; >- background-color: green; >-} > </style> > </head> > <body> > <svg height="100" width="100"> > <clipPath id="c2" clipPathUnits="userSpaceOnUse"> >- <rect x="75" y="179" width="32" height="32"/> >+ <rect x="65" y="65" width="32" height="32"/> > </clipPath> > </svg> > <div id="d"><div id="clip"></div></div>
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 129246
:
225035
|
340807
| 343747