Fix rounding in RenderFlowThread::paintIntoRegion
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2012 19:04:53 +0000 (19:04 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2012 19:04:53 +0000 (19:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86695

Reviewed by Eric Seidel.

Fix rounding of offset in paintIntoRegion to ensure that we paint on
device pixel boundaries.

Covered by existing tests in fast/regions.

* platform/graphics/FractionalLayoutPoint.h:
(WebCore::roundedIntPoint):
Add roundedIntPoint(FractionalLayoutSize) function.
(WebCore):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::paintIntoRegion):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FractionalLayoutPoint.h
Source/WebCore/rendering/RenderFlowThread.cpp

index d440d10..d4b8c58 100644 (file)
@@ -1,3 +1,22 @@
+2012-05-17  Emil A Eklund  <eae@chromium.org>
+
+        Fix rounding in RenderFlowThread::paintIntoRegion
+        https://bugs.webkit.org/show_bug.cgi?id=86695
+
+        Reviewed by Eric Seidel.
+
+        Fix rounding of offset in paintIntoRegion to ensure that we paint on
+        device pixel boundaries.
+
+        Covered by existing tests in fast/regions.
+
+        * platform/graphics/FractionalLayoutPoint.h:
+        (WebCore::roundedIntPoint):
+        Add roundedIntPoint(FractionalLayoutSize) function.
+        (WebCore):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::paintIntoRegion):
+
 2012-05-17  Andreas Kling  <kling@webkit.org>
 
         Parser: Avoid unnecessary ref count churn in token constructors.
index 177e261..26550b9 100644 (file)
@@ -167,6 +167,11 @@ inline IntPoint roundedIntPoint(const FractionalLayoutPoint& point)
     return IntPoint(point.x().round(), point.y().round());
 }
 
+inline IntPoint roundedIntPoint(const FractionalLayoutSize& size)
+{
+    return IntPoint(size.width().round(), size.height().round());
+}
+
 inline IntPoint ceiledIntPoint(const FractionalLayoutPoint& point)
 {
     return IntPoint(point.x().ceil(), point.y().ceil());
index 393964a..2e04a6b 100644 (file)
@@ -292,16 +292,16 @@ void RenderFlowThread::paintIntoRegion(PaintInfo& paintInfo, RenderRegion* regio
         // RenderFlowThread should start painting its content in a position that is offset
         // from the region rect's current position. The amount of offset is equal to the location of
         // region in flow coordinates.
-        LayoutPoint renderFlowThreadOffset;
+        IntPoint renderFlowThreadOffset;
         if (style()->isFlippedBlocksWritingMode()) {
             LayoutRect flippedRegionRect(regionRect);
             flipForWritingMode(flippedRegionRect);
-            renderFlowThreadOffset = LayoutPoint(paintOffset - flippedRegionRect.location());
+            renderFlowThreadOffset = roundedIntPoint(paintOffset - flippedRegionRect.location());
         } else
-            renderFlowThreadOffset = LayoutPoint(paintOffset - regionRect.location());
+            renderFlowThreadOffset = roundedIntPoint(paintOffset - regionRect.location());
 
         context->translate(renderFlowThreadOffset.x(), renderFlowThreadOffset.y());
-        info.rect.moveBy(-roundedIntPoint(renderFlowThreadOffset));
+        info.rect.moveBy(-renderFlowThreadOffset);
         
         layer()->paint(context, info.rect, 0, 0, region, RenderLayer::PaintLayerTemporaryClipRects);