Title: [154722] trunk
- Revision
- 154722
- Author
- [email protected]
- Date
- 2013-08-27 21:35:14 -0700 (Tue, 27 Aug 2013)
Log Message
Scrolling allowed when overflow:hidden (seen on Acid2)
https://bugs.webkit.org/show_bug.cgi?id=22769
Reviewed by Darin Adler.
Patch by Antonio Gomes <[email protected]>
Source/WebCore:
Autoscroll, as well as other user-driven scroll actions,
has to respect the scrollability styled into the web page.
More specifically, if a html or body tags are styled with
overflow:hidden, autoscroll should not scroll the containing document.
In order to fix this, patch hardens RenderBox::canAutoscroll as
following: previously, ::canAutoscroll was relying solemnly in
::canBeScrolledAndHasScrollableArea to determine the scrollability
of #document node, which was unconditionally returned as 'true'.
Patch extends ::canAutoscroll to handle the #document case for
main and inner frames, and now it asks through ::isScrollable if
the corresponding document's FrameView is actually user-scrollable.
Note, that the patch change ::canAutoscroll to cover the non-mainFrame
now.
Test: fast/events/autoscroll-in-overflow-hidden-html.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::canAutoscroll):
LayoutTests:
Autoscroll'ing the mainframe's document is hard with the current
EventSender machinary. Because of that, patch adds an iframe's document test case.
* fast/events/autoscroll-in-overflow-hidden-html.html: Added.
* fast/events/resources/big-page-with-overflow-hidden-and-anchor-scroll.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (154721 => 154722)
--- trunk/LayoutTests/ChangeLog 2013-08-28 04:00:51 UTC (rev 154721)
+++ trunk/LayoutTests/ChangeLog 2013-08-28 04:35:14 UTC (rev 154722)
@@ -1,3 +1,16 @@
+2013-08-26 Antonio Gomes <[email protected]>
+
+ Scrolling allowed when overflow:hidden (seen on Acid2)
+ https://bugs.webkit.org/show_bug.cgi?id=22769
+
+ Reviewed by Darin Adler.
+
+ Autoscroll'ing the mainframe's document is hard with the current
+ EventSender machinary. Because of that, patch adds an iframe's document test case.
+
+ * fast/events/autoscroll-in-overflow-hidden-html.html: Added.
+ * fast/events/resources/big-page-with-overflow-hidden-and-anchor-scroll.html: Added.
+
2013-08-27 Dean Jackson <[email protected]>
svg/animations/svglengthlist-animation-3.html is flakey on Mac
Added: trunk/LayoutTests/fast/events/autoscroll-in-overflow-hidden-html-expected.txt (0 => 154722)
--- trunk/LayoutTests/fast/events/autoscroll-in-overflow-hidden-html-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-in-overflow-hidden-html-expected.txt 2013-08-28 04:35:14 UTC (rev 154722)
@@ -0,0 +1,3 @@
+
+PASSED: the autoscroll has not happened.
+
Added: trunk/LayoutTests/fast/events/autoscroll-in-overflow-hidden-html.html (0 => 154722)
--- trunk/LayoutTests/fast/events/autoscroll-in-overflow-hidden-html.html (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-in-overflow-hidden-html.html 2013-08-28 04:35:14 UTC (rev 154722)
@@ -0,0 +1,77 @@
+<html>
+ <head>
+ <script src=""
+ <script>
+ function log(msg)
+ {
+ document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
+ }
+
+ var iframe;
+ var iframeDocument;
+ var iframeScrollTopAfterAnchor = 0;
+
+ function test()
+ {
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ iframe = document.getElementById('NoScrolliFrame');
+ iframeDocument = iframe.contentDocument;
+ iframeScrollTopAfterAnchor = 0;
+
+ var clickme = iframeDocument.getElementById('clickme');
+ var x = iframe.offsetLeft + clickme.offsetLeft + 7;
+ var y = iframe.offsetTop + clickme.offsetTop + 7;
+ if (window.eventSender) {
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ setTimeout(autoscrollTestPart1, 0);
+ }
+
+ function autoscrollTestPart1()
+ {
+ iframeScrollTopAfterAnchor = iframeDocument.body.scrollTop;
+ if (iframeDocument.body.scrollTop == 0)
+ log("FAILED: anchor clicking within non-scrollable inner frame failed.");
+
+ if (window.eventSender) {
+ var textInIframe = iframeDocument.getElementById('textInFrame');
+ var x = iframe.offsetLeft + textInIframe.offsetLeft - iframeDocument.body.scrollLeft + 7;
+ var y = iframe.offsetTop + textInIframe.offsetTop - iframeDocument.body.scrollTop + 7;
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(x, y - 10);
+ y = iframe.offsetTop;
+ eventSender.mouseMoveTo(x, y - 5);
+ }
+ setTimeout(autoscrollTestPart2, 100);
+ }
+
+ function autoscrollTestPart2()
+ {
+ if (window.eventSender)
+ eventSender.mouseUp();
+
+ if (iframeScrollTopAfterAnchor == iframeDocument.body.scrollTop)
+ log("PASSED: the autoscroll has not happened.");
+ else
+ log("FAILED: the autoscroll has happened.");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ </script>
+ </head>
+<body _onload_="test()">
+ <iframe id="NoScrolliFrame" style="height: 150px; width: 150px" src="" ></iframe>
+ <div id="console"></div>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/events/resources/big-page-with-overflow-hidden-and-anchor-scroll.html (0 => 154722)
--- trunk/LayoutTests/fast/events/resources/big-page-with-overflow-hidden-and-anchor-scroll.html (rev 0)
+++ trunk/LayoutTests/fast/events/resources/big-page-with-overflow-hidden-and-anchor-scroll.html 2013-08-28 04:35:14 UTC (rev 154722)
@@ -0,0 +1,15 @@
+<head>
+<style type="text/css">
+ html { overflow: hidden; }
+ #anchor { margin: 100em 0em 0;}
+ .picture {margin: 0 0 50em 0em; }
+</style>
+</head>
+<body>
+ <a id="clickme" href="" here</a>
+ <h2 id="anchor">Any text</h2>
+ <div id="textInFrame" class="picture">
+ <span> click and hold and drag mouse up to see if it scroll in Safari.</div>
+ </div>
+ <div id="console"></div>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (154721 => 154722)
--- trunk/Source/WebCore/ChangeLog 2013-08-28 04:00:51 UTC (rev 154721)
+++ trunk/Source/WebCore/ChangeLog 2013-08-28 04:35:14 UTC (rev 154722)
@@ -1,3 +1,32 @@
+2013-08-26 Antonio Gomes <[email protected]>
+
+ Scrolling allowed when overflow:hidden (seen on Acid2)
+ https://bugs.webkit.org/show_bug.cgi?id=22769
+
+ Reviewed by Darin Adler.
+
+ Autoscroll, as well as other user-driven scroll actions,
+ has to respect the scrollability styled into the web page.
+ More specifically, if a html or body tags are styled with
+ overflow:hidden, autoscroll should not scroll the containing document.
+
+ In order to fix this, patch hardens RenderBox::canAutoscroll as
+ following: previously, ::canAutoscroll was relying solemnly in
+ ::canBeScrolledAndHasScrollableArea to determine the scrollability
+ of #document node, which was unconditionally returned as 'true'.
+ Patch extends ::canAutoscroll to handle the #document case for
+ main and inner frames, and now it asks through ::isScrollable if
+ the corresponding document's FrameView is actually user-scrollable.
+
+ Note, that the patch change ::canAutoscroll to cover the non-mainFrame
+ #document case, so the comment specific to Apple's Mail app can be omited
+ now.
+
+ Test: fast/events/autoscroll-in-overflow-hidden-html.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::canAutoscroll):
+
2013-08-27 Santosh Mahto <[email protected]>
Adding "explicit" keyword in forms related classes constructor
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (154721 => 154722)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2013-08-28 04:00:51 UTC (rev 154721)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2013-08-28 04:35:14 UTC (rev 154722)
@@ -817,19 +817,14 @@
// There are two kinds of renderer that can autoscroll.
bool RenderBox::canAutoscroll() const
{
+ if (node() && node()->isDocumentNode())
+ return view().frameView().isScrollable();
+
// Check for a box that can be scrolled in its own right.
if (canBeScrolledAndHasScrollableArea())
return true;
- // Check for a box that represents the top level of a web page.
- // This can be scrolled by calling Chrome::scrollRectIntoView.
- // This only has an effect on the Mac platform in applications
- // that put web views into scrolling containers, such as Mac OS X Mail.
- // The code for this is in RenderLayer::scrollRectToVisible.
- if (node() != &document())
- return false;
- Page* page = frame().page();
- return page && page->frameIsMainFrame(&frame()) && view().frameView().isScrollable();
+ return false;
}
// If specified point is in border belt, returned offset denotes direction of
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes