Diff
Modified: branches/chromium/1180/LayoutTests/ChangeLog (123233 => 123234)
--- branches/chromium/1180/LayoutTests/ChangeLog 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/LayoutTests/ChangeLog 2012-07-20 17:56:43 UTC (rev 123234)
@@ -1,3 +1,22 @@
+2012-07-17 Emil A Eklund <[email protected]>
+
+ Incorrect offset used for scrollWidth/Height calculation
+ https://bugs.webkit.org/show_bug.cgi?id=91461
+
+ Reviewed by Eric Seidel.
+
+ Add new test ensuring that a block that shouldn't have overflow doesn't
+ have scrollbars.
+
+ * fast/sub-pixel/block-with-margin-overflow-expected.html: Added.
+ * fast/sub-pixel/block-with-margin-overflow.html: Added.
+ * platform/chromium-win/fast/block/float/026-expected.txt:
+ * platform/chromium-win/fast/block/float/028-expected.txt:
+ * platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt:
+ * platform/mac/fast/multicol/shrink-to-column-height-for-pagination-expected.png:
+ * platform/mac/fast/multicol/shrink-to-column-height-for-pagination-expected.txt:
+ Update test expectations that incorrectly had overflow.
+
2012-07-16 Emil A Eklund <[email protected]>
Inconsistent rounding in table layout causes background color to bleed through
Copied: branches/chromium/1180/LayoutTests/fast/sub-pixel/block-with-margin-overflow-expected.html (from rev 122861, trunk/LayoutTests/fast/sub-pixel/block-with-margin-overflow-expected.html) (0 => 123234)
--- branches/chromium/1180/LayoutTests/fast/sub-pixel/block-with-margin-overflow-expected.html (rev 0)
+++ branches/chromium/1180/LayoutTests/fast/sub-pixel/block-with-margin-overflow-expected.html 2012-07-20 17:56:43 UTC (rev 123234)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ .block {
+ overflow: auto;
+ margin: 0 1px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="block">
+ Should neither overflow nor display a scrollbar.
+ </div>
+ </body>
+</html>
+
Copied: branches/chromium/1180/LayoutTests/fast/sub-pixel/block-with-margin-overflow.html (from rev 122861, trunk/LayoutTests/fast/sub-pixel/block-with-margin-overflow.html) (0 => 123234)
--- branches/chromium/1180/LayoutTests/fast/sub-pixel/block-with-margin-overflow.html (rev 0)
+++ branches/chromium/1180/LayoutTests/fast/sub-pixel/block-with-margin-overflow.html 2012-07-20 17:56:43 UTC (rev 123234)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ .block {
+ overflow: auto;
+ margin: 0 0.6px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="block">
+ Should neither overflow nor display a scrollbar.
+ </div>
+ </body>
+</html>
+
Modified: branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/026-expected.txt (123233 => 123234)
--- branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/026-expected.txt 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/026-expected.txt 2012-07-20 17:56:43 UTC (rev 123234)
@@ -42,7 +42,7 @@
text run at (39,2) width 513: "This is an overflow:scroll region. It should sit on the same line as the float and wrap as"
text run at (290,22) width 4 RTL: "."
text run at (294,22) width 258: "needed to fit within the remaining line width"
-layer at (189,816) size 388x79 clip at (206,818) size 369x60 scrollWidth 370
+layer at (189,816) size 388x79 clip at (206,818) size 369x60
RenderBlock {DIV} at (180,0) size 389x79 [border: (2px solid #0000FF)]
RenderText {#text} at (5,2) size 368x59
text run at (5,2) width 366: "This is an overflow:scroll region. It should sit on the same line"
Modified: branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/028-expected.txt (123233 => 123234)
--- branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/028-expected.txt 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/028-expected.txt 2012-07-20 17:56:43 UTC (rev 123234)
@@ -42,7 +42,7 @@
text run at (39,2) width 513: "This is an overflow:scroll region. It should sit on the same line as the float and wrap as"
text run at (290,22) width 4 RTL: "."
text run at (294,22) width 258: "needed to fit within the remaining line width"
-layer at (189,816) size 388x79 clip at (206,818) size 369x60 scrollWidth 370
+layer at (189,816) size 388x79 clip at (206,818) size 369x60
RenderBlock {DIV} at (180,0) size 389x79 [border: (2px solid #0000FF)]
RenderText {#text} at (5,2) size 368x59
text run at (5,2) width 366: "This is an overflow:scroll region. It should sit on the same line"
Modified: branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt (123233 => 123234)
--- branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt 2012-07-20 17:56:43 UTC (rev 123234)
@@ -9,6 +9,6 @@
layer at (10,10) size 179x25178662 backgroundClip at (10,10) size 179x17895687 clip at (11,11) size 177x17895686 outlineClip at (0,0) size 800x17895697
RenderTextControl {TEXTAREA} at (2,1) size 179x25178664 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 175x16
-layer at (10,-21225448) size 179x25178662 backgroundClip at (10,0) size 179x3953214 clip at (11,0) size 162x3953213 outlineClip at (0,0) size 800x17895697 scrollHeight 25178660
+layer at (10,-21225448) size 179x25178662 backgroundClip at (10,0) size 179x3953214 clip at (11,0) size 177x3953213 outlineClip at (0,0) size 800x17895697
RenderTextControl {TEXTAREA} at (2,25178664) size 179x-46404128 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
- RenderBlock {DIV} at (3,3) size 160x16
+ RenderBlock {DIV} at (3,3) size 175x16
Modified: branches/chromium/1180/Source/WebCore/ChangeLog (123233 => 123234)
--- branches/chromium/1180/Source/WebCore/ChangeLog 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/Source/WebCore/ChangeLog 2012-07-20 17:56:43 UTC (rev 123234)
@@ -1,3 +1,36 @@
+2012-07-17 Emil A Eklund <[email protected]>
+
+ Incorrect offset used for scrollWidth/Height calculation
+ https://bugs.webkit.org/show_bug.cgi?id=91461
+
+ Reviewed by Eric Seidel.
+
+ Due to a different offset being used to calculate the scrollWidth/Height
+ and pixelSnappedClientWidth/Height the scroll value can be off by one in
+ same cases. This can causes scrollbars to appear even when there is no
+ overflow.
+
+ Test: fast/sub-pixel/block-with-margin-overflow.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::scrollWidth):
+ Change location offset passed to snapSizeToPixel to include x() to match
+ offset used by pixelSnappedClientWidth.
+
+ (WebCore::RenderBox::scrollHeight):
+ Change location offset passed to snapSizeToPixel to include y() to match
+ offset used by pixelSnappedClientHeight.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::clampScrollOffset):
+ Change calculation to use pixelSnappedClientWidth/Height as it is
+ subtracted from the pixel snapped scrollWidth/Height values.
+
+ (WebCore::RenderLayer::scrollWidth):
+ (WebCore::RenderLayer::scrollHeight):
+ Change RenderLayer versions of scrollWidth/Height to include x()/y() as
+ per the RenderBox versions.
+
2012-07-16 Emil A Eklund <[email protected]>
Inconsistent rounding in table layout causes background color to bleed through
Modified: branches/chromium/1180/Source/WebCore/rendering/RenderBox.cpp (123233 => 123234)
--- branches/chromium/1180/Source/WebCore/rendering/RenderBox.cpp 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/Source/WebCore/rendering/RenderBox.cpp 2012-07-20 17:56:43 UTC (rev 123234)
@@ -385,7 +385,7 @@
// For objects with visible overflow, this matches IE.
// FIXME: Need to work right with writing modes.
if (style()->isLeftToRightDirection())
- return snapSizeToPixel(max(clientWidth(), layoutOverflowRect().maxX() - borderLeft()), clientLeft());
+ return snapSizeToPixel(max(clientWidth(), layoutOverflowRect().maxX() - borderLeft()), x() + clientLeft());
return clientWidth() - min(ZERO_LAYOUT_UNIT, layoutOverflowRect().x() - borderLeft());
}
@@ -395,7 +395,7 @@
return layer()->scrollHeight();
// For objects with visible overflow, this matches IE.
// FIXME: Need to work right with writing modes.
- return snapSizeToPixel(max(clientHeight(), layoutOverflowRect().maxY() - borderTop()), clientTop());
+ return snapSizeToPixel(max(clientHeight(), layoutOverflowRect().maxY() - borderTop()), y() + clientTop());
}
int RenderBox::scrollLeft() const
Modified: branches/chromium/1180/Source/WebCore/rendering/RenderLayer.cpp (123233 => 123234)
--- branches/chromium/1180/Source/WebCore/rendering/RenderLayer.cpp 2012-07-20 17:56:12 UTC (rev 123233)
+++ branches/chromium/1180/Source/WebCore/rendering/RenderLayer.cpp 2012-07-20 17:56:43 UTC (rev 123234)
@@ -1580,8 +1580,8 @@
if (!box)
return;
- int maxX = scrollWidth() - box->clientWidth();
- int maxY = scrollHeight() - box->clientHeight();
+ int maxX = scrollWidth() - box->pixelSnappedClientWidth();
+ int maxY = scrollHeight() - box->pixelSnappedClientHeight();
x = min(max(x, 0), maxX);
y = min(max(y, 0), maxY);
@@ -2409,7 +2409,7 @@
ASSERT(renderBox());
if (m_scrollDimensionsDirty)
const_cast<RenderLayer*>(this)->computeScrollDimensions();
- return snapSizeToPixel(m_scrollSize.width(), renderBox()->clientLeft());
+ return snapSizeToPixel(m_scrollSize.width(), renderBox()->clientLeft() + renderBox()->x());
}
int RenderLayer::scrollHeight() const
@@ -2417,7 +2417,7 @@
ASSERT(renderBox());
if (m_scrollDimensionsDirty)
const_cast<RenderLayer*>(this)->computeScrollDimensions();
- return snapSizeToPixel(m_scrollSize.height(), renderBox()->clientTop());
+ return snapSizeToPixel(m_scrollSize.height(), renderBox()->clientTop() + renderBox()->y());
}
LayoutUnit RenderLayer::overflowTop() const