Title: [113223] trunk/Source/WebCore
Revision
113223
Author
e...@chromium.org
Date
2012-04-04 12:10:00 -0700 (Wed, 04 Apr 2012)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113222 => 113223)


--- trunk/Source/WebCore/ChangeLog	2012-04-04 19:04:15 UTC (rev 113222)
+++ trunk/Source/WebCore/ChangeLog	2012-04-04 19:10:00 UTC (rev 113223)
@@ -1,5 +1,46 @@
 2012-04-04  Emil A Eklund  <e...@chromium.org>
 
+        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.
+
+2012-04-04  Emil A Eklund  <e...@chromium.org>
+
         Fix types for location, size and rect calculations for render objects
         https://bugs.webkit.org/show_bug.cgi?id=83089
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (113222 => 113223)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-04-04 19:04:15 UTC (rev 113222)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-04-04 19:10:00 UTC (rev 113223)
@@ -502,7 +502,7 @@
     // For objects with visible overflow, this matches IE.
     // FIXME: Need to work right with writing modes.
     if (style()->isLeftToRightDirection())
-        return max(clientWidth(), maxXLayoutOverflow() - borderLeft());
+        return snapSizeToPixel(max(clientWidth(), maxXLayoutOverflow() - borderLeft()), clientLeft());
     return clientWidth() - min(0, minXLayoutOverflow() - borderLeft());
 }
 
@@ -512,7 +512,7 @@
         return layer()->scrollHeight();
     // For objects with visible overflow, this matches IE.
     // FIXME: Need to work right with writing modes.
-    return max(pixelSnappedClientHeight(), maxYLayoutOverflow() - borderTop());
+    return snapSizeToPixel(max(clientHeight(), maxYLayoutOverflow() - borderTop()), clientTop());
 }
 
 int RenderBox::scrollLeft() const
@@ -764,7 +764,7 @@
     // If we have no layer, it means that we have no overflowing content as we lazily
     // allocate it on demand. Thus we don't have any scroll offset.
     ASSERT(!requiresLayerForOverflowClip());
-    return LayoutSize();
+    return IntSize();
 }
 
 typedef HashMap<const RenderBox*, LayoutSize> RendererSizeCache;
@@ -774,7 +774,7 @@
     return cachedSizeForOverflowClipMap;
 }
 
-IntSize RenderBox::cachedSizeForOverflowClip() const
+LayoutSize RenderBox::cachedSizeForOverflowClip() const
 {
     ASSERT(hasOverflowClip());
     if (hasLayer())

Modified: trunk/Source/WebCore/rendering/RenderBox.h (113222 => 113223)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-04-04 19:04:15 UTC (rev 113222)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-04-04 19:10:00 UTC (rev 113223)
@@ -56,9 +56,8 @@
     LayoutUnit width() const { return m_frameRect.width(); }
     LayoutUnit height() const { return m_frameRect.height(); }
 
-    // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318.
-    int pixelSnappedWidth() const { return m_frameRect.width(); }
-    int pixelSnappedHeight() const { return m_frameRect.height(); }
+    int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
+    int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
 
     // These represent your location relative to your container as a physical offset.
     // In layout related methods you almost always want the logical location (e.g. x() and y()).
@@ -159,10 +158,10 @@
     // but it is on the right in vertical-rl.
     LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }
     IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(layoutOverflowRect()); }
-    LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); }
-    LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); }
-    LayoutUnit minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : borderLeft(); }
-    LayoutUnit maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : borderLeft() + clientWidth(); }
+    LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : static_cast<LayoutUnit>(borderTop()); }
+    LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : static_cast<LayoutUnit>(borderTop()) + clientHeight(); }
+    LayoutUnit minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : static_cast<LayoutUnit>(borderLeft()); }
+    LayoutUnit maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : static_cast<LayoutUnit>(borderLeft()) + clientWidth(); }
     LayoutSize maxLayoutOverflow() const { return LayoutSize(maxXLayoutOverflow(), maxYLayoutOverflow()); }
     LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); }
     LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? maxXLayoutOverflow() : maxYLayoutOverflow(); }
@@ -450,13 +449,13 @@
     LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const;
 
     RenderOverflow* hasRenderOverflow() const { return m_overflow.get(); }    
-    bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(m_overflow->visualOverflowRect()); }
+    bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(pixelSnappedIntRect(m_overflow->visualOverflowRect())); }
 
     virtual bool needsPreferredWidthsRecalculation() const;
     virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { }
 
     IntSize scrolledContentOffset() const;
-    IntSize cachedSizeForOverflowClip() const;
+    LayoutSize cachedSizeForOverflowClip() const;
     void updateCachedSizeForOverflowClip();
     void clearCachedSizeForOverflowClip();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to