Changeset 113223 in webkit


Ignore:
Timestamp:
Apr 4, 2012 12:10:00 PM (12 years ago)
Author:
eae@chromium.org
Message:

Fix usage of LayoutUnits and snapping for scrolling in RenderBox
https://bugs.webkit.org/show_bug.cgi?id=83073

Reviewed by Eric Seidel.

Fix usage of LayoutUnits and snapping/rounding logic in RenderBox.

No new tests, no change in functionality.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::scrollWidth):
Change scrollWidth to properly pixel snap values.

(WebCore::RenderBox::scrollHeight):
Change scrollHeight to properly pixel snap values.

(WebCore::RenderBox::scrolledContentOffset):
Change to return IntSize to match function definition.

(WebCore::RenderBox::cachedSizeForOverflowClip):
Changed cachedSizeForOverflowClip to LayoutSize as the overflow and clip
rects all have subpixel precision.

  • rendering/RenderBox.h:

(WebCore::RenderBox::pixelSnappedWidth):
(WebCore::RenderBox::pixelSnappedHeight):
Removed FIXME comment as the implementation

(WebCore::RenderBox::minYLayoutOverflow):
(WebCore::RenderBox::maxYLayoutOverflow):
(WebCore::RenderBox::minXLayoutOverflow):
(WebCore::RenderBox::maxXLayoutOverflow):
Added static_cast for border values.

(WebCore::RenderBox::hasVisualOverflow):
Changed to compare two pixel snapped values as we don't want to indicate
overflow in cases where the the size is rounded down resulting in no
visual overflow.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113222 r113223  
     12012-04-04  Emil A Eklund  <eae@chromium.org>
     2
     3        Fix usage of LayoutUnits and snapping for scrolling in RenderBox
     4        https://bugs.webkit.org/show_bug.cgi?id=83073
     5
     6        Reviewed by Eric Seidel.
     7
     8        Fix usage of LayoutUnits and snapping/rounding logic in RenderBox.
     9
     10        No new tests, no change in functionality.
     11
     12        * rendering/RenderBox.cpp:
     13        (WebCore::RenderBox::scrollWidth):
     14        Change scrollWidth to properly pixel snap values.
     15       
     16        (WebCore::RenderBox::scrollHeight):
     17        Change scrollHeight to properly pixel snap values.
     18       
     19        (WebCore::RenderBox::scrolledContentOffset):
     20        Change to return IntSize to match function definition.
     21       
     22        (WebCore::RenderBox::cachedSizeForOverflowClip):
     23        Changed cachedSizeForOverflowClip to LayoutSize as the overflow and clip
     24        rects all have subpixel precision.
     25
     26        * rendering/RenderBox.h:
     27        (WebCore::RenderBox::pixelSnappedWidth):
     28        (WebCore::RenderBox::pixelSnappedHeight):
     29        Removed FIXME comment as the implementation
     30       
     31        (WebCore::RenderBox::minYLayoutOverflow):
     32        (WebCore::RenderBox::maxYLayoutOverflow):
     33        (WebCore::RenderBox::minXLayoutOverflow):
     34        (WebCore::RenderBox::maxXLayoutOverflow):
     35        Added static_cast for border values.
     36       
     37        (WebCore::RenderBox::hasVisualOverflow):
     38        Changed to compare two pixel snapped values as we don't want to indicate
     39        overflow in cases where the the size is rounded down resulting in no
     40        visual overflow.
     41
    1422012-04-04  Emil A Eklund  <eae@chromium.org>
    243
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r113030 r113223  
    503503    // FIXME: Need to work right with writing modes.
    504504    if (style()->isLeftToRightDirection())
    505         return max(clientWidth(), maxXLayoutOverflow() - borderLeft());
     505        return snapSizeToPixel(max(clientWidth(), maxXLayoutOverflow() - borderLeft()), clientLeft());
    506506    return clientWidth() - min(0, minXLayoutOverflow() - borderLeft());
    507507}
     
    513513    // For objects with visible overflow, this matches IE.
    514514    // FIXME: Need to work right with writing modes.
    515     return max(pixelSnappedClientHeight(), maxYLayoutOverflow() - borderTop());
     515    return snapSizeToPixel(max(clientHeight(), maxYLayoutOverflow() - borderTop()), clientTop());
    516516}
    517517
     
    765765    // allocate it on demand. Thus we don't have any scroll offset.
    766766    ASSERT(!requiresLayerForOverflowClip());
    767     return LayoutSize();
     767    return IntSize();
    768768}
    769769
     
    775775}
    776776
    777 IntSize RenderBox::cachedSizeForOverflowClip() const
     777LayoutSize RenderBox::cachedSizeForOverflowClip() const
    778778{
    779779    ASSERT(hasOverflowClip());
  • trunk/Source/WebCore/rendering/RenderBox.h

    r113030 r113223  
    5757    LayoutUnit height() const { return m_frameRect.height(); }
    5858
    59     // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318.
    60     int pixelSnappedWidth() const { return m_frameRect.width(); }
    61     int pixelSnappedHeight() const { return m_frameRect.height(); }
     59    int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
     60    int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
    6261
    6362    // These represent your location relative to your container as a physical offset.
     
    160159    LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }
    161160    IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(layoutOverflowRect()); }
    162     LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); }
    163     LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); }
    164     LayoutUnit minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : borderLeft(); }
    165     LayoutUnit maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : borderLeft() + clientWidth(); }
     161    LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : static_cast<LayoutUnit>(borderTop()); }
     162    LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : static_cast<LayoutUnit>(borderTop()) + clientHeight(); }
     163    LayoutUnit minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : static_cast<LayoutUnit>(borderLeft()); }
     164    LayoutUnit maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : static_cast<LayoutUnit>(borderLeft()) + clientWidth(); }
    166165    LayoutSize maxLayoutOverflow() const { return LayoutSize(maxXLayoutOverflow(), maxYLayoutOverflow()); }
    167166    LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); }
     
    451450
    452451    RenderOverflow* hasRenderOverflow() const { return m_overflow.get(); }   
    453     bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(m_overflow->visualOverflowRect()); }
     452    bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(pixelSnappedIntRect(m_overflow->visualOverflowRect())); }
    454453
    455454    virtual bool needsPreferredWidthsRecalculation() const;
     
    457456
    458457    IntSize scrolledContentOffset() const;
    459     IntSize cachedSizeForOverflowClip() const;
     458    LayoutSize cachedSizeForOverflowClip() const;
    460459    void updateCachedSizeForOverflowClip();
    461460    void clearCachedSizeForOverflowClip();
Note: See TracChangeset for help on using the changeset viewer.