Changeset 54293 in webkit
- Timestamp:
- Feb 3, 2010 12:58:11 PM (14 years ago)
- Location:
- trunk/WebKit/win
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/win/ChangeLog
r54263 r54293 1 2010-02-03 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Steve Falkenburg. 4 5 Scroll does not work with IBM Thinkpad. 6 <https://bugs.webkit.org/show_bug.cgi?id=14227> 7 <rdar://7142545> 8 9 When initializing the WebView, add two scrollbar Windows inside of 10 our WebView, to allow it to receive WM_VSCROLL and WM_HSCROLL events. 11 (similar to what Firefox did in: <https://bugzilla.mozilla.org/show_bug.cgi?id=507222>. 12 13 Only do this if the user has installed some kind of Trackpoint driver, using an algorithm 14 like <https://bugzilla.mozilla.org/show_bug.cgi?id=514927>. 15 16 Also, add code to handle WM_HSCROLL and WM_VSCROLL messages to scroll 17 the WebView. 18 19 * WebView.cpp: 20 (WebView::verticalScroll): Handle the WM_VSCROLL messages, and scroll up and down 21 by lines or pages. 22 (WebView::horizontalScroll): Handle the WM_HSCROLL messages, and scroll left or right 23 by lines or pages. 24 (WebView::WebViewWndProc): Add cases for WM_VSCROLL and WM_HSCROLL. 25 (WebView::initWithFrame): Call shouldInitializeTrackPointHack, and if we should, create 26 vertical and horizontal scrollbars to receive WM_VSCROLL and WM_HSCROLL messages. 27 (WebView::shouldInitializeTrackPointHack): Check if there is a registry key for 28 the some kind of IBM Trackpoint driver. 29 * WebView.h: 30 1 31 2010-02-02 Steve Falkenburg <sfalken@apple.com> 2 32 -
trunk/WebKit/win/WebView.cpp
r53423 r54293 1589 1589 return coreFrame->eventHandler()->handleWheelEvent(wheelEvent); 1590 1590 } 1591 1592 bool WebView::verticalScroll(WPARAM wParam, LPARAM /*lParam*/) 1593 { 1594 ScrollDirection direction; 1595 ScrollGranularity granularity; 1596 switch (LOWORD(wParam)) { 1597 case SB_LINEDOWN: 1598 granularity = ScrollByLine; 1599 direction = ScrollDown; 1600 break; 1601 case SB_LINEUP: 1602 granularity = ScrollByLine; 1603 direction = ScrollUp; 1604 break; 1605 case SB_PAGEDOWN: 1606 granularity = ScrollByDocument; 1607 direction = ScrollDown; 1608 break; 1609 case SB_PAGEUP: 1610 granularity = ScrollByDocument; 1611 direction = ScrollUp; 1612 break; 1613 default: 1614 return false; 1615 break; 1616 } 1617 1618 Frame* frame = m_page->focusController()->focusedOrMainFrame(); 1619 return frame->eventHandler()->scrollRecursively(direction, granularity); 1620 } 1621 1622 bool WebView::horizontalScroll(WPARAM wParam, LPARAM /*lParam*/) 1623 { 1624 ScrollDirection direction; 1625 ScrollGranularity granularity; 1626 switch (LOWORD(wParam)) { 1627 case SB_LINELEFT: 1628 granularity = ScrollByLine; 1629 direction = ScrollLeft; 1630 break; 1631 case SB_LINERIGHT: 1632 granularity = ScrollByLine; 1633 direction = ScrollRight; 1634 break; 1635 case SB_PAGELEFT: 1636 granularity = ScrollByDocument; 1637 direction = ScrollLeft; 1638 break; 1639 case SB_PAGERIGHT: 1640 granularity = ScrollByDocument; 1641 direction = ScrollRight; 1642 break; 1643 default: 1644 return false; 1645 } 1646 1647 Frame* frame = m_page->focusController()->focusedOrMainFrame(); 1648 return frame->eventHandler()->scrollRecursively(direction, granularity); 1649 } 1650 1591 1651 1592 1652 bool WebView::execCommand(WPARAM wParam, LPARAM /*lParam*/) … … 2156 2216 2157 2217 __fallthrough; 2218 case WM_VSCROLL: 2219 handled = webView->verticalScroll(wParam, lParam); 2220 break; 2221 case WM_HSCROLL: 2222 handled = webView->horizontalScroll(wParam, lParam); 2223 break; 2158 2224 default: 2159 2225 handled = false; … … 2388 2454 initialized = true; 2389 2455 } 2456 2457 bool WebView::shouldInitializeTrackPointHack() 2458 { 2459 static bool shouldCreateScrollbars; 2460 static bool hasRunTrackPointCheck; 2461 2462 if (hasRunTrackPointCheck) 2463 return shouldCreateScrollbars; 2464 2465 hasRunTrackPointCheck = true; 2466 const TCHAR trackPointKeys[][50] = { TEXT("Software\\Lenovo\\TrackPoint"), 2467 TEXT("Software\\Lenovo\\UltraNav"), 2468 TEXT("Software\\Alps\\Apoint\\TrackPoint"), 2469 TEXT("Software\\Synaptics\\SynTPEnh\\UltraNavUSB"), 2470 TEXT("Software\\Synaptics\\SynTPEnh\\UltraNavPS2") }; 2471 2472 for (int i = 0; i < 5; ++i) { 2473 HKEY trackPointKey; 2474 int readKeyResult = ::RegOpenKeyEx(HKEY_CURRENT_USER, trackPointKeys[i], 0, KEY_READ, &trackPointKey); 2475 ::RegCloseKey(trackPointKey); 2476 if (readKeyResult == ERROR_SUCCESS) { 2477 shouldCreateScrollbars = true; 2478 return shouldCreateScrollbars; 2479 } 2480 } 2481 2482 return shouldCreateScrollbars; 2483 } 2390 2484 2391 2485 HRESULT STDMETHODCALLTYPE WebView::initWithFrame( … … 2404 2498 frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top, m_hostWindow ? m_hostWindow : HWND_MESSAGE, 0, gInstance, 0); 2405 2499 ASSERT(::IsWindow(m_viewWindow)); 2500 2501 if (shouldInitializeTrackPointHack()) { 2502 // If we detected a registry key belonging to a TrackPoint driver, then create fake trackpoint 2503 // scrollbars, so the WebView will receive WM_VSCROLL and WM_HSCROLL messages. We create one 2504 // vertical scrollbar and one horizontal to allow for receiving both types of messages. 2505 ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTHSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_HORZ, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0); 2506 ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTVSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_VERT, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0); 2507 } 2406 2508 2407 2509 hr = registerDragDrop(); -
trunk/WebKit/win/WebView.h
r53423 r54293 794 794 void performContextMenuAction(WPARAM, LPARAM, bool byPosition); 795 795 bool mouseWheel(WPARAM, LPARAM, bool isMouseHWheel); 796 bool verticalScroll(WPARAM, LPARAM); 797 bool horizontalScroll(WPARAM, LPARAM); 796 798 bool gesture(WPARAM, LPARAM); 797 799 bool gestureNotify(WPARAM, LPARAM); … … 919 921 LRESULT onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*); 920 922 bool developerExtrasEnabled() const; 923 924 bool shouldInitializeTrackPointHack(); 921 925 922 926 // AllWebViewSet functions
Note: See TracChangeset
for help on using the changeset viewer.