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

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

Issue 329773002: Remove special touch-action hit test mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporated review comments Created 6 years, 6 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
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/rendering/HitTestRequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 3430 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 } 3441 }
3442 3442
3443 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id()) 3443 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id())
3444 // since we shouldn't get a touchstart for a touch that's already 3444 // since we shouldn't get a touchstart for a touch that's already
3445 // down. However EventSender allows this to be violated and there's 3445 // down. However EventSender allows this to be violated and there's
3446 // some tests that take advantage of it. There may also be edge 3446 // some tests that take advantage of it. There may also be edge
3447 // cases in the browser where this happens. 3447 // cases in the browser where this happens.
3448 // See http://crbug.com/345372. 3448 // See http://crbug.com/345372.
3449 m_targetForTouchID.set(point.id(), node); 3449 m_targetForTouchID.set(point.id(), node);
3450 3450
3451 TouchAction effectiveTouchAction = computeEffectiveTouchAction(pageP oint); 3451 TouchAction effectiveTouchAction = computeEffectiveTouchAction(*node );
3452 if (effectiveTouchAction != TouchActionAuto) 3452 if (effectiveTouchAction != TouchActionAuto)
3453 m_frame->page()->chrome().client().setTouchAction(effectiveTouch Action); 3453 m_frame->page()->chrome().client().setTouchAction(effectiveTouch Action);
3454 } 3454 }
3455 } 3455 }
3456 3456
3457 m_touchPressed = !allTouchReleased; 3457 m_touchPressed = !allTouchReleased;
3458 3458
3459 // If there's no document receiving touch events, or no handlers on the 3459 // If there's no document receiving touch events, or no handlers on the
3460 // document set to receive the events, then we can skip all the rest of 3460 // document set to receive the events, then we can skip all the rest of
3461 // this work. 3461 // this work.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3615 return TouchActionNone; 3615 return TouchActionNone;
3616 if (action1 == TouchActionAuto) 3616 if (action1 == TouchActionAuto)
3617 return action2; 3617 return action2;
3618 if (action2 == TouchActionAuto) 3618 if (action2 == TouchActionAuto)
3619 return action1; 3619 return action1;
3620 if (!(action1 & action2)) 3620 if (!(action1 & action2))
3621 return TouchActionNone; 3621 return TouchActionNone;
3622 return action1 & action2; 3622 return action1 & action2;
3623 } 3623 }
3624 3624
3625 TouchAction EventHandler::computeEffectiveTouchAction(const LayoutPoint& point) 3625 TouchAction EventHandler::computeEffectiveTouchAction(const Node& node)
3626 { 3626 {
3627 // Optimization to minimize risk of this new feature (behavior should be ide ntical 3627 // Optimization to minimize risk of this new feature (behavior should be ide ntical
3628 // since there's no way to get non-default touch-action values). 3628 // since there's no way to get non-default touch-action values).
3629 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) 3629 if (!RuntimeEnabledFeatures::cssTouchActionEnabled())
3630 return TouchActionAuto; 3630 return TouchActionAuto;
3631 3631
3632 HitTestResult taResult = hitTestResultAtPoint(point, HitTestRequest::TouchEv ent | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::TouchA ction); 3632 // if the hittest node doesn't support touchAction, then bailout immediately .
3633 Node* node = taResult.innerNode(); 3633 if (node.renderer() && !node.renderer()->supportsTouchAction())
gnana 2014/06/12 14:02:08 This check is added for below testcase. <div clas
Rick Byers 2014/06/12 19:27:25 This is the case we need to change the test for.
3634 if (!node)
3635 return TouchActionAuto; 3634 return TouchActionAuto;
3636 3635
3637 // Start by permitting all actions, then walk the elements supporting 3636 // Start by permitting all actions, then walk the elements supporting
3638 // touch-action from the target node up to the nearest scrollable ancestor 3637 // touch-action from the target node up to the nearest scrollable ancestor
3639 // and exclude any prohibited actions. 3638 // and exclude any prohibited actions.
3640 TouchAction effectiveTouchAction = TouchActionAuto; 3639 TouchAction effectiveTouchAction = TouchActionAuto;
3641 for (const Node* curNode = node; curNode; curNode = NodeRenderingTraversal:: parent(curNode)) { 3640 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal: :parent(curNode)) {
3642 if (RenderObject* renderer = curNode->renderer()) { 3641 if (RenderObject* renderer = curNode->renderer()) {
3643 if (renderer->visibleForTouchAction()) { 3642 if (renderer->supportsTouchAction()) {
3644 TouchAction action = renderer->style()->touchAction(); 3643 TouchAction action = renderer->style()->touchAction();
3645 effectiveTouchAction = intersectTouchAction(action, effectiveTou chAction); 3644 effectiveTouchAction = intersectTouchAction(action, effectiveTou chAction);
3646 if (effectiveTouchAction == TouchActionNone) 3645 if (effectiveTouchAction == TouchActionNone)
3647 break; 3646 break;
3648 } 3647 }
3649 3648
3650 // If we've reached an ancestor that supports a touch action, search no further. 3649 // If we've reached an ancestor that supports a touch action, search no further.
3651 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) 3650 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow())
3652 break; 3651 break;
3653 } 3652 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
3733 unsigned EventHandler::accessKeyModifiers() 3732 unsigned EventHandler::accessKeyModifiers()
3734 { 3733 {
3735 #if OS(MACOSX) 3734 #if OS(MACOSX)
3736 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3735 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3737 #else 3736 #else
3738 return PlatformEvent::AltKey; 3737 return PlatformEvent::AltKey;
3739 #endif 3738 #endif
3740 } 3739 }
3741 3740
3742 } // namespace WebCore 3741 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/rendering/HitTestRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698