Changeset 83113 in webkit
- Timestamp:
- Apr 6, 2011 3:38:43 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r83108 r83113 1 2011-04-06 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Adam Roben. 4 5 WebKit2: Support Windows 7 Gestures 6 https://bugs.webkit.org/show_bug.cgi?id=49824 7 <rdar://problem/8689728> 8 9 Move WindowTouch.h from WebKit/win, so it can be used in both WebKit and WebKit2. 10 11 * WebCore.vcproj/WebCore.vcproj: 12 * platform/win/WindowsTouch.h: Copied from WebKit/win/WindowsTouch.h. 13 1 14 2011-04-06 Alexis Menard <alexis.menard@openbossa.org> 2 15 -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r83079 r83113 26569 26569 > 26570 26570 </File> 26571 <File 26572 RelativePath="..\platform\win\WindowsTouch.h" 26573 > 26574 </File> 26571 26575 </Filter> 26572 26576 <Filter -
trunk/Source/WebKit/win/ChangeLog
r82962 r83113 1 2011-04-06 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Adam Roben. 4 5 WebKit2: Support Windows 7 Gestures 6 https://bugs.webkit.org/show_bug.cgi?id=49824 7 <rdar://problem/8689728> 8 9 Move WindowsTouch.h from WebKit/win to WebCore/platform/win, so it can be 10 used in both WebKit and WebKit2. 11 12 * WebKit.vcproj/WebKit.vcproj: Remove WindowsTouch.h. 13 * WebView.cpp: Include WindowsTouch.h from WebCore instead of WebKit. 14 * WindowsTouch.h: Removed. 15 1 16 2011-04-05 Martin Robinson <mrobinson@igalia.com> 2 17 -
trunk/Source/WebKit/win/WebKit.vcproj/WebKit.vcproj
r82477 r83113 700 700 > 701 701 </File> 702 <File703 RelativePath="..\WindowsTouch.h"704 >705 </File>706 702 </Filter> 707 703 <Filter -
trunk/Source/WebKit/win/WebView.cpp
r82870 r83113 59 59 #include "WebPreferences.h" 60 60 #include "WebScriptWorld.h" 61 #include "WindowsTouch.h"62 61 #include "resource.h" 63 62 #include <JavaScriptCore/APICast.h> … … 132 131 #include <WebCore/TypingCommand.h> 133 132 #include <WebCore/WindowMessageBroadcaster.h> 133 #include <WebCore/WindowsTouch.h> 134 134 #include <wtf/Threading.h> 135 135 -
trunk/Source/WebKit2/ChangeLog
r83110 r83113 1 2011-04-06 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Adam Roben. 4 5 WebKit2: Support Windows 7 Gestures 6 https://bugs.webkit.org/show_bug.cgi?id=49824 7 <rdar://problem/8689728> 8 9 Port code from WebKit1 -> WebKit2 to handle Windows 7 gestures. 10 11 The UIProcess gets a WM_GESTURENOTIFY message, it sends a sync message to the WebProcess to ask 12 if we should allow panning. The WebProcess checks if we're in a scrollable area, and the mouse 13 isn't over a scrollbar. 14 15 The UIProcess then gets a WM_GESTURE message, and if it is a pan gesture, it sends a message to 16 the WebProcess to scroll by the amount fingers have moved since the last WM_GESTURE messeage. The 17 X and Y are reversed because panning up -> moving the page down, and vice versa. 18 19 * UIProcess/WebPageProxy.cpp: 20 (WebKit::WebPageProxy::gestureWillBegin): Send a sync message to the WebProcess 21 to initialize the gesture. The WebProcess returns whether or not we can start a pan 22 gesture from where we are. 23 (WebKit::WebPageProxy::gestureDidScroll): Send a message to the WebProcess to scroll by 24 pan gesture. 25 (WebKit::WebPageProxy::gestureDidEnd): Send a message to the WebProcess that the gesture has ended. 26 * UIProcess/WebPageProxy.h: 27 * UIProcess/win/WebView.cpp: 28 (WebKit::WebView::wndProc): Add WM_GESTURE and WM_GESTURENOTIFY handlers. 29 (WebKit::WebView::WebView): Initialize two new variables. 30 (WebKit::WebView::onGestureNotify): Figure out which gestures we should support based on where 31 the gesture is beginning. 32 (WebKit::WebView::onGesture): Support starting a gesture, ending a gesture, and panning. 33 * UIProcess/win/WebView.h: 34 * WebProcess/WebPage/WebPage.h: 35 * WebProcess/WebPage/WebPage.messages.in: Add messages needed for gestures. 36 * WebProcess/WebPage/win/WebPageWin.cpp: 37 (WebKit::WebPage::gestureWillBegin): Set the node that the gesture started on (so we 38 know which layer to scroll if the user pans), and determine whether or not we should allow 39 panning. If the page can't scroll, or the user is on a scrollbar, disallow panning. 40 (WebKit::WebPage::gestureDidScroll): Scroll the enclosing layer of the element the gesture 41 started on. 42 (WebKit::WebPage::gestureDidEnd): Clear the node the gesture started on. 43 1 44 2011-04-06 Jeff Miller <jeffm@apple.com> 2 45 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r82970 r83113 668 668 return text; 669 669 } 670 671 bool WebPageProxy::gestureWillBegin(const IntPoint& point) 672 { 673 bool canBeginPanning; 674 process()->sendSync(Messages::WebPage::GestureWillBegin(point), Messages::WebPage::GestureWillBegin::Reply(canBeginPanning), m_pageID); 675 return canBeginPanning; 676 } 677 678 void WebPageProxy::gestureDidScroll(const IntSize& size) 679 { 680 process()->send(Messages::WebPage::GestureDidScroll(size), m_pageID); 681 } 682 683 void WebPageProxy::gestureDidEnd() 684 { 685 process()->send(Messages::WebPage::GestureDidEnd(), m_pageID); 686 } 670 687 #endif 671 688 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r83004 r83113 273 273 WebCore::IntRect firstRectForCharacterInSelectedRange(int); 274 274 String getSelectedText(); 275 276 bool gestureWillBegin(const WebCore::IntPoint&); 277 void gestureDidScroll(const WebCore::IntSize&); 278 void gestureDidEnd(); 275 279 #endif 276 280 #if ENABLE(TILED_BACKING_STORE) -
trunk/Source/WebKit2/UIProcess/win/WebView.cpp
r81895 r83113 52 52 #include <WebCore/WebCoreInstanceHandle.h> 53 53 #include <WebCore/WindowMessageBroadcaster.h> 54 #include <WebCore/WindowsTouch.h> 54 55 #include <wtf/text/WTFString.h> 55 56 … … 68 69 }; 69 70 71 // Soft link functions for gestures and panning. 72 SOFT_LINK_LIBRARY(USER32); 73 SOFT_LINK_OPTIONAL(USER32, GetGestureInfo, BOOL, WINAPI, (HGESTUREINFO, PGESTUREINFO)); 74 SOFT_LINK_OPTIONAL(USER32, SetGestureConfig, BOOL, WINAPI, (HWND, DWORD, UINT, PGESTURECONFIG, UINT)); 75 SOFT_LINK_OPTIONAL(USER32, CloseGestureInfoHandle, BOOL, WINAPI, (HGESTUREINFO)); 76 70 77 using namespace WebCore; 71 78 … … 157 164 case WM_VSCROLL: 158 165 lResult = onVerticalScroll(hWnd, message, wParam, lParam, handled); 166 break; 167 case WM_GESTURENOTIFY: 168 lResult = onGestureNotify(hWnd, message, wParam, lParam, handled); 169 break; 170 case WM_GESTURE: 171 lResult = onGesture(hWnd, message, wParam, lParam, handled); 159 172 break; 160 173 case WM_SYSKEYDOWN: … … 255 268 , m_findIndicatorCallback(0) 256 269 , m_findIndicatorCallbackContext(0) 270 , m_lastPanX(0) 271 , m_lastPanY(0) 257 272 { 258 273 registerWebViewWindowClass(); … … 478 493 479 494 handled = true; 495 return 0; 496 } 497 498 LRESULT WebView::onGestureNotify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) 499 { 500 // We shouldn't be getting any gesture messages without SetGestureConfig soft-linking correctly. 501 ASSERT(SetGestureConfigPtr()); 502 503 GESTURENOTIFYSTRUCT* gn = reinterpret_cast<GESTURENOTIFYSTRUCT*>(lParam); 504 505 POINT localPoint = { gn->ptsLocation.x, gn->ptsLocation.y }; 506 ::ScreenToClient(m_window, &localPoint); 507 508 bool canPan = m_page->gestureWillBegin(localPoint); 509 510 DWORD dwPanWant = GC_PAN | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER; 511 DWORD dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; 512 if (canPan) 513 dwPanWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; 514 else 515 dwPanBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; 516 517 GESTURECONFIG gc = { GID_PAN, dwPanWant, dwPanBlock }; 518 return SetGestureConfigPtr()(m_window, 0, 1, &gc, sizeof(gc)); 519 } 520 521 LRESULT WebView::onGesture(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) 522 { 523 ASSERT(GetGestureInfoPtr()); 524 ASSERT(CloseGestureInfoHandlePtr()); 525 526 if (!GetGestureInfoPtr() || !CloseGestureInfoHandlePtr()) { 527 handled = false; 528 return 0; 529 } 530 531 HGESTUREINFO gestureHandle = reinterpret_cast<HGESTUREINFO>(lParam); 532 GESTUREINFO gi = {0}; 533 gi.cbSize = sizeof(GESTUREINFO); 534 535 if (!GetGestureInfoPtr()(gestureHandle, &gi)) { 536 handled = false; 537 return 0; 538 } 539 540 switch (gi.dwID) { 541 case GID_BEGIN: 542 m_lastPanX = gi.ptsLocation.x; 543 m_lastPanY = gi.ptsLocation.y; 544 break; 545 case GID_END: 546 m_page->gestureDidEnd(); 547 break; 548 case GID_PAN: { 549 int currentX = gi.ptsLocation.x; 550 int currentY = gi.ptsLocation.y; 551 552 // Reverse the calculations because moving your fingers up should move the screen down, and 553 // vice-versa. 554 int deltaX = m_lastPanX - currentX; 555 int deltaY = m_lastPanY - currentY; 556 557 m_lastPanX = currentX; 558 m_lastPanY = currentY; 559 560 m_page->gestureDidScroll(IntSize(deltaX, deltaY)); 561 562 // FIXME <rdar://problem/9244367>: Support window bounce (both horizontal and vertical), 563 // if the uesr has scrolled past the end of the document. scollByPanGesture would need to 564 // be a sync message to support this, because we would need to know how far we scrolled 565 // past the end of the document. 566 567 CloseGestureInfoHandlePtr()(gestureHandle); 568 569 handled = true; 570 return 0; 571 } 572 default: 573 break; 574 } 575 576 // If we get to this point, the gesture has not been handled. We forward 577 // the call to DefWindowProc by returning false, and we don't need to 578 // to call CloseGestureInfoHandle. 579 // http://msdn.microsoft.com/en-us/library/dd353228(VS.85).aspx 580 handled = false; 480 581 return 0; 481 582 } -
trunk/Source/WebKit2/UIProcess/win/WebView.h
r82398 r83113 98 98 LRESULT onHorizontalScroll(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 99 99 LRESULT onVerticalScroll(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 100 LRESULT onGestureNotify(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 101 LRESULT onGesture(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 100 102 LRESULT onKeyEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 101 103 LRESULT onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); … … 220 222 // (see https://bugs.webkit.org/show_bug.cgi?id=29264) 221 223 DWORD m_lastDropEffect; 224 225 int m_lastPanX; 226 int m_lastPanY; 222 227 }; 223 228 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r83081 r83113 323 323 void firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect); 324 324 void getSelectedText(WTF::String&); 325 326 void gestureWillBegin(const WebCore::IntPoint& point, bool& canBeginPanning); 327 void gestureDidScroll(const WebCore::IntSize& size); 328 void gestureDidEnd(); 325 329 #endif 326 330 … … 570 574 // Our view's window (in the UI process). 571 575 HWND m_nativeWindow; 576 577 RefPtr<WebCore::Node> m_gestureTargetNode; 572 578 #endif 573 579 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r82733 r83113 202 202 FirstRectForCharacterInSelectedRange(uint64_t characterPosition) -> (WebCore::IntRect resultRect) 203 203 GetSelectedText() -> (WTF::String text) 204 205 GestureWillBegin(WebCore::IntPoint point) -> (bool canBeginPanning) 206 GestureDidScroll(WebCore::IntSize size) 207 GestureDidEnd() 204 208 #endif 205 209 #if PLATFORM(QT) -
trunk/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
r81895 r83113 34 34 #include <WebCore/Frame.h> 35 35 #include <WebCore/FrameView.h> 36 #include <WebCore/HitTestRequest.h> 37 #include <WebCore/HitTestResult.h> 36 38 #include <WebCore/KeyboardEvent.h> 37 39 #include <WebCore/Page.h> 38 40 #include <WebCore/PlatformKeyboardEvent.h> 41 #include <WebCore/RenderLayer.h> 42 #include <WebCore/RenderView.h> 39 43 #include <WebCore/ResourceHandle.h> 40 44 #include <WebCore/Settings.h> … … 352 356 } 353 357 358 void WebPage::gestureWillBegin(const WebCore::IntPoint& point, bool& canBeginPanning) 359 { 360 bool hitScrollbar = false; 361 362 HitTestRequest request(HitTestRequest::ReadOnly); 363 for (Frame* childFrame = m_page->mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) { 364 ScrollView* scollView = childFrame->view(); 365 if (!scollView) 366 break; 367 368 RenderView* renderView = childFrame->document()->renderView(); 369 if (!renderView) 370 break; 371 372 RenderLayer* layer = renderView->layer(); 373 if (!layer) 374 break; 375 376 HitTestResult result = scollView->windowToContents(point); 377 layer->hitTest(request, result); 378 m_gestureTargetNode = result.innerNode(); 379 380 if (!hitScrollbar) 381 hitScrollbar = result.scrollbar(); 382 } 383 384 if (hitScrollbar) { 385 canBeginPanning = false; 386 return; 387 } 388 389 if (!m_gestureTargetNode) { 390 canBeginPanning = false; 391 return; 392 } 393 394 for (RenderObject* renderer = m_gestureTargetNode->renderer(); renderer; renderer = renderer->parent()) { 395 if (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()) { 396 canBeginPanning = true; 397 return; 398 } 399 } 400 401 canBeginPanning = false; 402 } 403 404 void WebPage::gestureDidScroll(const WebCore::IntSize& size) 405 { 406 if (!m_gestureTargetNode || !m_gestureTargetNode->renderer() || !m_gestureTargetNode->renderer()->enclosingLayer()) 407 return; 408 409 m_gestureTargetNode->renderer()->enclosingLayer()->scrollByRecursively(size.width(), size.height()); 410 } 411 412 void WebPage::gestureDidEnd() 413 { 414 m_gestureTargetNode = nullptr; 415 } 416 354 417 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.