Skip to content
Permalink
Browse files
2008-08-21 Maxime Britto <britto@apple.com>
        Reviewed by Kevin McCullough.

        Test: fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div.html
        https://bugs.webkit.org/show_bug.cgi?id=20451

        rdar://problem/6166435 Inspector doesn't auto scroll when selecting text (20451)
        When we climb up the rendering tree looking for a scrollable renderer, we need to be able to jump outside of an iframe.
        This way we can see if what is embedding the iframe can be scrolled even if the iframe content can't.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMouseDraggedEvent): when we reach the document node and it can't be scrolled we set the next parent as the document's owner element if it exists.

        (WebCore::EventHandler::handleMousePressEvent): ditto


2008-08-21  Maxime Britto  <britto@apple.com>

        Reviewed by Kevin McCullough.

        rdar://problem/6166435 Inspector doesn't auto scroll when selecting text (20451)
        https://bugs.webkit.org/show_bug.cgi?id=20451

        This test can be run automatically or manually as well.

        * fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div-expected.txt: Added.
        * fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div.html: Added.
        * fast/events/resources/big-page-with-overflow-hidden.html: Added.




Canonical link: https://commits.webkit.org/28288@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Maxime Britto committed Aug 22, 2008
1 parent 233102a commit 190caa76babde76e3b0a9db83f09835909ea4890
Showing 6 changed files with 124 additions and 4 deletions.
@@ -1,3 +1,16 @@
2008-08-21 Maxime Britto <britto@apple.com>

Reviewed by Kevin McCullough.

rdar://problem/6166435 Inspector doesn't auto scroll when selecting text (20451)
https://bugs.webkit.org/show_bug.cgi?id=20451

This test can be run automatically or manually as well.

* fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div-expected.txt: Added.
* fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div.html: Added.
* fast/events/resources/big-page-with-overflow-hidden.html: Added.

2008-08-21 Chris Marrin <cmarrin@apple.com>

Allow 0 (without units) for Time eg. duration
@@ -0,0 +1,6 @@

rdar://problem/6166435 Inspector doesn't auto scroll when selecting text (20451)
To do the test manually you have to try triggering the autoscroll by starting the dragging from within the blue iframe. If the autoscroll occurs the text has passed, if the autoscroll isn't working, the test has failed
nb: Knowing that the iframe document has a overflow: hidden on his body but the whole iframe is embedded in scrollable div, the scrollable div have to be able to trigger the autoscroll
Though you should be able to write some long text in the input and to trigger the autoscroll within the input.
PASSED : the autoscroll has worked !
@@ -0,0 +1,66 @@
<html>
<head>
<script>
function log(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
}

function test()
{
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
layoutTestController.dumpAsText();
setTimeout(autoscrollTestPart1, 0);
}
}

function autoscrollTestPart1()
{
var iframe = document.getElementById('NoScrolliFrame');
var iframeDocument = iframe.contentDocument;
var textInIframe = iframeDocument.getElementById('textInFrame');
if (window.eventSender) {
var x = iframe.offsetLeft + textInIframe.offsetLeft + 7;
var y = iframe.offsetLeft + textInIframe.offsetTop + 7;
eventSender.dragMode = false;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseMoveTo(x + 220, y + 220);
}
setTimeout(autoscrollTestPart2, 100);
}

function autoscrollTestPart2()
{
if (window.eventSender)
eventSender.mouseUp();
var sd = document.getElementById('scrollableDiv');
if (sd.scrollLeft != 0)
log("PASSED : the autoscroll has worked !");
else
log("FAILED : the autoscroll has not worked :-(");

if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
</head>
<body onload="test()">

<div id="scrollableDiv" style="height: 100px; overflow-x: auto; overflow-y: auto; width: 100px">
<div style=" height: 1000px; width: 1000px">
<iframe id="NoScrolliFrame" src="resources/big-page-with-overflow-hidden.html" style="height: 1000px; width: 1000px"></iframe>
</div>
</div>

<div id="console">
rdar://problem/6166435 Inspector doesn't auto scroll when selecting text (20451) <br>
To do the test manually you have to try triggering the autoscroll by starting the dragging from within the blue iframe. If the autoscroll occurs the text has passed, if the autoscroll isn't working, the test has failed<br>
nb: Knowing that the iframe document has a overflow: hidden on his body but the whole iframe is embedded in scrollable div, the scrollable div have to be able to trigger the autoscroll<br>
Though you should be able to write some long text in the input and to trigger the autoscroll within the input.<br>
</div>

</body>
</html>

@@ -0,0 +1,10 @@
<html>
<body style="overflow: hidden">
<div style="width: 1000px; height: 1000px; background-color: blue">
<span id='textInFrame'> Try to autoscroll this text.<br>
this page is a 1000px by 1000px page with the CSS overflow hidden attribute setted </span>
<br><br><br><br>
PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED
</div>
</body>
</html>
@@ -1,3 +1,19 @@
2008-08-21 Maxime Britto <britto@apple.com>

Reviewed by Kevin McCullough.

Test: fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div.html
https://bugs.webkit.org/show_bug.cgi?id=20451

rdar://problem/6166435 Inspector doesn't auto scroll when selecting text (20451)
When we climb up the rendering tree looking for a scrollable renderer, we need to be able to jump outside of an iframe.
This way we can see if what is embedding the iframe can be scrolled even if the iframe content can't.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseDraggedEvent): when we reach the document node and it can't be scrolled we set the next parent as the document's owner element if it exists.

(WebCore::EventHandler::handleMousePressEvent): ditto

2008-08-21 Anthony Ricaud <rik24d@gmail.com>

Small optimization for when the dividers in the Inspector's
@@ -395,8 +395,13 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
// If the selection is contained in a layer that can scroll, that layer should handle the autoscroll
// Otherwise, let the bridge handle it so the view can scroll itself.
RenderObject* renderer = targetNode->renderer();
while (renderer && !renderer->canBeProgramaticallyScrolled(true))
renderer = renderer->parent();
while (renderer && !renderer->canBeProgramaticallyScrolled(false)) {
if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
renderer = renderer->document()->ownerElement()->renderer();
else
renderer = renderer->parent();
}

if (renderer) {
m_autoscrollInProgress = true;
handleAutoscroll(renderer);
@@ -982,8 +987,12 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
if (mouseEvent.button() == MiddleButton && !mev.isOverLink()) {
RenderObject* renderer = mev.targetNode()->renderer();

while (renderer && !renderer->canBeProgramaticallyScrolled(true))
renderer = renderer->parent();
while (renderer && !renderer->canBeProgramaticallyScrolled(false)) {
if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
renderer = renderer->document()->ownerElement()->renderer();
else
renderer = renderer->parent();
}

if (renderer) {
m_panScrollInProgress = true;

0 comments on commit 190caa7

Please sign in to comment.