Changeset 113932 in webkit


Ignore:
Timestamp:
Apr 11, 2012 6:02:34 PM (12 years ago)
Author:
leviw@chromium.org
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113931 r113932  
     12012-04-11  Levi Weintraub  <leviw@chromium.org>
     2
     3        Correct pixel snapping error in RenderBox::pixelSnappedClientWidth/Height
     4        https://bugs.webkit.org/show_bug.cgi?id=83621
     5
     6        Reviewed by Eric Seidel.
     7
     8        Though the problem wouldn't yet manifest itself since we haven't flipped the switch on sub-pixel
     9        layout, clientWidth and clientHeight, when pixel snapped, need to take the RenderBox's location
     10        into account. Previously, ClientLeft/Top were used, but these are simply the width of the borders,
     11        and don't include the box's sub-pixel location, which is needed to properly snap the width/height.
     12
     13        No new tests. Untestable until we switch to FractionalLayoutUnits. A test case that covers this
     14        is in the subpixellayout branch and will land with the switch.
     15
     16        * rendering/RenderBox.cpp:
     17        (WebCore::RenderBox::pixelSnappedClientWidth):
     18        (WebCore::RenderBox::pixelSnappedClientHeight):
     19        (WebCore::RenderBox::scrollWidth): Replacing a raw zero with ZERO_LAYOUT_UNIT.
     20
    1212012-04-11  Erik Arvidsson  <arv@chromium.org>
    222
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r113885 r113932  
    488488int RenderBox::pixelSnappedClientWidth() const
    489489{
    490     return snapSizeToPixel(clientWidth(), clientLeft());
     490    return snapSizeToPixel(clientWidth(), x() + clientLeft());
    491491}
    492492
    493493int RenderBox::pixelSnappedClientHeight() const
    494494{
    495     return snapSizeToPixel(clientHeight(), clientTop());
     495    return snapSizeToPixel(clientHeight(), y() + clientTop());
    496496}
    497497
     
    504504    if (style()->isLeftToRightDirection())
    505505        return snapSizeToPixel(max(clientWidth(), maxXLayoutOverflow() - borderLeft()), clientLeft());
    506     return clientWidth() - min(0, minXLayoutOverflow() - borderLeft());
     506    return clientWidth() - min(ZERO_LAYOUT_UNIT, minXLayoutOverflow() - borderLeft());
    507507}
    508508
Note: See TracChangeset for help on using the changeset viewer.