Title: [113932] trunk/Source/WebCore
Revision
113932
Author
[email protected]
Date
2012-04-11 18:02:34 -0700 (Wed, 11 Apr 2012)

Log Message

Correct pixel snapping error in RenderBox::pixelSnappedClientWidth/Height
https://bugs.webkit.org/show_bug.cgi?id=83621

Reviewed by Eric Seidel.

Though the problem wouldn't yet manifest itself since we haven't flipped the switch on sub-pixel
layout, clientWidth and clientHeight, when pixel snapped, need to take the RenderBox's location
into account. Previously, ClientLeft/Top were used, but these are simply the width of the borders,
and don't include the box's sub-pixel location, which is needed to properly snap the width/height.

No new tests. Untestable until we switch to FractionalLayoutUnits. A test case that covers this
is in the subpixellayout branch and will land with the switch.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::pixelSnappedClientWidth):
(WebCore::RenderBox::pixelSnappedClientHeight):
(WebCore::RenderBox::scrollWidth): Replacing a raw zero with ZERO_LAYOUT_UNIT.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113931 => 113932)


--- trunk/Source/WebCore/ChangeLog	2012-04-12 01:00:28 UTC (rev 113931)
+++ trunk/Source/WebCore/ChangeLog	2012-04-12 01:02:34 UTC (rev 113932)
@@ -1,3 +1,23 @@
+2012-04-11  Levi Weintraub  <[email protected]>
+
+        Correct pixel snapping error in RenderBox::pixelSnappedClientWidth/Height
+        https://bugs.webkit.org/show_bug.cgi?id=83621
+
+        Reviewed by Eric Seidel.
+
+        Though the problem wouldn't yet manifest itself since we haven't flipped the switch on sub-pixel
+        layout, clientWidth and clientHeight, when pixel snapped, need to take the RenderBox's location
+        into account. Previously, ClientLeft/Top were used, but these are simply the width of the borders,
+        and don't include the box's sub-pixel location, which is needed to properly snap the width/height.
+
+        No new tests. Untestable until we switch to FractionalLayoutUnits. A test case that covers this
+        is in the subpixellayout branch and will land with the switch.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::pixelSnappedClientWidth):
+        (WebCore::RenderBox::pixelSnappedClientHeight):
+        (WebCore::RenderBox::scrollWidth): Replacing a raw zero with ZERO_LAYOUT_UNIT.
+
 2012-04-11  Erik Arvidsson  <[email protected]>
 
         Add support for [ArrayClass] and use that on NodeList

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (113931 => 113932)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-04-12 01:00:28 UTC (rev 113931)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-04-12 01:02:34 UTC (rev 113932)
@@ -487,12 +487,12 @@
 
 int RenderBox::pixelSnappedClientWidth() const
 {
-    return snapSizeToPixel(clientWidth(), clientLeft());
+    return snapSizeToPixel(clientWidth(), x() + clientLeft());
 }
 
 int RenderBox::pixelSnappedClientHeight() const
 {
-    return snapSizeToPixel(clientHeight(), clientTop());
+    return snapSizeToPixel(clientHeight(), y() + clientTop());
 }
 
 int RenderBox::scrollWidth() const
@@ -503,7 +503,7 @@
     // FIXME: Need to work right with writing modes.
     if (style()->isLeftToRightDirection())
         return snapSizeToPixel(max(clientWidth(), maxXLayoutOverflow() - borderLeft()), clientLeft());
-    return clientWidth() - min(0, minXLayoutOverflow() - borderLeft());
+    return clientWidth() - min(ZERO_LAYOUT_UNIT, minXLayoutOverflow() - borderLeft());
 }
 
 int RenderBox::scrollHeight() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to