Title: [170877] trunk
Revision
170877
Author
za...@apple.com
Date
2014-07-07 21:26:24 -0700 (Mon, 07 Jul 2014)

Log Message

Subpixel rendering: icloud.com password arrow has clipped circle at some window sizes.
https://bugs.webkit.org/show_bug.cgi?id=134710
<rdar://problem/17545291>

Reviewed by Simon Fraser.

Transparent layer clipping needs device pixel snapping.

Source/WebCore:
Test: fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::beginTransparencyLayers):

LayoutTests:
* fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position-expected.html: Added.
* fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (170876 => 170877)


--- trunk/LayoutTests/ChangeLog	2014-07-08 04:23:30 UTC (rev 170876)
+++ trunk/LayoutTests/ChangeLog	2014-07-08 04:26:24 UTC (rev 170877)
@@ -1,5 +1,18 @@
 2014-07-07  Zalan Bujtas  <za...@apple.com>
 
+        Subpixel rendering: icloud.com password arrow has clipped circle at some window sizes.
+        https://bugs.webkit.org/show_bug.cgi?id=134710
+        <rdar://problem/17545291>
+
+        Reviewed by Simon Fraser.
+
+        Transparent layer clipping needs device pixel snapping.
+
+        * fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position-expected.html: Added.
+        * fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html: Added.
+
+2014-07-07  Zalan Bujtas  <za...@apple.com>
+
         Subpixel rendering: Inline box decoration rounds to integral.
         https://bugs.webkit.org/show_bug.cgi?id=134523
         <rdar://problem/17530298>

Added: trunk/LayoutTests/fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position-expected.html (0 => 170877)


--- trunk/LayoutTests/fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position-expected.html	2014-07-08 04:26:24 UTC (rev 170877)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that semi-transparent layers on subpixel position get clipped properly. Non-retina test only.</title>
+<style>
+  img {
+    opacity: 0.9;
+    position: absolute;
+    border: 1px solid red;
+    width: 10px;
+    height: 10px;
+    }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  var adjustment = 0;
+  for (i = 0; i < 20; ++i) {
+    for (j = 0; j < 20; ++j) {
+      if (j % 5 == 0 && j != 0)
+        adjustment += 0.5;
+      var e = document.createElement("img");
+      e.style.top = (20 * i) + adjustment + "px";
+      e.style.left = (20 * j) + adjustment + "px";
+      e.src = ""
+      container.appendChild(e);
+    }
+    adjustment += 0.5;
+  }
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html (0 => 170877)


--- trunk/LayoutTests/fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html	2014-07-08 04:26:24 UTC (rev 170877)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that semi-transparent layers on subpixel position get clipped properly. Non-retina test only.</title>
+<style>
+  img {
+    opacity: 0.9;
+    position: absolute;
+    border: 1px solid red;
+    width: 10px;
+    height: 10px;
+    }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  var adjustment = 0;
+  for (i = 0; i < 20; ++i) {
+    for (j = 0; j < 20; ++j) {
+      var e = document.createElement("img");
+      e.style.top = (20 * i) + adjustment + "px";
+      e.style.left = (20 * j) + adjustment + "px";
+      e.src = ""
+      container.appendChild(e);
+      adjustment += 0.1;
+    }
+  }
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (170876 => 170877)


--- trunk/Source/WebCore/ChangeLog	2014-07-08 04:23:30 UTC (rev 170876)
+++ trunk/Source/WebCore/ChangeLog	2014-07-08 04:26:24 UTC (rev 170877)
@@ -1,3 +1,18 @@
+2014-07-07  Zalan Bujtas  <za...@apple.com>
+
+        Subpixel rendering: icloud.com password arrow has clipped circle at some window sizes.
+        https://bugs.webkit.org/show_bug.cgi?id=134710
+        <rdar://problem/17545291>
+
+        Reviewed by Simon Fraser.
+
+        Transparent layer clipping needs device pixel snapping.
+
+        Test: fast/layers/wrong-clipping-semi-transparent-layer-on-subpixel-position.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::beginTransparencyLayers):
+
 2014-07-07  Benjamin Poulain  <benja...@webkit.org>
 
         LinkBuffer should not keep a reference to the MacroAssembler

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (170876 => 170877)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-07-08 04:23:30 UTC (rev 170876)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-07-08 04:26:24 UTC (rev 170877)
@@ -1661,8 +1661,8 @@
     if (paintsWithTransparency(paintBehavior)) {
         m_usedTransparency = true;
         context->save();
-        LayoutRect clipRect = paintingExtent(*this, rootLayer, paintDirtyRect, paintBehavior);
-        context->clip(clipRect);
+        FloatRect pixelSnappedClipRect = pixelSnappedForPainting(paintingExtent(*this, rootLayer, paintDirtyRect, paintBehavior), renderer().document().deviceScaleFactor());
+        context->clip(pixelSnappedClipRect);
 
 #if ENABLE(CSS_COMPOSITING)
         if (hasBlendMode())
@@ -1678,7 +1678,7 @@
 
 #ifdef REVEAL_TRANSPARENCY_LAYERS
         context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f), ColorSpaceDeviceRGB);
-        context->fillRect(clipRect);
+        context->fillRect(pixelSnappedClipRect);
 #endif
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to