Changeset 44883 in webkit
- Timestamp:
- Jun 19, 2009 5:35:10 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r44881 r44883 1 2009-06-19 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Steve Falkenburg. 4 5 https://bugs.webkit.org/show_bug.cgi?id=26488 6 No Support for Single Finger or Two Finger Panning in Windows 7 7 8 The code in WebCore allows us to interpret a Pan gesture as 9 a mousewheel event, and we are able to reuse the scrolling code. 10 Another constructor was created in WheelEventWin which takes data 11 better suited to the pan guesture than what was currently there. 12 13 Unable to add tests to simulate touch behavior/gestures. 14 15 * platform/PlatformWheelEvent.h: 16 * platform/win/WheelEventWin.cpp: 17 1 18 2009-06-19 Chris Marrin <cmarrin@apple.com> 2 19 -
trunk/WebCore/platform/PlatformWheelEvent.h
r44404 r44883 100 100 #if PLATFORM(WIN) 101 101 PlatformWheelEvent(HWND, WPARAM, LPARAM, bool isMouseHWheel); 102 PlatformWheelEvent(HWND, float deltaX, float deltaY, float xLoc, float yLoc); 102 103 #endif 103 104 -
trunk/WebCore/platform/win/WheelEventWin.cpp
r41746 r44883 63 63 } 64 64 65 PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, float deltaX, float deltaY, float xLoc, float yLoc) 66 : m_isAccepted(false) 67 , m_shiftKey(false) 68 , m_ctrlKey(false) 69 , m_altKey(false) 70 , m_metaKey(false) 71 { 72 m_deltaX = deltaX; 73 m_deltaY = deltaY; 74 75 m_wheelTicksX = m_deltaX; 76 m_wheelTicksY = m_deltaY; 77 78 // Global Position is just x, y location of event 79 POINT point = {xLoc, yLoc}; 80 m_globalPosition = point; 81 82 // Position needs to be translated to our client 83 ScreenToClient(hWnd, &point); 84 m_position = point; 85 } 86 65 87 PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, bool isMouseHWheel) 66 88 : m_position(positionForEvent(hWnd, lParam)) -
trunk/WebKit/win/ChangeLog
r44846 r44883 1 2009-06-19 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Steve Falkenburg. 4 5 https://bugs.webkit.org/show_bug.cgi?id=26488 6 No Support for Single Finger or Two Finger Panning in Windows 7 7 8 The code in WebCore allows us to interpret a Pan gesture as 9 a mousewheel event, and we are able to reuse the scrolling code. 10 Another constructor was created in WheelEventWin which takes data 11 better suited to the pan guesture than what was currently there. 12 13 Unable to add tests to simulate touch behavior/gestures. 14 15 * platform/PlatformWheelEvent.h: 16 * platform/win/WheelEventWin.cpp: 17 1 18 2009-06-18 Adam Barth <abarth@webkit.org> 2 19 -
trunk/WebKit/win/WebKit.vcproj/WebKit.vcproj
r44399 r44883 738 738 > 739 739 </File> 740 <File 741 RelativePath="..\WindowsTouch.h" 742 > 743 </File> 740 744 </Filter> 741 745 <Filter -
trunk/WebKit/win/WebView.cpp
r44846 r44883 31 31 #include "DOMCoreClasses.h" 32 32 #include "MarshallingHelpers.h" 33 #include "SoftLinking.h" 33 34 #include "WebDatabaseManager.h" 34 35 #include "WebDocumentLoader.h" … … 51 52 #include "WebNotificationCenter.h" 52 53 #include "WebPreferences.h" 54 #include "WindowsTouch.h" 53 55 #pragma warning( push, 0 ) 54 56 #include <WebCore/ApplicationCacheStorage.h> … … 97 99 #include <WebCore/ResourceHandleClient.h> 98 100 #include <WebCore/ScriptValue.h> 101 #include <WebCore/Scrollbar.h> 99 102 #include <WebCore/ScrollbarTheme.h> 100 103 #include <WebCore/SecurityOrigin.h> … … 129 132 #include <tchar.h> 130 133 #include <windowsx.h> 134 135 // Soft link functions for gestures and panning feedback 136 SOFT_LINK_LIBRARY(USER32); 137 SOFT_LINK_OPTIONAL(USER32, GetGestureInfo, BOOL, WINAPI, (HGESTUREINFO, PGESTUREINFO)); 138 SOFT_LINK_OPTIONAL(USER32, SetGestureConfig, BOOL, WINAPI, (HWND, DWORD, UINT, PGESTURECONFIG, UINT)); 139 SOFT_LINK_OPTIONAL(USER32, CloseGestureInfoHandle, BOOL, WINAPI, (HGESTUREINFO)); 140 SOFT_LINK_LIBRARY(Uxtheme); 141 SOFT_LINK_OPTIONAL(Uxtheme, BeginPanningFeedback, BOOL, WINAPI, (HWND)); 142 SOFT_LINK_OPTIONAL(Uxtheme, EndPanningFeedback, BOOL, WINAPI, (HWND, BOOL)); 143 SOFT_LINK_OPTIONAL(Uxtheme, UpdatePanningFeedback, BOOL, WINAPI, (HWND, LONG, LONG, BOOL)); 131 144 132 145 using namespace WebCore; … … 300 313 , m_transparent(false) 301 314 , m_selectTrailingWhitespaceEnabled(false) 315 , m_lastPanX(0) 316 , m_lastPanY(0) 317 , m_xOverpan(0) 318 , m_yOverpan(0) 302 319 { 303 320 JSC::initializeThreading(); … … 1316 1333 } 1317 1334 1335 bool WebView::gestureNotify(WPARAM wParam, LPARAM lParam) 1336 { 1337 GESTURENOTIFYSTRUCT* gn = reinterpret_cast<GESTURENOTIFYSTRUCT*>(lParam); 1338 1339 Frame* coreFrame = core(m_mainFrame); 1340 if (!coreFrame) 1341 return false; 1342 1343 ScrollView* view = coreFrame->view(); 1344 if (!view) 1345 return false; 1346 1347 // If we don't have this function, we shouldn't be receiving this message 1348 ASSERT(SetGestureConfigPtr()); 1349 1350 DWORD dwPanWant; 1351 DWORD dwPanBlock; 1352 1353 // Translate gesture location to client to hit test on scrollbars 1354 POINT gestureBeginPoint = {gn->ptsLocation.x, gn->ptsLocation.y}; 1355 ScreenToClient(m_viewWindow, &gestureBeginPoint); 1356 1357 if (gestureBeginPoint.x > view->visibleWidth()) { 1358 // We are in the scrollbar, turn off panning, need to be able to drag the scrollbar 1359 dwPanWant = GC_PAN | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER; 1360 dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY | GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; 1361 } else { 1362 dwPanWant = GC_PAN | GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER; 1363 dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; 1364 } 1365 1366 GESTURECONFIG gc = { GID_PAN, dwPanWant , dwPanBlock } ; 1367 return SetGestureConfigPtr()(m_viewWindow, 0, 1, &gc, sizeof(GESTURECONFIG)); 1368 } 1369 1370 bool WebView::gesture(WPARAM wParam, LPARAM lParam) 1371 { 1372 // We want to bail out if we don't have either of these functions 1373 if (!GetGestureInfoPtr() || !CloseGestureInfoHandlePtr()) 1374 return false; 1375 1376 HGESTUREINFO gestureHandle = reinterpret_cast<HGESTUREINFO>(lParam); 1377 1378 GESTUREINFO gi = {0}; 1379 gi.cbSize = sizeof(GESTUREINFO); 1380 1381 if (!GetGestureInfoPtr()(gestureHandle, reinterpret_cast<PGESTUREINFO>(&gi))) 1382 return false; 1383 1384 switch (gi.dwID) { 1385 case GID_BEGIN: 1386 m_lastPanX = gi.ptsLocation.x; 1387 m_lastPanY = gi.ptsLocation.y; 1388 1389 CloseGestureInfoHandlePtr()(gestureHandle); 1390 break; 1391 case GID_PAN: { 1392 Frame* coreFrame = core(m_mainFrame); 1393 if (!coreFrame) { 1394 CloseGestureInfoHandlePtr()(gestureHandle); 1395 return false; 1396 } 1397 1398 ScrollView* view = coreFrame->view(); 1399 if (!view) { 1400 CloseGestureInfoHandlePtr()(gestureHandle); 1401 return false; 1402 } 1403 1404 Scrollbar* vertScrollbar = view->verticalScrollbar(); 1405 if (!vertScrollbar) { 1406 CloseGestureInfoHandlePtr()(gestureHandle); 1407 return true; //No panning of any kind when no vertical scrollbar, matches IE8 1408 } 1409 1410 // Where are the fingers currently? 1411 long currentX = gi.ptsLocation.x; 1412 long currentY = gi.ptsLocation.y; 1413 1414 // How far did we pan in each direction? 1415 long deltaX = currentX - m_lastPanX; 1416 long deltaY = currentY - m_lastPanY; 1417 1418 // Calculate the overpan for window bounce 1419 m_yOverpan -= m_lastPanY - currentY; 1420 m_xOverpan -= m_lastPanX - currentX; 1421 1422 // Update our class variables with updated values 1423 m_lastPanX = currentX; 1424 m_lastPanY = currentY; 1425 1426 // Represent the pan gesture as a mouse wheel event 1427 PlatformWheelEvent wheelEvent(m_viewWindow, deltaX, deltaY, currentX, currentY); 1428 coreFrame->eventHandler()->handleWheelEvent(wheelEvent); 1429 1430 if (!(UpdatePanningFeedbackPtr() && BeginPanningFeedbackPtr() && EndPanningFeedbackPtr())) { 1431 CloseGestureInfoHandlePtr()(gestureHandle); 1432 return true; 1433 } 1434 1435 // FIXME: Support Horizontal Window Bounce 1436 if (vertScrollbar->currentPos() == 0) 1437 UpdatePanningFeedbackPtr()(m_viewWindow, 0, m_yOverpan, gi.dwFlags & GF_INERTIA); 1438 else if (vertScrollbar->currentPos() >= vertScrollbar->maximum()) 1439 UpdatePanningFeedbackPtr()(m_viewWindow, 0, m_yOverpan, gi.dwFlags & GF_INERTIA); 1440 1441 if (gi.dwFlags & GF_BEGIN) { 1442 BeginPanningFeedbackPtr()(m_viewWindow); 1443 m_yOverpan = 0; 1444 } else if (gi.dwFlags & GF_END) { 1445 EndPanningFeedbackPtr()(m_viewWindow, true); 1446 m_yOverpan = 0; 1447 } 1448 1449 CloseGestureInfoHandlePtr()(gestureHandle); 1450 break; 1451 } 1452 default: 1453 // We have encountered an unknown gesture - return false to pass it to DefWindowProc 1454 CloseGestureInfoHandlePtr()(gestureHandle); 1455 break; 1456 } 1457 1458 return true; 1459 } 1460 1318 1461 bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel) 1319 1462 { … … 1699 1842 webView->setIsBeingDestroyed(); 1700 1843 webView->revokeDragDrop(); 1844 break; 1845 case WM_GESTURENOTIFY: 1846 handled = webView->gestureNotify(wParam, lParam); 1847 break; 1848 case WM_GESTURE: 1849 handled = webView->gesture(wParam, lParam); 1701 1850 break; 1702 1851 case WM_MOUSEMOVE: -
trunk/WebKit/win/WebView.h
r44271 r44883 743 743 void performContextMenuAction(WPARAM, LPARAM, bool byPosition); 744 744 bool mouseWheel(WPARAM, LPARAM, bool isMouseHWheel); 745 bool gesture(WPARAM, LPARAM); 746 bool gestureNotify(WPARAM, LPARAM); 745 747 bool execCommand(WPARAM wParam, LPARAM lParam); 746 748 bool keyDown(WPARAM, LPARAM, bool systemKeyDown = false); … … 912 914 913 915 OwnPtr<HashSet<WebCore::String> > m_embeddedViewMIMETypes; 916 917 //Variables needed to store gesture information 918 long m_lastPanX; 919 long m_lastPanY; 920 long m_xOverpan; 921 long m_yOverpan; 914 922 }; 915 923
Note: See TracChangeset
for help on using the changeset viewer.