Bug 49830

Summary: WebKit2: Add Trackpoint driver hack to support IBM trackpads
Product: WebKit Reporter: Sam Weinig <sam>
Component: WebKit2Assignee: Brian Weinstein <bweinstein>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-ews
Priority: P2 Keywords: InRadar, PlatformOnly
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Attachments:
Description Flags
[PATCH] Fix
aroben: review+
[PATCH] Fix v2 aroben: review+

Description Sam Weinig 2010-11-19 14:03:00 PST
We need to add the Trackpoint driver hack to support IBM trackpads that we had in WebKit1.
Comment 1 Sam Weinig 2010-11-29 09:29:49 PST
<rdar://problem/8705951>
Comment 2 Brian Weinstein 2011-03-24 12:30:39 PDT
Created attachment 86809 [details]
[PATCH] Fix
Comment 3 Adam Roben (:aroben) 2011-03-24 12:37:47 PDT
Comment on attachment 86809 [details]
[PATCH] Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=86809&action=review

> Source/WebKit2/UIProcess/win/WebView.cpp:294
> +        // trackpoint scrollbars, so the WebView will receive WM_VSCROLl and WM_HSCROLL messages.

They aren't "trackpoint scrollbars", they're just normal Windows scrollbars.

WM_VSCROLl should be WM_VSCROLL.

> Source/WebKit2/UIProcess/win/WebView.cpp:742
> +    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") };

I'd put the first key on its own line, and put the closing brace and semicolon on their own line.

I think a better type for trackPointKeys would be: const wchar_t* trackPointKeys[].

You should use L instead of TEXT().

> Source/WebKit2/UIProcess/win/WebView.cpp:744
> +    for (int i = 0; i < 5; ++i) {

WTF_ARRAY_LENGTH

> Source/WebKit2/UIProcess/win/WebView.cpp:746
> +        int readKeyResult = ::RegOpenKeyEx(HKEY_CURRENT_USER, trackPointKeys[i], 0, KEY_READ, &trackPointKey);

You should use ::RegOpenKeyExW.

> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:336
> +void WebPage::scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity)
> +{
> +    scroll(m_page.get(), static_cast<ScrollDirection>(scrollDirection), static_cast<ScrollGranularity>(scrollGranularity));
> +}

Why is this code duplicated in WebPageMac and WebPageWin? Just put it in WebPage.cpp.

We should probably check that the uint32_ts we get are in the correct range. You could use helper functions to do that (like toScrollDirection and toScrollGranularity).
Comment 4 Early Warning System Bot 2011-03-24 12:42:38 PDT
Attachment 86809 [details] did not build on qt:
Build output: http://queues.webkit.org/results/8235541
Comment 5 Brian Weinstein 2011-03-24 13:35:27 PDT
Created attachment 86821 [details]
[PATCH] Fix v2
Comment 6 Adam Roben (:aroben) 2011-03-24 13:38:00 PDT
Comment on attachment 86821 [details]
[PATCH] Fix v2

View in context: https://bugs.webkit.org/attachment.cgi?id=86821&action=review

> Source/WebKit2/UIProcess/win/WebView.cpp:294
> +        // scrollbars, so the WebView will receive WM_VSCROLl and WM_HSCROLL messages.

WM_VSCROLl should be WM_VSCROLL.

> Source/WebKit2/UIProcess/win/WebView.cpp:746
> +    for (int i = 0; i < WTF_ARRAY_LENGTH(trackPointKeys); ++i) {

i should be a size_t.
Comment 7 Brian Weinstein 2011-03-24 13:48:22 PDT
Landed in r81895.
Comment 8 Darin Adler 2011-03-24 17:44:50 PDT
Comment on attachment 86809 [details]
[PATCH] Fix

This breaks the Qt build by adding scrollBy but not implementing it for Qt. Probably same for GTK.
Comment 9 Brian Weinstein 2011-03-24 18:15:41 PDT
(In reply to comment #8)
> (From update of attachment 86809 [details])
> This breaks the Qt build by adding scrollBy but not implementing it for Qt. Probably same for GTK.

The second patch I uploaded and landed put scrollBy in a cross-platform location and seemed to build fine on Qt. Thanks for catching that though!