Changeset 113223 in webkit
- Timestamp:
- Apr 4, 2012 12:10:00 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r113222 r113223 1 2012-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 1 42 2012-04-04 Emil A Eklund <eae@chromium.org> 2 43 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r113030 r113223 503 503 // FIXME: Need to work right with writing modes. 504 504 if (style()->isLeftToRightDirection()) 505 return max(clientWidth(), maxXLayoutOverflow() - borderLeft());505 return snapSizeToPixel(max(clientWidth(), maxXLayoutOverflow() - borderLeft()), clientLeft()); 506 506 return clientWidth() - min(0, minXLayoutOverflow() - borderLeft()); 507 507 } … … 513 513 // For objects with visible overflow, this matches IE. 514 514 // FIXME: Need to work right with writing modes. 515 return max(pixelSnappedClientHeight(), maxYLayoutOverflow() - borderTop());515 return snapSizeToPixel(max(clientHeight(), maxYLayoutOverflow() - borderTop()), clientTop()); 516 516 } 517 517 … … 765 765 // allocate it on demand. Thus we don't have any scroll offset. 766 766 ASSERT(!requiresLayerForOverflowClip()); 767 return LayoutSize();767 return IntSize(); 768 768 } 769 769 … … 775 775 } 776 776 777 IntSize RenderBox::cachedSizeForOverflowClip() const777 LayoutSize RenderBox::cachedSizeForOverflowClip() const 778 778 { 779 779 ASSERT(hasOverflowClip()); -
trunk/Source/WebCore/rendering/RenderBox.h
r113030 r113223 57 57 LayoutUnit height() const { return m_frameRect.height(); } 58 58 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(); } 62 61 63 62 // These represent your location relative to your container as a physical offset. … … 160 159 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); } 161 160 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(); } 166 165 LayoutSize maxLayoutOverflow() const { return LayoutSize(maxXLayoutOverflow(), maxYLayoutOverflow()); } 167 166 LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); } … … 451 450 452 451 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())); } 454 453 455 454 virtual bool needsPreferredWidthsRecalculation() const; … … 457 456 458 457 IntSize scrolledContentOffset() const; 459 IntSize cachedSizeForOverflowClip() const;458 LayoutSize cachedSizeForOverflowClip() const; 460 459 void updateCachedSizeForOverflowClip(); 461 460 void clearCachedSizeForOverflowClip();
Note: See TracChangeset
for help on using the changeset viewer.