Changeset 142808 in webkit
- Timestamp:
- Feb 13, 2013 2:54:39 PM (11 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r142782 r142808 1 2013-02-13 Alexandre Elias <aelias@chromium.org> 2 3 [chromium] Fix scaling in WebViewImpl::handleGestureEvent 4 https://bugs.webkit.org/show_bug.cgi?id=109671 5 6 Reviewed by James Robinson. 7 8 My last patch broke a bunch of things in handleGestureEvent that 9 assumed the event came in scaled, most notably tap highlight and 10 double-tap zoom. Switch those to PlatformGestureEvent. 11 12 * src/WebViewImpl.cpp: 13 (WebKit::WebViewImpl::handleGestureEvent): 14 (WebKit::WebViewImpl::bestTapNode): 15 (WebKit::WebViewImpl::enableTapHighlight): 16 * src/WebViewImpl.h: 17 (WebViewImpl): 18 * tests/LinkHighlightTest.cpp: 19 (WebCore::TEST): 20 1 21 2013-02-13 Eberhard Graether <egraether@google.com> 2 22 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r142782 r142808 697 697 bool eventCancelled = false; // for disambiguation 698 698 699 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); 700 699 701 // Handle link highlighting outside the main switch to avoid getting lost in the 700 702 // complicated set of cases handled below. … … 704 706 #if OS(LINUX) 705 707 if (settingsImpl()->gestureTapHighlightEnabled()) 706 enableT ouchHighlight(event);708 enableTapHighlight(platformEvent); 707 709 #endif 708 710 break; … … 722 724 break; 723 725 m_client->cancelScheduledContentIntents(); 724 m_positionOnFlingStart = WebPoint(event.x, event.y);725 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY);726 m_positionOnFlingStart = platformEvent.position(); 727 m_globalPositionOnFlingStart = platformEvent.globalPosition(); 726 728 m_flingModifier = event.modifiers; 727 729 m_flingSourceDevice = event.sourceDevice; … … 742 744 case WebInputEvent::GestureTap: { 743 745 m_client->cancelScheduledContentIntents(); 744 if (detectContentOnTouch( WebPoint(event.x, event.y))) {746 if (detectContentOnTouch(platformEvent.position())) { 745 747 eventSwallowed = true; 746 748 break; … … 757 759 // FIXME: didTapMultipleTargets should just take a rect instead of 758 760 // an event. 759 WebGestureEvent scaledEvent ;761 WebGestureEvent scaledEvent = event; 760 762 scaledEvent.x = event.x / pageScaleFactor(); 761 763 scaledEvent.y = event.y / pageScaleFactor(); … … 774 776 } 775 777 776 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);777 778 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); 778 779 … … 796 797 m_page->contextMenuController()->clearContextMenu(); 797 798 m_contextMenuAllowed = true; 798 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);799 799 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); 800 800 m_contextMenuAllowed = false; … … 804 804 case WebInputEvent::GestureTapDown: { 805 805 m_client->cancelScheduledContentIntents(); 806 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);807 806 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); 808 807 break; … … 811 810 if (m_webSettings->doubleTapToZoomEnabled() && m_minimumPageScaleFactor != m_maximumPageScaleFactor) { 812 811 m_client->cancelScheduledContentIntents(); 813 animateZoomAroundPoint( WebPoint(event.x, event.y), DoubleTap);812 animateZoomAroundPoint(platformEvent.position(), DoubleTap); 814 813 eventSwallowed = true; 815 814 break; … … 824 823 case WebInputEvent::GesturePinchEnd: 825 824 case WebInputEvent::GesturePinchUpdate: { 826 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);827 825 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); 828 826 break; … … 1271 1269 } 1272 1270 1273 Node* WebViewImpl::bestT ouchLinkNode(const WebGestureEvent& touchEvent)1271 Node* WebViewImpl::bestTapNode(const PlatformGestureEvent& tapEvent) 1274 1272 { 1275 1273 if (!m_page || !m_page->mainFrame()) … … 1278 1276 Node* bestTouchNode = 0; 1279 1277 1280 IntSize touchEventSearchRegionSize(touchEvent.data.tapDown.width / 2, touchEvent.data.tapDown.height / 2); 1281 IntPoint touchEventLocation(touchEvent.x, touchEvent.y); 1278 IntPoint touchEventLocation(tapEvent.position()); 1282 1279 #if ENABLE(TOUCH_ADJUSTMENT) 1283 m_page->mainFrame()->eventHandler()->adjustGesturePosition( PlatformGestureEventBuilder(mainFrameImpl()->frameView(), touchEvent), touchEventLocation);1280 m_page->mainFrame()->eventHandler()->adjustGesturePosition(tapEvent, touchEventLocation); 1284 1281 #endif 1285 1282 … … 1291 1288 // Make sure our highlight candidate uses a hand cursor as a heuristic to 1292 1289 // choose appropriate targets. 1293 bool shiftKey = touchEvent.modifiers & WebGestureEvent::ShiftKey; 1294 while (bestTouchNode && !invokesHandCursor(bestTouchNode, shiftKey, m_page->mainFrame())) 1290 while (bestTouchNode && !invokesHandCursor(bestTouchNode, false, m_page->mainFrame())) 1295 1291 bestTouchNode = bestTouchNode->parentNode(); 1296 1292 1297 1293 // We should pick the largest enclosing node with hand cursor set. 1298 while (bestTouchNode && bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->parentNode(), shiftKey, m_page->mainFrame()))1294 while (bestTouchNode && bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->parentNode(), false, m_page->mainFrame())) 1299 1295 bestTouchNode = bestTouchNode->parentNode(); 1300 1296 … … 1302 1298 } 1303 1299 1304 void WebViewImpl::enableT ouchHighlight(const WebGestureEvent& touchEvent)1300 void WebViewImpl::enableTapHighlight(const PlatformGestureEvent& tapEvent) 1305 1301 { 1306 1302 // Always clear any existing highlight when this is invoked, even if we don't get a new target to highlight. 1307 1303 m_linkHighlight.clear(); 1308 1304 1309 Node* touchNode = bestT ouchLinkNode(touchEvent);1305 Node* touchNode = bestTapNode(tapEvent); 1310 1306 1311 1307 if (!touchNode || !touchNode->renderer() || !touchNode->renderer()->enclosingLayer()) -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r142782 r142808 577 577 #if ENABLE(GESTURE_EVENTS) 578 578 void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll, bool& isAnchor); 579 WebCore::Node* bestT ouchLinkNode(const WebGestureEvent& touchEvent);580 void enableT ouchHighlight(const WebGestureEvent& touchEvent);579 WebCore::Node* bestTapNode(const WebCore::PlatformGestureEvent& tapEvent); 580 void enableTapHighlight(const WebCore::PlatformGestureEvent& tapEvent); 581 581 void computeScaleAndScrollForFocusedNode(WebCore::Node* focusedNode, float& scale, WebCore::IntPoint& scroll, bool& needAnimation); 582 582 #endif -
trunk/Source/WebKit/chromium/tests/LinkHighlightTest.cpp
r139904 r142808 28 28 29 29 #include "FrameTestHelpers.h" 30 #include "FrameView.h" 30 31 #include "IntRect.h" 31 32 #include "Node.h" … … 33 34 #include "WebCompositorInitializer.h" 34 35 #include "WebFrame.h" 36 #include "WebFrameImpl.h" 35 37 #include "WebInputEvent.h" 38 #include "WebInputEventConversion.h" 36 39 #include "WebViewImpl.h" 37 40 #include <gtest/gtest.h> … … 67 70 touchEvent.x = 20; 68 71 touchEvent.y = 20; 69 Node* touchNode = webViewImpl->bestTouchLinkNode(touchEvent); 70 ASSERT_TRUE(touchNode); 72 73 { 74 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent); 75 Node* touchNode = webViewImpl->bestTapNode(platformEvent); 76 ASSERT_TRUE(touchNode); 77 } 71 78 72 79 touchEvent.y = 40; 73 EXPECT_FALSE(webViewImpl->bestTouchLinkNode(touchEvent)); 80 { 81 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent); 82 EXPECT_FALSE(webViewImpl->bestTapNode(platformEvent)); 83 } 74 84 75 85 touchEvent.y = 20; 76 86 // Shouldn't crash. 77 87 78 webViewImpl->enableTouchHighlight(touchEvent); 88 { 89 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent); 90 webViewImpl->enableTapHighlight(platformEvent); 91 } 92 79 93 EXPECT_TRUE(webViewImpl->linkHighlight()); 80 94 EXPECT_TRUE(webViewImpl->linkHighlight()->contentLayer()); … … 84 98 85 99 touchEvent.y = 100; 86 webViewImpl->enableTouchHighlight(touchEvent); 100 { 101 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent); 102 webViewImpl->enableTapHighlight(platformEvent); 103 } 104 87 105 ASSERT_TRUE(webViewImpl->linkHighlight()); 88 106 89 107 // Don't highlight if no "hand cursor" 90 108 touchEvent.y = 220; // An A-link with cross-hair cursor. 91 webViewImpl->enableTouchHighlight(touchEvent); 109 { 110 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent); 111 webViewImpl->enableTapHighlight(platformEvent); 112 } 92 113 ASSERT_FALSE(webViewImpl->linkHighlight()); 93 114 94 115 touchEvent.y = 260; // A text input box. 95 webViewImpl->enableTouchHighlight(touchEvent); 116 { 117 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent); 118 webViewImpl->enableTapHighlight(platformEvent); 119 } 96 120 ASSERT_FALSE(webViewImpl->linkHighlight()); 97 121
Note: See TracChangeset
for help on using the changeset viewer.