- Revision
- 113611
- Author
- [email protected]
- Date
- 2012-04-09 13:31:15 -0700 (Mon, 09 Apr 2012)
Log Message
Unnecessary scroll bar after changing the dimensions of a DIV
https://bugs.webkit.org/show_bug.cgi?id=71541
Patch by SravanKumar Sandela <[email protected]> on 2012-04-09
Reviewed by Julien Chaffraix.
Source/WebCore:
overflow: auto was being determined based on clientWidth and clientHeight, which during style change
scenarii will blindly exclude previous scrollbars while computing overflow. This is valid only for
overflow: scroll, but for other cases it wrongly reduces available area. Now it is taken care by
determining the overflow based on pixelSnappedPaddingBoxWidth/Height() which are newly added in RenderBox.
Tests: fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html
fast/overflow/overflow-auto-destroy-scroll-after-resizing.html
* rendering/RenderBox.h:
(WebCore::RenderBox::paddingBoxWidth):
(WebCore::RenderBox::paddingBoxHeight):
(WebCore::RenderBox::pixelSnappedPaddingBoxWidth):
(WebCore::RenderBox::pixelSnappedPaddingBoxHeight):
(RenderBox):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hasHorizontalOverflow):
(WebCore::RenderLayer::hasVerticalOverflow):
LayoutTests:
Ref tests to check scrollbar behaviour in overflow: auto, on resizing.
* fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html: Added.
* fast/overflow/overflow-auto-destroy-scroll-after-resizing.html: Added.
scrollbars-on-positioned-content.html and hidden-scrollbar-resize.html needs to be rebaselined
as their expected values were buggy because of redundant scrollbars.
* platform/chromium/test_expectations.txt:
* platform/efl/Skipped:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (113610 => 113611)
--- trunk/LayoutTests/ChangeLog 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/LayoutTests/ChangeLog 2012-04-09 20:31:15 UTC (rev 113611)
@@ -1,3 +1,24 @@
+2012-04-09 SravanKumar Sandela <[email protected]>
+
+ Unnecessary scroll bar after changing the dimensions of a DIV
+ https://bugs.webkit.org/show_bug.cgi?id=71541
+
+ Reviewed by Julien Chaffraix.
+
+ Ref tests to check scrollbar behaviour in overflow: auto, on resizing.
+
+ * fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html: Added.
+ * fast/overflow/overflow-auto-destroy-scroll-after-resizing.html: Added.
+
+ scrollbars-on-positioned-content.html and hidden-scrollbar-resize.html needs to be rebaselined
+ as their expected values were buggy because of redundant scrollbars.
+
+ * platform/chromium/test_expectations.txt:
+ * platform/efl/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+
2012-04-09 Victor Carbune <[email protected]>
Simplified volume rendering.
Added: trunk/LayoutTests/fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html (0 => 113611)
--- trunk/LayoutTests/fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html (rev 0)
+++ trunk/LayoutTests/fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html 2012-04-09 20:31:15 UTC (rev 113611)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ </head>
+ <body>
+ <p> Bug <a href="" Unnecessary scroll bar after changing the dimensions of a DIV </p>
+ <p> For this test to pass, we should not see any scrollbars once width and height are changed to 100*100 through _javascript_ </p>
+ <div id="divId" style="position:absolute; left:110px; top:140px; width:100px; height:100px; overflow:auto;">
+ <div style="position:absolute; left:0px; top:0px; width:100px; height:100px; background-color:Green">My Width and Height is 100 and 100</div>
+ </div>
+ </body>
+</html>
+
Added: trunk/LayoutTests/fast/overflow/overflow-auto-destroy-scroll-after-resizing.html (0 => 113611)
--- trunk/LayoutTests/fast/overflow/overflow-auto-destroy-scroll-after-resizing.html (rev 0)
+++ trunk/LayoutTests/fast/overflow/overflow-auto-destroy-scroll-after-resizing.html 2012-04-09 20:31:15 UTC (rev 113611)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script type="text/_javascript_">
+ function increaseOuterDiv() {
+ var outer = document.getElementById("divId");
+ outer.style.height = "100px";
+ outer.style.width = "100px";
+ }
+
+ window.addEventListener("load", increaseOuterDiv, false);
+ </script>
+ </head>
+ <body>
+ <p> Bug <a href="" Unnecessary scroll bar after changing the dimensions of a DIV </p>
+ <p> For this test to pass, we should not see any scrollbars once width and height are changed to 100*100 through _javascript_ </p>
+ <div id="divId" style="position:absolute; left:110px; top:140px; width:60px; height:60px; overflow:auto;">
+ <div style="position:absolute; left:0px; top:0px; width:100px; height:100px; background-color:Green">My Width and Height is 100 and 100</div>
+ </div>
+ </body>
+</html>
+
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (113610 => 113611)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-04-09 20:31:15 UTC (rev 113611)
@@ -3144,6 +3144,10 @@
BUGWK71451 SLOW : fast/frames/sandboxed-iframe-navigation-windowopen.html = PASS
+//Need Rebaselining
+BUGWK71541 : fast/overflow/hidden-scrollbar-resize.html = TEXT
+BUGWK71541 : scrollbars/scrollbars-on-positioned-content.html = IMAGE+TEXT
+
// Introduced due to BUGWK53512, fails under Skia right now
BUGWK65939 : svg/custom/getBBox-path.svg = TEXT
Modified: trunk/LayoutTests/platform/efl/Skipped (113610 => 113611)
--- trunk/LayoutTests/platform/efl/Skipped 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/LayoutTests/platform/efl/Skipped 2012-04-09 20:31:15 UTC (rev 113611)
@@ -1893,6 +1893,10 @@
# https://bugs.webkit.org/show_bug.cgi?id=64731
http/tests/media/media-source/
+# Need rebaselining after https://bugs.webkit.org/show_bug.cgi?id=71541
+fast/overflow/hidden-scrollbar-resize.html
+scrollbars/scrollbars-on-positioned-content.html
+
# Needs a rebaseline
fast/events/clear-drag-state.html
fast/events/clear-edit-drag-state.html
Modified: trunk/LayoutTests/platform/mac/Skipped (113610 => 113611)
--- trunk/LayoutTests/platform/mac/Skipped 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/LayoutTests/platform/mac/Skipped 2012-04-09 20:31:15 UTC (rev 113611)
@@ -626,6 +626,10 @@
# Not possible to set UA string for media requests with all Mac media engines.
http/tests/media/video-useragent.html
+# Need rebaselining after https://bugs.webkit.org/show_bug.cgi?id=71541
+fast/overflow/hidden-scrollbar-resize.html
+scrollbars/scrollbars-on-positioned-content.html
+
# Rebaseline after https://bugs.webkit.org/show_bug.cgi?id=78412
tables/mozilla/bugs/bug2123.html
tables/mozilla/bugs/bug2509.html
Modified: trunk/LayoutTests/platform/qt/Skipped (113610 => 113611)
--- trunk/LayoutTests/platform/qt/Skipped 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-04-09 20:31:15 UTC (rev 113611)
@@ -2018,6 +2018,10 @@
# Needs a rebaseline, caused by https://bugs.webkit.org/show_bug.cgi?id=43022
tables/mozilla_expected_failures/bugs/bug85016.html
+# Need rebaselining after https://bugs.webkit.org/show_bug.cgi?id=71541
+fast/overflow/hidden-scrollbar-resize.html
+scrollbars/scrollbars-on-positioned-content.html
+
# The inner <input> should now grow to take the full cell's height.
fast/table/colspanMinWidth-vertical.html
# ============================================================================= #
Modified: trunk/LayoutTests/platform/win/Skipped (113610 => 113611)
--- trunk/LayoutTests/platform/win/Skipped 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/LayoutTests/platform/win/Skipped 2012-04-09 20:31:15 UTC (rev 113611)
@@ -1673,6 +1673,10 @@
fast/dom/HTMLTableElement/createCaption.html
fast/repaint/table-section-repaint.html
+// Need rebaselining after https://bugs.webkit.org/show_bug.cgi?id=71541
+fast/overflow/hidden-scrollbar-resize.html
+scrollbars/scrollbars-on-positioned-content.html
+
// Need rebaselining after bug 69210.
fast/encoding/utf-16-big-endian.html
fast/encoding/utf-16-little-endian.html
Modified: trunk/Source/WebCore/ChangeLog (113610 => 113611)
--- trunk/Source/WebCore/ChangeLog 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/Source/WebCore/ChangeLog 2012-04-09 20:31:15 UTC (rev 113611)
@@ -1,3 +1,28 @@
+2012-04-09 SravanKumar Sandela <[email protected]>
+
+ Unnecessary scroll bar after changing the dimensions of a DIV
+ https://bugs.webkit.org/show_bug.cgi?id=71541
+
+ Reviewed by Julien Chaffraix.
+
+ overflow: auto was being determined based on clientWidth and clientHeight, which during style change
+ scenarii will blindly exclude previous scrollbars while computing overflow. This is valid only for
+ overflow: scroll, but for other cases it wrongly reduces available area. Now it is taken care by
+ determining the overflow based on pixelSnappedPaddingBoxWidth/Height() which are newly added in RenderBox.
+
+ Tests: fast/overflow/overflow-auto-destroy-scroll-after-resizing-expected.html
+ fast/overflow/overflow-auto-destroy-scroll-after-resizing.html
+
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::paddingBoxWidth):
+ (WebCore::RenderBox::paddingBoxHeight):
+ (WebCore::RenderBox::pixelSnappedPaddingBoxWidth):
+ (WebCore::RenderBox::pixelSnappedPaddingBoxHeight):
+ (RenderBox):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::hasHorizontalOverflow):
+ (WebCore::RenderLayer::hasVerticalOverflow):
+
2012-04-09 Victor Carbune <[email protected]>
Simplified volume slider rendering.
Modified: trunk/Source/WebCore/rendering/RenderBox.h (113610 => 113611)
--- trunk/Source/WebCore/rendering/RenderBox.h 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2012-04-09 20:31:15 UTC (rev 113611)
@@ -212,6 +212,11 @@
int pixelSnappedClientWidth() const;
int pixelSnappedClientHeight() const;
+ LayoutUnit paddingBoxWidth() const { return width() - borderLeft() - borderRight(); }
+ LayoutUnit paddingBoxHeight() const { return height() - borderTop() - borderBottom(); }
+ int pixelSnappedPaddingBoxWidth() const { return snapSizeToPixel(paddingBoxWidth(), x() + paddingLeft()); }
+ int pixelSnappedPaddingBoxHeight() const { return snapSizeToPixel(paddingBoxHeight(), y() + paddingTop()); }
+
// scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
// object has overflow:hidden/scroll/auto specified and also has overflow.
// scrollLeft/Top return the current scroll position. These methods are virtual so that objects like
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (113610 => 113611)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-04-09 20:26:05 UTC (rev 113610)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-04-09 20:31:15 UTC (rev 113611)
@@ -2417,15 +2417,15 @@
bool RenderLayer::hasHorizontalOverflow() const
{
ASSERT(!m_scrollDimensionsDirty);
-
- return scrollWidth() > renderBox()->pixelSnappedClientWidth();
+ int widthForHorizontalScrollbar = renderBox()->style()->overflowX() == OSCROLL ? renderBox()->pixelSnappedClientWidth() : renderBox()->pixelSnappedPaddingBoxWidth();
+ return scrollWidth() > widthForHorizontalScrollbar;
}
bool RenderLayer::hasVerticalOverflow() const
{
ASSERT(!m_scrollDimensionsDirty);
-
- return scrollHeight() > renderBox()->pixelSnappedClientHeight();
+ int heightForVerticalScrollbar = renderBox()->style()->overflowY() == OSCROLL ? renderBox()->pixelSnappedClientHeight() : renderBox()->pixelSnappedPaddingBoxHeight();
+ return scrollHeight() > heightForVerticalScrollbar;
}
void RenderLayer::updateScrollbarsAfterLayout()