Title: [165050] trunk
Revision
165050
Author
[email protected]
Date
2014-03-04 08:17:46 -0800 (Tue, 04 Mar 2014)

Log Message

Subpixel rendering: Incorrect repaint rect cuts off content's right edge after move.
https://bugs.webkit.org/show_bug.cgi?id=129652

Reviewed by Simon Fraser.

When repaint rect is adjusted in order to take the distance from renderer into account,
the accumulated fraction value need to be added too. This is always a positive value.

Source/WebCore:

Test: fast/borders/hidpi-border-clipping-right-after-move.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):

LayoutTests:

* fast/borders/hidpi-border-clipping-right-after-move-expected.html: Added.
* fast/borders/hidpi-border-clipping-right-after-move.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (165049 => 165050)


--- trunk/LayoutTests/ChangeLog	2014-03-04 13:19:34 UTC (rev 165049)
+++ trunk/LayoutTests/ChangeLog	2014-03-04 16:17:46 UTC (rev 165050)
@@ -1,3 +1,16 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Incorrect repaint rect cuts off content's right edge after move.
+        https://bugs.webkit.org/show_bug.cgi?id=129652
+
+        Reviewed by Simon Fraser.
+
+        When repaint rect is adjusted in order to take the distance from renderer into account,
+        the accumulated fraction value need to be added too. This is always a positive value.
+
+        * fast/borders/hidpi-border-clipping-right-after-move-expected.html: Added.
+        * fast/borders/hidpi-border-clipping-right-after-move.html: Added.
+
 2014-02-07  Sergio Villar Senin  <[email protected]>
 
         [CSS Grid Layout] Percentages of indefinite sizes should compute to auto

Added: trunk/LayoutTests/fast/borders/hidpi-border-clipping-right-after-move-expected.html (0 => 165050)


--- trunk/LayoutTests/fast/borders/hidpi-border-clipping-right-after-move-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/hidpi-border-clipping-right-after-move-expected.html	2014-03-04 16:17:46 UTC (rev 165050)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests repaint clipping after move. Pass if all borders are painted.</title>
+<head>
+<style>
+  div {
+    position: fixed;
+    border: red solid 0.5px;
+    width: 20px;
+    height: 20px; 
+    left: 0px;
+    top: 0px;
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0;
+  for (i = 0; i < 4; ++i) {
+    adjustment+=0.1;
+    for (j = 0; j < 40; ++j) {
+      var e = document.createElement("div");
+      e.style.top = (25 * i + adjustment) + "px";
+      e.style.left = (25 * j  + adjustment + 0.3) + "px";
+      container.appendChild(e);
+    }
+  }
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/borders/hidpi-border-clipping-right-after-move.html (0 => 165050)


--- trunk/LayoutTests/fast/borders/hidpi-border-clipping-right-after-move.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/hidpi-border-clipping-right-after-move.html	2014-03-04 16:17:46 UTC (rev 165050)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests repaint clipping after move. Pass if all borders are painted.</title>
+<head>
+<style>
+  div {
+    position: fixed;
+    border: red solid 0.5px;
+    width: 20px;
+    height: 20px; 
+    left: 0px;
+    top: 0px;
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0;
+  for (i = 0; i < 4; ++i) {
+    adjustment+=0.1;
+    for (j = 0; j < 40; ++j) {
+      var e = document.createElement("div");
+      e.style.top = (25 * i + adjustment) + "px";
+      e.style.left = (25 * j  + adjustment) + "px";
+      container.appendChild(e);
+    }
+  }
+  
+  function move() {
+    divs = document.getElementsByTagName("div");
+    for (i = 0; i < divs.length; ++i)
+      divs[i].style.left = (parseFloat(divs[i].style.left) + 0.2) + "px";
+
+    if (window.testRunner)
+      testRunner.notifyDone();
+  }
+  
+  if (window.testRunner)
+      testRunner.waitUntilDone();
+
+  setTimeout(move, 100);
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (165049 => 165050)


--- trunk/Source/WebCore/ChangeLog	2014-03-04 13:19:34 UTC (rev 165049)
+++ trunk/Source/WebCore/ChangeLog	2014-03-04 16:17:46 UTC (rev 165050)
@@ -1,3 +1,18 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Incorrect repaint rect cuts off content's right edge after move.
+        https://bugs.webkit.org/show_bug.cgi?id=129652
+
+        Reviewed by Simon Fraser.
+
+        When repaint rect is adjusted in order to take the distance from renderer into account,
+        the accumulated fraction value need to be added too. This is always a positive value.
+
+        Test: fast/borders/hidpi-border-clipping-right-after-move.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+
 2014-03-04  Ryuan Choi  <[email protected]>
 
         Remove unused member variable of NetworkInfoController

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (165049 => 165050)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-03-04 13:19:34 UTC (rev 165049)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-03-04 16:17:46 UTC (rev 165050)
@@ -2104,35 +2104,35 @@
 
     if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;
-        layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
+        layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
         m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
     }
 
     if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;
-        layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
+        layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
         m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
     }
 
     // FIXME: need to split out repaints for the background.
     if (m_backgroundLayer && m_backgroundLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;
-        layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer());
+        layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
         m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
     }
 
     if (m_maskLayer && m_maskLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;
-        layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
+        layerDirtyRect.move(-m_maskLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
         m_maskLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
     }
 
     if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;
-        layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer());
+        layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
 #if PLATFORM(IOS)
         // Account for the fact that RenderLayerBacking::updateGraphicsLayerGeometry() bakes scrollOffset into offsetFromRenderer on iOS.
-        layerDirtyRect.move(-m_owningLayer.scrollOffset());
+        layerDirtyRect.move(-m_owningLayer.scrollOffset() + m_devicePixelFractionFromRenderer);
 #endif
         m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to