Subpixel rendering: Adjust cliprect with devicePixelFractionFromRenderer() before...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jul 2014 01:47:10 +0000 (01:47 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jul 2014 01:47:10 +0000 (01:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134950
<rdar://problem/17617994>

Reviewed by Simon Fraser.

The cliprect coming from the graphics layer needs to be adjusted with the subpixel gap
from renderer. This is symmetric with the offsetting we do, when the dirty rect is sent off to the GraphicsLayer.
It puts us back to the correct coordinating system for intersecting with renderers.

Source/WebCore:
Test: compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html

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

LayoutTests:
* compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position-expected.html: Added.
* compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171165 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position-expected.html [new file with mode: 0644]
LayoutTests/compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp

index d4a4f5a..d6e8c8c 100644 (file)
@@ -1,3 +1,18 @@
+2014-07-16  Zalan Bujtas  <zalan@apple.com>
+
+        Subpixel rendering: Adjust cliprect with devicePixelFractionFromRenderer() before painting.
+        https://bugs.webkit.org/show_bug.cgi?id=134950
+        <rdar://problem/17617994>
+
+        Reviewed by Simon Fraser.
+
+        The cliprect coming from the graphics layer needs to be adjusted with the subpixel gap
+        from renderer. This is symmetric with the offsetting we do, when the dirty rect is sent off to the GraphicsLayer.
+        It puts us back to the correct coordinating system for intersecting with renderers.
+
+        * compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position-expected.html: Added.
+        * compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html: Added.
+
 2014-07-16  Roger Fong  <roger_fong@apple.com>
 
         Captions container should not clip content.
diff --git a/LayoutTests/compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position-expected.html b/LayoutTests/compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position-expected.html
new file mode 100644 (file)
index 0000000..2c11c56
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when the compositing layer has multiple tile layers the content gets clipped properly across layers.</title>
+<style>
+  .container {
+    position: fixed;
+    left: 0.25px;
+    top: 0px;
+  }
+
+  .inner {
+    -webkit-border-radius: 1px;
+    overflow: hidden;
+    width: 2100px; 
+  }
+  
+  .largebox {
+    width: 600px; 
+    height: 100px;     
+    background-color: red; 
+  }
+</style>
+</head>
+<body>
+<div class=container>
+  <div class=inner>
+      <div class=largebox></div> 
+  </div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html b/LayoutTests/compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html
new file mode 100644 (file)
index 0000000..e65a24e
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when the compositing layer has multiple tile layers the content gets clipped properly across layers.</title>
+<style>
+  .container {
+    position: fixed;
+    left: 0.25px;
+    top: 0px;
+  }
+
+  .inner {
+    -webkit-border-radius: 1px;
+    overflow: hidden;
+    width: 2100px; 
+    -webkit-transform: translateZ(0);
+  }
+  
+  .largebox {
+    width: 600px; 
+    height: 100px; 
+    background-color: red; 
+  }
+</style>
+</head>
+<body>
+<div class=container>
+  <div class=inner>
+      <div class=largebox></div> 
+  </div>
+</div>
+</body>
+</html>
index 5348f48..ca28e4b 100644 (file)
@@ -1,3 +1,21 @@
+2014-07-16  Zalan Bujtas  <zalan@apple.com>
+
+        Subpixel rendering: Adjust cliprect with devicePixelFractionFromRenderer() before painting.
+        https://bugs.webkit.org/show_bug.cgi?id=134950
+        <rdar://problem/17617994>
+
+        Reviewed by Simon Fraser.
+
+        The cliprect coming from the graphics layer needs to be adjusted with the subpixel gap
+        from renderer. This is symmetric with the offsetting we do, when the dirty rect is sent off to the GraphicsLayer.
+        It puts us back to the correct coordinating system for intersecting with renderers.
+
+        Test: compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::beginTransparencyLayers):
+        (WebCore::RenderLayer::clipToRect):
+
 2014-07-16  Simon Fraser  <simon.fraser@apple.com>
 
         Fix a typo noticed by Darin.
index 5384d47..57e7641 100644 (file)
@@ -2181,7 +2181,9 @@ void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph
 #endif
 
     // The dirtyRect is in the coords of the painting root.
-    IntRect dirtyRect = enclosingIntRect(clip);
+    FloatRect adjustedClipRect = clip;
+    adjustedClipRect.move(-m_devicePixelFractionFromRenderer);
+    IntRect dirtyRect = enclosingIntRect(adjustedClipRect);
 
     if (graphicsLayer == m_graphicsLayer.get()
         || graphicsLayer == m_foregroundLayer.get()