Diff
Modified: trunk/LayoutTests/ChangeLog (185342 => 185343)
--- trunk/LayoutTests/ChangeLog 2015-06-09 00:28:19 UTC (rev 185342)
+++ trunk/LayoutTests/ChangeLog 2015-06-09 00:29:13 UTC (rev 185343)
@@ -1,3 +1,19 @@
+2015-06-08 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Clip-path does not work properly on subpixel positions.
+ https://bugs.webkit.org/show_bug.cgi?id=145749
+ rdar://problem/20824305
+
+ Reviewed by Simon Fraser.
+
+ This patch ensures that clip-path is device pixel snapped both for composited and
+ non-composited content.
+
+ * compositing/masks/compositing-clip-path-on-subpixel-position-expected.html: Added.
+ * compositing/masks/compositing-clip-path-on-subpixel-position.html: Added.
+ * fast/masking/clip-path-on-subpixel-position-expected.html: Added.
+ * fast/masking/clip-path-on-subpixel-position.html: Added.
+
2015-06-08 Daniel Bates <[email protected]>
Mouse release on AutoFill button activates it; should only activate on click
Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-on-subpixel-position-expected.html (0 => 185343)
--- trunk/LayoutTests/compositing/masks/compositing-clip-path-on-subpixel-position-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-on-subpixel-position-expected.html 2015-06-09 00:29:13 UTC (rev 185343)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests proper clip-path masking when content is on subpixel position and the parent is composited too.</title>
+<style>
+ .clip-path-content {
+ transform: translateZ(0);
+ position: relative;
+ left: 1px;
+ top: 0px;
+ height: 50px;
+ width: 100px;
+ background-color: black;
+ -webkit-clip-path: inset(20px 0px 0px 0px);
+ }
+</style>
+</head>
+<body>
+<div class=clip-path-content></div>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-on-subpixel-position.html (0 => 185343)
--- trunk/LayoutTests/compositing/masks/compositing-clip-path-on-subpixel-position.html (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-on-subpixel-position.html 2015-06-09 00:29:13 UTC (rev 185343)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests proper clip-path masking when content is on subpixel position and the parent is composited too.</title>
+<style>
+ .clip-path-content {
+ transform: translateZ(0);
+ position: relative;
+ left: 0.5px;
+ top: 0px;
+ height: 50px;
+ width: 100px;
+ background-color: black;
+ -webkit-clip-path: inset(20px 0px 0px 0px);
+ }
+</style>
+</head>
+<body>
+<div class=clip-path-content></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/masking/clip-path-on-subpixel-position-expected.html (0 => 185343)
--- trunk/LayoutTests/fast/masking/clip-path-on-subpixel-position-expected.html (rev 0)
+++ trunk/LayoutTests/fast/masking/clip-path-on-subpixel-position-expected.html 2015-06-09 00:29:13 UTC (rev 185343)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests proper clip-path masking when content is on subpixel position.</title>
+<style>
+ .clip-path-content {
+ position: relative;
+ left: 1px;
+ top: 0px;
+ height: 50px;
+ width: 100px;
+ background-color: black;
+ -webkit-clip-path: inset(20px 0px 0px 0px);
+ }
+</style>
+</head>
+<body>
+<div class=clip-path-content></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/masking/clip-path-on-subpixel-position.html (0 => 185343)
--- trunk/LayoutTests/fast/masking/clip-path-on-subpixel-position.html (rev 0)
+++ trunk/LayoutTests/fast/masking/clip-path-on-subpixel-position.html 2015-06-09 00:29:13 UTC (rev 185343)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests proper clip-path masking when content is on subpixel position.</title>
+<style>
+ .clip-path-content {
+ position: relative;
+ left: 0.5px;
+ top: 0px;
+ height: 50px;
+ width: 100px;
+ background-color: black;
+ -webkit-clip-path: inset(20px 0px 0px 0px);
+ }
+</style>
+</head>
+<body>
+<div class=clip-path-content></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (185342 => 185343)
--- trunk/Source/WebCore/ChangeLog 2015-06-09 00:28:19 UTC (rev 185342)
+++ trunk/Source/WebCore/ChangeLog 2015-06-09 00:29:13 UTC (rev 185343)
@@ -1,3 +1,22 @@
+2015-06-08 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Clip-path does not work properly on subpixel positions.
+ https://bugs.webkit.org/show_bug.cgi?id=145749
+ rdar://problem/20824305
+
+ Reviewed by Simon Fraser.
+
+ This patch ensures that clip-path is device pixel snapped both for composited and
+ non-composited content.
+
+ Tests: compositing/masks/compositing-clip-path-on-subpixel-position.html
+ fast/masking/clip-path-on-subpixel-position.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::setupClipPath):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateMaskingLayerGeometry):
+
2015-06-08 Chris Dumez <[email protected]>
Access GCController instance via GCController::singleton() instead of a free function
Modified: trunk/Source/WebCore/rendering/ClipPathOperation.h (185342 => 185343)
--- trunk/Source/WebCore/rendering/ClipPathOperation.h 2015-06-09 00:28:19 UTC (rev 185342)
+++ trunk/Source/WebCore/rendering/ClipPathOperation.h 2015-06-09 00:29:13 UTC (rev 185343)
@@ -140,7 +140,7 @@
return adoptRef(*new BoxClipPathOperation(referenceBox));
}
- const Path pathForReferenceRect(const RoundedRect& boundingRect) const
+ const Path pathForReferenceRect(const FloatRoundedRect& boundingRect) const
{
Path path;
path.addRoundedRect(boundingRect);
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (185342 => 185343)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-06-09 00:28:19 UTC (rev 185342)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-06-09 00:29:13 UTC (rev 185343)
@@ -4046,10 +4046,11 @@
Path RenderLayer::computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule& windRule) const
{
const RenderStyle& style = renderer().style();
+ float deviceSaleFactor = renderer().document().deviceScaleFactor();
if (is<ShapeClipPathOperation>(*style.clipPath())) {
auto& clipPath = downcast<ShapeClipPathOperation>(*style.clipPath());
- LayoutRect referenceBox = computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds);
+ FloatRect referenceBox = snapRectToDevicePixels(computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds), deviceSaleFactor);
windRule = clipPath.windRule();
return clipPath.pathForReferenceRect(referenceBox);
@@ -4059,7 +4060,7 @@
auto& clipPath = downcast<BoxClipPathOperation>(*style.clipPath());
- RoundedRect shapeRect = computeRoundedRectForBoxShape(clipPath.referenceBox(), downcast<RenderBox>(renderer()));
+ FloatRoundedRect shapeRect = computeRoundedRectForBoxShape(clipPath.referenceBox(), downcast<RenderBox>(renderer())).pixelSnappedRoundedRectForPainting(deviceSaleFactor);
shapeRect.move(offsetFromRoot);
windRule = RULE_NONZERO;
@@ -4083,7 +4084,8 @@
ASSERT(style.clipPath());
if (is<ShapeClipPathOperation>(*style.clipPath()) || (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer()))) {
WindRule windRule;
- Path path = computeClipPath(offsetFromRoot, rootRelativeBounds, windRule);
+ LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelAccumulation, LayoutPoint(), renderer().document().deviceScaleFactor()));
+ Path path = computeClipPath(paintingOffsetFromRoot, rootRelativeBounds, windRule);
context->save();
context->clipPath(path, windRule);
return true;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (185342 => 185343)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-06-09 00:28:19 UTC (rev 185342)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-06-09 00:29:13 UTC (rev 185343)
@@ -1056,8 +1056,10 @@
WindRule windRule;
// FIXME: Use correct reference box for inlines: https://bugs.webkit.org/show_bug.cgi?id=129047
- LayoutRect referenceBoxForClippedInline = m_owningLayer.boundingBox(&m_owningLayer);
- Path clipPath = m_owningLayer.computeClipPath(LayoutSize(), referenceBoxForClippedInline, windRule);
+ LayoutRect boundingBox = m_owningLayer.boundingBox(&m_owningLayer);
+ LayoutRect referenceBoxForClippedInline = LayoutRect(snapRectToDevicePixels(boundingBox, deviceScaleFactor()));
+ LayoutSize offset = LayoutSize(snapSizeToDevicePixel(m_devicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor()));
+ Path clipPath = m_owningLayer.computeClipPath(offset, referenceBoxForClippedInline, windRule);
m_maskLayer->setShapeLayerPath(clipPath);
m_maskLayer->setShapeLayerWindRule(windRule);