[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

japhet at chromium.org japhet at chromium.org
Thu Oct 29 20:36:07 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit f0ef993c58c0822165b09e598ddaf3479a6e9182
Author: japhet at chromium.org <japhet at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 29 18:37:36 2009 +0000

    2009-09-29  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Ensure that we don't scroll lock to an anchor node after a
            user-initiated scroll, even if that scroll doesn't propagate
            all the way up to FrameView.
    
            Test: fast/events/node-event-anchor-lock.html
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 37f94bc..3fbdea1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-29  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Test for https://bugs.webkit.org/show_bug.cgi?id=27860.
+
+        * fast/events/node-event-anchor-lock-expected.txt: Added.
+        * fast/events/node-event-anchor-lock.html: Added.
+
 2009-09-28  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler and Sam Weinig.
diff --git a/LayoutTests/fast/events/node-event-anchor-lock-expected.txt b/LayoutTests/fast/events/node-event-anchor-lock-expected.txt
new file mode 100644
index 0000000..28f0ed5
--- /dev/null
+++ b/LayoutTests/fast/events/node-event-anchor-lock-expected.txt
@@ -0,0 +1,7 @@
+This test does the following:
+1. Navigate to an anchor link. WebKit will ensure that the anchor remains visible as other objects load around it and scripts execute.
+2. The div containing the anchor link will be scrolled via PageDown. This simulated user action should stop us locking the screen to where the anchor is.
+3. Force a repaint. If the lock to the anchor was properly released, the scroll caused by the PageDown will not be reverted and parentDiv.scrollTop will be greater than 600px (the offset of the anchor). If we return to the anchor, the test has failed.
+Go to anchor
+PASS: scrollTop is greater than 600px
+
diff --git a/LayoutTests/fast/events/node-event-anchor-lock.html b/LayoutTests/fast/events/node-event-anchor-lock.html
new file mode 100644
index 0000000..7251fdf
--- /dev/null
+++ b/LayoutTests/fast/events/node-event-anchor-lock.html
@@ -0,0 +1,48 @@
+<html><body>
+This test does the following:</br>
+1. Navigate to an anchor link.  WebKit will ensure that the anchor remains visible as other objects load around it and scripts execute.</br>
+2. The div containing the anchor link will be scrolled via PageDown.  This simulated user action should stop us locking the screen to where the anchor is.</br>
+3. Force a repaint. If the lock to the anchor was properly released, the scroll caused by the PageDown will not be reverted and parentDiv.scrollTop will be greater than 600px (the offset of the anchor). If we return to the anchor, the test has failed.</br>
+<a id="startLink" href="#anchor">Go to anchor</a>
+<div id="console"></div>
+<div id="parentDiv" style="width:500; height:300; overflow:auto">
+<div style="height: 600px"></div>
+<a id="anchor"></a>
+<div style="height: 800px"></div>
+</div>
+<script>
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+if (window.eventSender) {
+    // Lock to the anchor inside the div
+    var target = document.getElementById("startLink");
+    eventSender.mouseMoveTo(target.offsetLeft + 2, target.offsetTop + 2);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+ 
+    // Perform a page down to be handled by div, should release anchor lock
+    var divInfo = document.getElementById("parentDiv");
+    eventSender.mouseMoveTo(divInfo.offsetLeft + 2, divInfo.offsetTop + 2);
+    eventSender.mouseDown();
+    eventSender.keyDown("pageDown");
+}
+
+// Force layout. If the scrollbar gets reset during layout, the test has failed
+document.getElementById("startLink").offsetHeight += 1;
+
+var scrollTop = document.getElementById("parentDiv").scrollTop;
+var line = document.createElement('div');
+if (scrollTop > 600)
+    line.appendChild(document.createTextNode("PASS: scrollTop is greater than 600px"));
+else
+    line.appendChild(document.createTextNode("FAIL: scrollTop is " + scrollTop+ "px, but should be more than 600px"));
+document.getElementById('console').appendChild(line);
+
+if (window.layoutTestController)
+    layoutTestController.notifyDone();
+
+</script></body></html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dc89651..e0e51b4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-09-29  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Ensure that we don't scroll lock to an anchor node after a
+        user-initiated scroll, even if that scroll doesn't propagate
+        all the way up to FrameView.
+
+        Test: fast/events/node-event-anchor-lock.html
+
+        * page/EventHandler.cpp: Call setFrameWasScrolledByUser() when a scroll is handled by a node rather than a frame.
+        (WebCore::EventHandler::scrollOverflow):
+        (WebCore::EventHandler::handleWheelEvent):
+        (WebCore::EventHandler::sendScrollEvent): Use setFrameWasScrolledByUser();
+        (WebCore::EventHandler::setFrameWasScrolledByUser): Split out of sendScrollEvent();
+        (WebCore::EventHandler::passMousePressEventToScrollbar):
+        * page/EventHandler.h: Declare setFrameWasScrolledByUser().
+
 2009-09-28  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler and Sam Weinig.
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 3772d65..1075e72 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -894,8 +894,10 @@ bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity g
     
     if (node) {
         RenderObject* r = node->renderer();
-        if (r && !r->isListBox())
-            return r->enclosingBox()->scroll(direction, granularity);
+        if (r && !r->isListBox() && r->enclosingBox()->scroll(direction, granularity)) {
+            setFrameWasScrolledByUser();
+            return true;
+        }
     }
 
     return false;
@@ -1778,6 +1780,7 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
     FrameView* view = m_frame->view();
     if (!view)
         return false;
+    setFrameWasScrolledByUser();
     IntPoint vPoint = view->windowToContents(e.pos());
 
     Node* node;
@@ -2479,17 +2482,23 @@ void EventHandler::sendResizeEvent()
 
 void EventHandler::sendScrollEvent()
 {
+    setFrameWasScrolledByUser();
+    if (m_frame->view())
+        m_frame->document()->dispatchEvent(Event::create(eventNames().scrollEvent, true, false));
+}
+
+void EventHandler::setFrameWasScrolledByUser()
+{
     FrameView* v = m_frame->view();
-    if (!v)
-        return;
-    v->setWasScrolledByUser(true);
-    m_frame->document()->dispatchEvent(Event::create(eventNames().scrollEvent, true, false));
+    if (v)
+        v->setWasScrolledByUser(true);
 }
 
 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev, Scrollbar* scrollbar)
 {
     if (!scrollbar || !scrollbar->enabled())
         return false;
+    setFrameWasScrolledByUser();
     return scrollbar->mouseDown(mev.event());
 }
 
diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h
index e1a02db..0221397 100644
--- a/WebCore/page/EventHandler.h
+++ b/WebCore/page/EventHandler.h
@@ -306,6 +306,8 @@ private:
 #endif
 
     void updateLastScrollbarUnderMouse(Scrollbar*, bool);
+    
+    void setFrameWasScrolledByUser();
 
     bool capturesDragging() const { return m_capturesDragging; }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list