Commit 9cbc8db4 authored by tonikitoo@webkit.org's avatar tonikitoo@webkit.org

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 <a1.gomes@sisa.samsung.com>

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7a7fc643
2013-08-26 Antonio Gomes <a1.gomes@sisa.samsung.com>
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 <dino@apple.com>
svg/animations/svglengthlist-animation-3.html is flakey on Mac
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<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="resources/big-page-with-overflow-hidden-and-anchor-scroll.html" ></iframe>
<div id="console"></div>
</body>
</html>
<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="#anchor">Click 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>
2013-08-26 Antonio Gomes <a1.gomes@sisa.samsung.com>
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 <santosh.ma@samsung.com>
Adding "explicit" keyword in forms related classes constructor
......@@ -817,19 +817,14 @@ void RenderBox::autoscroll(const IntPoint& position)
// 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment