Diff
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp (100970 => 100971)
--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp 2011-11-22 01:20:15 UTC (rev 100970)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp 2011-11-22 01:27:46 UTC (rev 100971)
@@ -463,18 +463,33 @@
setNeedsLayout(false);
}
+static inline int snapSizeToPixel(LayoutUnit size, LayoutUnit location)
+{
+ return (location + size).round() - location.round();
+}
+
// More IE extensions. clientWidth and clientHeight represent the interior of an object
// excluding border and scrollbar.
-int RenderBox::clientWidth() const
+LayoutUnit RenderBox::clientWidth() const
{
- return (width() - borderLeft() - borderRight() - verticalScrollbarWidth()).round();
+ return width() - borderLeft() - borderRight() - verticalScrollbarWidth();
}
-int RenderBox::clientHeight() const
+LayoutUnit RenderBox::clientHeight() const
{
- return (height() - borderTop() - borderBottom() - horizontalScrollbarHeight()).round();
+ return height() - borderTop() - borderBottom() - horizontalScrollbarHeight();
}
+int RenderBox::pixelSnappedClientWidth() const
+{
+ return snapSizeToPixel(clientWidth(), clientLeft());
+}
+
+int RenderBox::pixelSnappedClientHeight() const
+{
+ return snapSizeToPixel(clientHeight(), clientTop());
+}
+
int RenderBox::scrollWidth() const
{
if (hasOverflowClip())
@@ -482,8 +497,8 @@
// For objects with visible overflow, this matches IE.
// FIXME: Need to work right with writing modes.
if (style()->isLeftToRightDirection())
- return max(clientWidth(), (maxXLayoutOverflow() - borderLeft()).round());
- return clientWidth() - min(0, (minXLayoutOverflow() - borderLeft()).round());
+ return max(pixelSnappedClientWidth(), (maxXLayoutOverflow() - borderLeft()).round());
+ return pixelSnappedClientWidth() - min(0, (minXLayoutOverflow() - borderLeft()).round());
}
int RenderBox::scrollHeight() const
@@ -492,7 +507,7 @@
return layer()->scrollHeight();
// For objects with visible overflow, this matches IE.
// FIXME: Need to work right with writing modes.
- return max<int>(clientHeight(), maxYLayoutOverflow() - borderTop());
+ return max<int>(pixelSnappedClientHeight(), maxYLayoutOverflow() - borderTop());
}
int RenderBox::scrollLeft() const
@@ -2254,7 +2269,7 @@
cb = cb->containingBlock();
}
}
- return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
+ return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight.toFloat()));
}
default:
return intrinsicLogicalHeight();
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.h (100970 => 100971)
--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.h 2011-11-22 01:20:15 UTC (rev 100970)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.h 2011-11-22 01:27:46 UTC (rev 100971)
@@ -188,14 +188,21 @@
// More IE extensions. clientWidth and clientHeight represent the interior of an object
// excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth.
- int clientLeft() const { return borderLeft().round(); }
- int clientTop() const { return borderTop().round(); }
- int clientWidth() const;
- int clientHeight() const;
- int clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); }
- int clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); }
+ // FIXME: The pixelSnapped versions are returned to the DOM. Internal callers should probably be
+ // moved off of these methods.
+ int pixelSnappedClientLeft() const { return clientLeft().round(); }
+ int pixelSnappedClientTop() const { return clientTop().round(); }
+ int pixelSnappedClientWidth() const;
+ int pixelSnappedClientHeight() const;
+
+ LayoutUnit clientLeft() const { return borderLeft(); }
+ LayoutUnit clientTop() const { return borderTop(); }
+ LayoutUnit clientWidth() const;
+ LayoutUnit clientHeight() const;
+ int clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedClientWidth() : pixelSnappedClientHeight(); }
+ int clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedClientHeight() : pixelSnappedClientWidth(); }
int clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); }
- IntRect clientBoxRect() const { return IntRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); }
+ IntRect clientBoxRect() const { return IntRect(pixelSnappedClientLeft(), pixelSnappedClientTop(), pixelSnappedClientWidth(), pixelSnappedClientHeight()); }
// scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
// object has overflow:hidden/scroll/auto specified and also has overflow.
@@ -305,7 +312,7 @@
virtual void computeLogicalHeight();
RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;
- void computeLogicalWidthInRegion(RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = 0);
+ void computeLogicalWidthInRegion(RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = LayoutUnit());
bool stretchesToViewport() const
{
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp (100970 => 100971)
--- branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp 2011-11-22 01:20:15 UTC (rev 100970)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp 2011-11-22 01:27:46 UTC (rev 100971)
@@ -2331,13 +2331,13 @@
// Set up the range (and page step/line step).
if (m_hBar) {
- int clientWidth = box->clientWidth();
+ int clientWidth = box->pixelSnappedClientWidth();
int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1);
m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_hBar->setProportion(clientWidth, m_scrollSize.width());
}
if (m_vBar) {
- int clientHeight = box->clientHeight();
+ int clientHeight = box->pixelSnappedClientHeight();
int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);
m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_vBar->setProportion(clientHeight, m_scrollSize.height());
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderListBox.cpp (100970 => 100971)
--- branches/subpixellayout/Source/WebCore/rendering/RenderListBox.cpp 2011-11-22 01:20:15 UTC (rev 100970)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderListBox.cpp 2011-11-22 01:27:46 UTC (rev 100971)
@@ -649,7 +649,7 @@
int RenderListBox::scrollHeight() const
{
- return max(clientHeight(), listHeight().round());
+ return max(pixelSnappedClientHeight(), listHeight().round());
}
int RenderListBox::scrollLeft() const