Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: Source/WebCore/page/EventHandler.cpp

Issue 10988006: Merge 128999 - Do touch adjustment on GestureTapDown (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 { 2407 {
2408 // We don't use DoubleTap at the moment, it's mostly redundant with tap sinc e tap now contains 2408 // We don't use DoubleTap at the moment, it's mostly redundant with tap sinc e tap now contains
2409 // a tap count. FIXME: We should probably remove GestureDoubleTap (http://wk b.ug/93045). 2409 // a tap count. FIXME: We should probably remove GestureDoubleTap (http://wk b.ug/93045).
2410 if (gestureEvent.type() == PlatformEvent::GestureDoubleTap) 2410 if (gestureEvent.type() == PlatformEvent::GestureDoubleTap)
2411 return false; 2411 return false;
2412 2412
2413 Node* eventTarget = 0; 2413 Node* eventTarget = 0;
2414 if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || gestureEvent.t ype() == PlatformEvent::GestureScrollUpdate) 2414 if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || gestureEvent.t ype() == PlatformEvent::GestureScrollUpdate)
2415 eventTarget = m_scrollGestureHandlingNode.get(); 2415 eventTarget = m_scrollGestureHandlingNode.get();
2416 2416
2417 IntPoint adjustedPoint = gestureEvent.position();
2417 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; 2418 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
2418 if (gestureEvent.type() == PlatformEvent::GestureTapDown) 2419 if (gestureEvent.type() == PlatformEvent::GestureTapDown) {
2420 #if ENABLE(TOUCH_ADJUSTMENT)
2421 if (!gestureEvent.area().isEmpty())
2422 adjustGesturePosition(gestureEvent, adjustedPoint);
2423 #endif
2419 hitType |= HitTestRequest::Active; 2424 hitType |= HitTestRequest::Active;
2420 else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent.ty pe() == PlatformEvent::GestureTapDownCancel) 2425 } else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent. type() == PlatformEvent::GestureTapDownCancel)
2421 hitType |= HitTestRequest::Release; 2426 hitType |= HitTestRequest::Release;
2422 else 2427 else
2423 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; 2428 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;
2424 2429
2425 if (!shouldGesturesTriggerActive()) 2430 if (!shouldGesturesTriggerActive())
2426 hitType |= HitTestRequest::ReadOnly; 2431 hitType |= HitTestRequest::ReadOnly;
2427 2432
2428 if (!eventTarget || !(hitType & HitTestRequest::ReadOnly)) { 2433 if (!eventTarget || !(hitType & HitTestRequest::ReadOnly)) {
2429 IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.p osition()); 2434 IntPoint hitTestPoint = m_frame->view()->windowToContents(adjustedPoint) ;
2430 HitTestResult result = hitTestResultAtPoint(hitTestPoint, false, false, DontHitTestScrollbars, hitType); 2435 HitTestResult result = hitTestResultAtPoint(hitTestPoint, false, false, DontHitTestScrollbars, hitType);
2431 eventTarget = result.targetNode(); 2436 eventTarget = result.targetNode();
2432 } 2437 }
2433 2438
2434 if (eventTarget) { 2439 if (eventTarget) {
2435 bool eventSwallowed = eventTarget->dispatchGestureEvent(gestureEvent); 2440 bool eventSwallowed = eventTarget->dispatchGestureEvent(gestureEvent);
2436 2441
2437 if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) { 2442 if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) {
2438 if (eventSwallowed) 2443 if (eventSwallowed)
2439 m_scrollGestureHandlingNode = eventTarget; 2444 m_scrollGestureHandlingNode = eventTarget;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius); 2572 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
2568 RefPtr<StaticHashSetNodeList> nodeList = StaticHashSetNodeList::adopt(result .rectBasedTestResult()); 2573 RefPtr<StaticHashSetNodeList> nodeList = StaticHashSetNodeList::adopt(result .rectBasedTestResult());
2569 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, *nodeList.get()); 2574 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, *nodeList.get());
2570 } 2575 }
2571 2576
2572 bool EventHandler::adjustGesturePosition(const PlatformGestureEvent& gestureEven t, IntPoint& adjustedPoint) 2577 bool EventHandler::adjustGesturePosition(const PlatformGestureEvent& gestureEven t, IntPoint& adjustedPoint)
2573 { 2578 {
2574 Node* targetNode = 0; 2579 Node* targetNode = 0;
2575 switch (gestureEvent.type()) { 2580 switch (gestureEvent.type()) {
2576 case PlatformEvent::GestureTap: 2581 case PlatformEvent::GestureTap:
2582 case PlatformEvent::GestureTapDown:
2577 bestClickableNodeForTouchPoint(gestureEvent.position(), IntSize(gestureE vent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, targe tNode); 2583 bestClickableNodeForTouchPoint(gestureEvent.position(), IntSize(gestureE vent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, targe tNode);
2578 break; 2584 break;
2579 case PlatformEvent::GestureLongPress: 2585 case PlatformEvent::GestureLongPress:
2580 bestContextMenuNodeForTouchPoint(gestureEvent.position(), IntSize(gestur eEvent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, tar getNode); 2586 bestContextMenuNodeForTouchPoint(gestureEvent.position(), IntSize(gestur eEvent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, tar getNode);
2581 break; 2587 break;
2582 default: 2588 default:
2583 // FIXME: Implement handling for other types as needed. 2589 // FIXME: Implement handling for other types as needed.
2584 ASSERT_NOT_REACHED(); 2590 ASSERT_NOT_REACHED();
2585 } 2591 }
2586 return targetNode; 2592 return targetNode;
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3732 if (eventType == PlatformEvent::MouseMoved && !m_touchPressed) 3738 if (eventType == PlatformEvent::MouseMoved && !m_touchPressed)
3733 return false; 3739 return false;
3734 3740
3735 SyntheticSingleTouchEvent touchEvent(event); 3741 SyntheticSingleTouchEvent touchEvent(event);
3736 return handleTouchEvent(touchEvent); 3742 return handleTouchEvent(touchEvent);
3737 } 3743 }
3738 3744
3739 #endif 3745 #endif
3740 3746
3741 } 3747 }
OLDNEW
« no previous file with comments | « LayoutTests/touchadjustment/touch-links-active-expected.txt ('k') | Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698