Title: [146233] trunk/Source/WebKit/blackberry
Revision
146233
Author
[email protected]
Date
2013-03-19 12:14:23 -0700 (Tue, 19 Mar 2013)

Log Message

[BlackBerry] Don't handle keyboard scrolling shortcuts in webkit
https://bugs.webkit.org/show_bug.cgi?id=112716

Informally Reviewed by Mike Fenton ([email protected])
Patch by Chris Hutten-Czapski <[email protected]> on 2013-03-19
Reviewed by Rob Buis.

The comment is right, this isn't the correct place to handle keyboard
scrolling shortcuts. That's what we have clients for.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::keyEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (146232 => 146233)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-03-19 19:03:07 UTC (rev 146232)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-03-19 19:14:23 UTC (rev 146233)
@@ -4273,54 +4273,6 @@
         return d->focusedOrMainFrame()->loader()->reloadWithOverrideEncoding(encoding);
 }
 
-static void handleScrolling(unsigned character, WebPagePrivate* scroller)
-{
-    const int scrollFactor = 20;
-    int dx = 0, dy = 0;
-    switch (character) {
-    case KEYCODE_LEFT:
-        dx = -scrollFactor;
-        break;
-    case KEYCODE_RIGHT:
-        dx = scrollFactor;
-        break;
-    case KEYCODE_UP:
-        dy = -scrollFactor;
-        break;
-    case KEYCODE_DOWN:
-        dy = scrollFactor;
-        break;
-    case KEYCODE_PG_UP:
-        ASSERT(scroller);
-        dy = scrollFactor - scroller->actualVisibleSize().height();
-        break;
-    case KEYCODE_PG_DOWN:
-        ASSERT(scroller);
-        dy = scroller->actualVisibleSize().height() - scrollFactor;
-        break;
-    }
-
-    if (dx || dy) {
-        // Don't use the scrollBy function because it triggers the scroll as originating from BlackBerry
-        // but then it expects a separate invalidate which isn't sent in this case.
-        ASSERT(scroller && scroller->m_mainFrame && scroller->m_mainFrame->view());
-        IntPoint pos(scroller->scrollPosition() + IntSize(dx, dy));
-
-        // Prevent over scrolling for arrows and Page up/down.
-        if (pos.x() < 0)
-            pos.setX(0);
-        if (pos.y() < 0)
-            pos.setY(0);
-        if (pos.x() + scroller->actualVisibleSize().width() > scroller->contentsSize().width())
-            pos.setX(scroller->contentsSize().width() - scroller->actualVisibleSize().width());
-        if (pos.y() + scroller->actualVisibleSize().height() > scroller->contentsSize().height())
-            pos.setY(scroller->contentsSize().height() - scroller->actualVisibleSize().height());
-
-        scroller->m_mainFrame->view()->setScrollPosition(pos);
-        scroller->m_client->scrollChanged();
-    }
-}
-
 bool WebPage::keyEvent(const Platform::KeyboardEvent& keyboardEvent)
 {
     if (!d->m_mainFrame->view())
@@ -4331,16 +4283,7 @@
 
     ASSERT(d->m_page->focusController());
 
-    bool handled = d->m_inputHandler->handleKeyboardInput(keyboardEvent);
-
-    // This is hotkey handling and perhaps doesn't belong here.
-    if (!handled && keyboardEvent.type() == Platform::KeyboardEvent::KeyDown && !d->m_inputHandler->isInputMode() && !keyboardEvent.modifiers()) {
-        IntPoint previousPos = d->scrollPosition();
-        handleScrolling(keyboardEvent.character(), d);
-        handled = previousPos != d->scrollPosition();
-    }
-
-    return handled;
+    return d->m_inputHandler->handleKeyboardInput(keyboardEvent);
 }
 
 bool WebPage::deleteTextRelativeToCursor(unsigned int leftOffset, unsigned int rightOffset)

Modified: trunk/Source/WebKit/blackberry/ChangeLog (146232 => 146233)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-03-19 19:03:07 UTC (rev 146232)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-03-19 19:14:23 UTC (rev 146233)
@@ -1,3 +1,17 @@
+2013-03-19  Chris Hutten-Czapski  <[email protected]>
+
+        [BlackBerry] Don't handle keyboard scrolling shortcuts in webkit
+        https://bugs.webkit.org/show_bug.cgi?id=112716
+
+        Informally Reviewed by Mike Fenton ([email protected])
+        Reviewed by Rob Buis.
+
+        The comment is right, this isn't the correct place to handle keyboard
+        scrolling shortcuts. That's what we have clients for.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPage::keyEvent):
+
 2013-03-19  Andy Chen  <[email protected]>
 
         [BlackBerry] When selecting an object, assign focus to new node instead of clearing previous focused node
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to