[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.20-204-g221d8e8

bweinstein at apple.com bweinstein at apple.com
Wed Feb 10 22:11:20 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 473854d2e9d6a46a8697f2e23224f4ea9cbfb4a2
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 3 20:58:11 2010 +0000

    Scroll does not work with IBM Thinkpad.
    <https://bugs.webkit.org/show_bug.cgi?id=14227>
    <rdar://7142545>
    
    Reviewed by Steve Falkenburg.
    
    When initializing the WebView, add two scrollbar Windows inside of
    our WebView, to allow it to receive WM_VSCROLL and WM_HSCROLL events.
    (similar to what Firefox did in: <https://bugzilla.mozilla.org/show_bug.cgi?id=507222>.
    
    Only do this if the user has installed some kind of Trackpoint driver, using an algorithm
    like <https://bugzilla.mozilla.org/show_bug.cgi?id=514927>.
    
    Also, add code to handle WM_HSCROLL and WM_VSCROLL messages to scroll
    the WebView.
    
    * WebView.cpp:
    (WebView::verticalScroll): Handle the WM_VSCROLL messages, and scroll up and down
        by lines or pages.
    (WebView::horizontalScroll): Handle the WM_HSCROLL messages, and scroll left or right
        by lines or pages.
    (WebView::WebViewWndProc): Add cases for WM_VSCROLL and WM_HSCROLL.
    (WebView::initWithFrame): Call shouldInitializeTrackPointHack, and if we should, create
        vertical and horizontal scrollbars to receive WM_VSCROLL and WM_HSCROLL messages.
    (WebView::shouldInitializeTrackPointHack): Check if there is a registry key for
        the some kind of IBM Trackpoint driver.
    * WebView.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54293 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index ef08bf3..36d3144 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,33 @@
+2010-02-03  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Steve Falkenburg.
+
+        Scroll does not work with IBM Thinkpad.
+        <https://bugs.webkit.org/show_bug.cgi?id=14227>
+        <rdar://7142545>
+        
+        When initializing the WebView, add two scrollbar Windows inside of
+        our WebView, to allow it to receive WM_VSCROLL and WM_HSCROLL events.
+        (similar to what Firefox did in: <https://bugzilla.mozilla.org/show_bug.cgi?id=507222>.
+        
+        Only do this if the user has installed some kind of Trackpoint driver, using an algorithm
+        like <https://bugzilla.mozilla.org/show_bug.cgi?id=514927>.
+        
+        Also, add code to handle WM_HSCROLL and WM_VSCROLL messages to scroll
+        the WebView.
+
+        * WebView.cpp:
+        (WebView::verticalScroll): Handle the WM_VSCROLL messages, and scroll up and down
+            by lines or pages.
+        (WebView::horizontalScroll): Handle the WM_HSCROLL messages, and scroll left or right
+            by lines or pages.
+        (WebView::WebViewWndProc): Add cases for WM_VSCROLL and WM_HSCROLL.
+        (WebView::initWithFrame): Call shouldInitializeTrackPointHack, and if we should, create
+            vertical and horizontal scrollbars to receive WM_VSCROLL and WM_HSCROLL messages.
+        (WebView::shouldInitializeTrackPointHack): Check if there is a registry key for
+            the some kind of IBM Trackpoint driver.
+        * WebView.h:
+
 2010-02-02  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 4d67110..6144532 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -1589,6 +1589,66 @@ bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel)
     return coreFrame->eventHandler()->handleWheelEvent(wheelEvent);
 }
 
+bool WebView::verticalScroll(WPARAM wParam, LPARAM /*lParam*/)
+{
+    ScrollDirection direction;
+    ScrollGranularity granularity;
+    switch (LOWORD(wParam)) {
+    case SB_LINEDOWN:
+        granularity = ScrollByLine;
+        direction = ScrollDown;
+        break;
+    case SB_LINEUP:
+        granularity = ScrollByLine;
+        direction = ScrollUp;
+        break;
+    case SB_PAGEDOWN:
+        granularity = ScrollByDocument;
+        direction = ScrollDown;
+        break;
+    case SB_PAGEUP:
+        granularity = ScrollByDocument;
+        direction = ScrollUp;
+        break;
+    default:
+        return false;
+        break;
+    }
+    
+    Frame* frame = m_page->focusController()->focusedOrMainFrame();
+    return frame->eventHandler()->scrollRecursively(direction, granularity);
+}
+
+bool WebView::horizontalScroll(WPARAM wParam, LPARAM /*lParam*/)
+{
+    ScrollDirection direction;
+    ScrollGranularity granularity;
+    switch (LOWORD(wParam)) {
+    case SB_LINELEFT:
+        granularity = ScrollByLine;
+        direction = ScrollLeft;
+        break;
+    case SB_LINERIGHT:
+        granularity = ScrollByLine;
+        direction = ScrollRight;
+        break;
+    case SB_PAGELEFT:
+        granularity = ScrollByDocument;
+        direction = ScrollLeft;
+        break;
+    case SB_PAGERIGHT:
+        granularity = ScrollByDocument;
+        direction = ScrollRight;
+        break;
+    default:
+        return false;
+    }
+
+    Frame* frame = m_page->focusController()->focusedOrMainFrame();
+    return frame->eventHandler()->scrollRecursively(direction, granularity);
+}
+
+
 bool WebView::execCommand(WPARAM wParam, LPARAM /*lParam*/)
 {
     Frame* frame = m_page->focusController()->focusedOrMainFrame();
@@ -2155,6 +2215,12 @@ LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam,
                 break;
 
             __fallthrough;
+        case WM_VSCROLL:
+            handled = webView->verticalScroll(wParam, lParam);
+            break;
+        case WM_HSCROLL:
+            handled = webView->horizontalScroll(wParam, lParam);
+            break;
         default:
             handled = false;
             break;
@@ -2387,6 +2453,34 @@ static void WebKitSetApplicationCachePathIfNecessary()
 
     initialized = true;
 }
+
+bool WebView::shouldInitializeTrackPointHack()
+{
+    static bool shouldCreateScrollbars;
+    static bool hasRunTrackPointCheck;
+
+    if (hasRunTrackPointCheck)
+        return shouldCreateScrollbars;
+
+    hasRunTrackPointCheck = true;
+    const TCHAR trackPointKeys[][50] = { TEXT("Software\\Lenovo\\TrackPoint"),
+        TEXT("Software\\Lenovo\\UltraNav"),
+        TEXT("Software\\Alps\\Apoint\\TrackPoint"),
+        TEXT("Software\\Synaptics\\SynTPEnh\\UltraNavUSB"),
+        TEXT("Software\\Synaptics\\SynTPEnh\\UltraNavPS2") };
+
+    for (int i = 0; i < 5; ++i) {
+        HKEY trackPointKey;
+        int readKeyResult = ::RegOpenKeyEx(HKEY_CURRENT_USER, trackPointKeys[i], 0, KEY_READ, &trackPointKey);
+        ::RegCloseKey(trackPointKey);
+        if (readKeyResult == ERROR_SUCCESS) {
+            shouldCreateScrollbars = true;
+            return shouldCreateScrollbars;
+        }
+    }
+
+    return shouldCreateScrollbars;
+}
     
 HRESULT STDMETHODCALLTYPE WebView::initWithFrame( 
     /* [in] */ RECT frame,
@@ -2404,6 +2498,14 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
         frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top, m_hostWindow ? m_hostWindow : HWND_MESSAGE, 0, gInstance, 0);
     ASSERT(::IsWindow(m_viewWindow));
 
+    if (shouldInitializeTrackPointHack()) {
+        // If we detected a registry key belonging to a TrackPoint driver, then create fake trackpoint
+        // scrollbars, so the WebView will receive WM_VSCROLL and WM_HSCROLL messages. We create one
+        // vertical scrollbar and one horizontal to allow for receiving both types of messages.
+        ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTHSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_HORZ, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0);
+        ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTVSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_VERT, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0);
+    }
+
     hr = registerDragDrop();
     if (FAILED(hr))
         return hr;
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
index cd857a8..56fb40c 100644
--- a/WebKit/win/WebView.h
+++ b/WebKit/win/WebView.h
@@ -793,6 +793,8 @@ public:
     bool onUninitMenuPopup(WPARAM, LPARAM);
     void performContextMenuAction(WPARAM, LPARAM, bool byPosition);
     bool mouseWheel(WPARAM, LPARAM, bool isMouseHWheel);
+    bool verticalScroll(WPARAM, LPARAM);
+    bool horizontalScroll(WPARAM, LPARAM);
     bool gesture(WPARAM, LPARAM);
     bool gestureNotify(WPARAM, LPARAM);
     bool execCommand(WPARAM wParam, LPARAM lParam);
@@ -919,6 +921,8 @@ protected:
     LRESULT onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*);
     bool developerExtrasEnabled() const;
 
+    bool shouldInitializeTrackPointHack();
+
     // AllWebViewSet functions
     void addToAllWebViewsSet();
     void removeFromAllWebViewsSet();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list