[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 11:28:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6563e9f3952feed9651ee5fb085e1af765f03f64
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 27 00:00:51 2010 +0000

    Part 2 of https://bugs.webkit.org/show_bug.cgi?id=43013
    <rdar://problem/8152434>
    Add support for scrolling using the keyboard in WebKit2
    
    Reviewed by Anders Carlsson.
    
    Add support for scrolling with the space bar and ensure that we don't scroll
    if WebCore is handling the event in another way.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::keyEvent):
    (WebKit::getScrollMapping):
    (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
    * WebProcess/WebPage/WebPage.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64091 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 6ed4b07..f3b38e0 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,23 @@
 
         Reviewed by Anders Carlsson.
 
+        Part 2 of https://bugs.webkit.org/show_bug.cgi?id=43013
+        <rdar://problem/8152434>
+        Add support for scrolling using the keyboard in WebKit2
+
+        Add support for scrolling with the space bar and ensure that we don't scroll
+        if WebCore is handling the event in another way.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::keyEvent):
+        (WebKit::getScrollMapping):
+        (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
+        * WebProcess/WebPage/WebPage.h:
+
+2010-07-26  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
         Patch for https://bugs.webkit.org/show_bug.cgi?id=43013
         Part of <rdar://problem/8152434>
         Add support for scrolling using the keyboard in WebKit2
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index fe25ea2..ac1eacf 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -344,50 +344,6 @@ void WebPage::wheelEvent(const WebWheelEvent& wheelEvent)
     m_mainFrame->coreFrame()->eventHandler()->handleWheelEvent(platformWheelEvent);
 }
 
-static bool getScrollMapping(const WebKeyboardEvent& event, ScrollDirection& direction, ScrollGranularity& granularity)
-{
-    if (event.type() != WebEvent::KeyDown && event.type() != WebEvent::RawKeyDown)
-        return false;
-
-    switch (event.windowsVirtualKeyCode()) {
-    case VK_LEFT:
-        granularity = ScrollByLine;
-        direction = ScrollLeft;
-        break;
-    case VK_RIGHT:
-        granularity = ScrollByLine;
-        direction = ScrollRight;
-        break;
-    case VK_UP:
-        granularity = ScrollByLine;
-        direction = ScrollUp;
-        break;
-    case VK_DOWN:
-        granularity = ScrollByLine;
-        direction = ScrollDown;
-        break;
-    case VK_HOME:
-        granularity = ScrollByDocument;
-        direction = ScrollUp;
-        break;
-    case VK_END:
-        granularity = ScrollByDocument;
-        direction = ScrollDown;
-        break;
-    case VK_PRIOR:
-        granularity = ScrollByPage;
-        direction = ScrollUp;
-        break;
-    case VK_NEXT:
-        granularity = ScrollByPage;
-        direction = ScrollDown;
-        break;
-    default:
-        return false;
-    }
-
-    return true;
-}
 
 void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
 {
@@ -399,14 +355,10 @@ void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
         return;
 
     PlatformKeyboardEvent platformKeyboardEvent = platform(keyboardEvent);
+    if (m_page->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(platformKeyboardEvent))
+        return;
 
-    Frame* frame = m_page->focusController()->focusedOrMainFrame();
-    frame->eventHandler()->keyEvent(platformKeyboardEvent);
-
-    ScrollDirection direction;
-    ScrollGranularity granularity;
-    if (getScrollMapping(keyboardEvent, direction, granularity))
-        frame->eventHandler()->scrollRecursively(direction, granularity);
+    performDefaultBehaviorForKeyEvent(keyboardEvent);
 }
 
 void WebPage::setActive(bool isActive)
@@ -498,6 +450,63 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
     return frame->editor()->insertText(evt->keyEvent()->text(), evt);
 }
 
+static bool getScrollMapping(const WebKeyboardEvent& event, ScrollDirection& direction, ScrollGranularity& granularity)
+{
+    if (event.type() != WebEvent::KeyDown && event.type() != WebEvent::RawKeyDown)
+        return false;
+
+    switch (event.windowsVirtualKeyCode()) {
+    case VK_SPACE:
+        granularity = ScrollByPage;
+        direction = event.shiftKey() ? ScrollUp : ScrollDown;
+        break;
+    case VK_LEFT:
+        granularity = ScrollByLine;
+        direction = ScrollLeft;
+        break;
+    case VK_RIGHT:
+        granularity = ScrollByLine;
+        direction = ScrollRight;
+        break;
+    case VK_UP:
+        granularity = ScrollByLine;
+        direction = ScrollUp;
+        break;
+    case VK_DOWN:
+        granularity = ScrollByLine;
+        direction = ScrollDown;
+        break;
+    case VK_HOME:
+        granularity = ScrollByDocument;
+        direction = ScrollUp;
+        break;
+    case VK_END:
+        granularity = ScrollByDocument;
+        direction = ScrollDown;
+        break;
+    case VK_PRIOR:
+        granularity = ScrollByPage;
+        direction = ScrollUp;
+        break;
+    case VK_NEXT:
+        granularity = ScrollByPage;
+        direction = ScrollDown;
+        break;
+    default:
+        return false;
+    }
+
+    return true;
+}
+
+void WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent)
+{
+    ScrollDirection direction;
+    ScrollGranularity granularity;
+    if (getScrollMapping(keyboardEvent, direction, granularity))
+        m_page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity);
+}
+
 void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
 {
     if (messageID.is<CoreIPC::MessageClassDrawingArea>()) {
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 82b09b1..042304f 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -117,6 +117,7 @@ private:
 
     void platformInitialize();
     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
+    void performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
 
     // Actions
     void tryClose();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list