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

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

Issue 103823003: Implement touch-action pan-x/pan-y handling on the main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@issue1
Patch Set: removed unrelated file Created 7 years 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 * 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 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 { 3972 {
3973 // Optimization to minimize risk of this new feature (behavior should be ide ntical 3973 // Optimization to minimize risk of this new feature (behavior should be ide ntical
3974 // since there's no way to get non-default touch-action values). 3974 // since there's no way to get non-default touch-action values).
3975 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) 3975 if (!RuntimeEnabledFeatures::cssTouchActionEnabled())
3976 return TouchActionAuto; 3976 return TouchActionAuto;
3977 3977
3978 // Start by permitting all actions, then walk the block level elements from 3978 // Start by permitting all actions, then walk the block level elements from
3979 // the target node up to the nearest scrollable ancestor and exclude any 3979 // the target node up to the nearest scrollable ancestor and exclude any
3980 // prohibited actions. For now this is trivial, but when we add more types 3980 // prohibited actions. For now this is trivial, but when we add more types
3981 // of actions it'll get a little more complex. 3981 // of actions it'll get a little more complex.
3982 TouchAction effectiveTouchAction = TouchActionAuto;
3982 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal: :parent(curNode)) { 3983 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal: :parent(curNode)) {
3983 // The spec says only block and SVG elements get touch-action. 3984 // The spec says only block and SVG elements get touch-action.
3984 // FIXME(rbyers): Add correct support for SVG, crbug.com/247396. 3985 // FIXME(rbyers): Add correct support for SVG, crbug.com/247396.
3985 if (RenderObject* renderer = curNode->renderer()) { 3986 if (RenderObject* renderer = curNode->renderer()) {
3986 if (renderer->isRenderBlockFlow()) { 3987 if (renderer->isRenderBlockFlow()) {
3987 if (renderer->style()->touchAction() == TouchActionNone) 3988 TouchAction action = renderer->style()->touchAction();
3988 return TouchActionNone; 3989 if (action == TouchActionNone) {
3990 effectiveTouchAction = action;
Rick Byers 2013/12/12 20:47:24 As esprehn pointed out reviewing my CL for this, w
gnana 2013/12/13 16:52:53 Done.
3991 } else if (action == TouchActionPanX) {
Rick Byers 2013/12/12 20:47:24 This seems correct, but it's pretty verbose and ha
gnana 2013/12/13 16:52:53 Done.
3992 if (effectiveTouchAction == TouchActionPanY) {
3993 effectiveTouchAction = TouchActionNone;
3994 } else if (effectiveTouchAction == TouchActionAuto || effect iveTouchAction == (TouchActionPanX | TouchActionPanY)) {
3995 effectiveTouchAction = TouchActionPanX;
3996 }
3997 } else if (action == TouchActionPanY) {
3998 if (effectiveTouchAction == TouchActionPanX) {
3999 effectiveTouchAction = TouchActionNone;
4000 } else if (effectiveTouchAction == TouchActionAuto || effect iveTouchAction == (TouchActionPanX | TouchActionPanY)) {
4001 effectiveTouchAction = TouchActionPanY;
4002 }
4003 } else if (action == (TouchActionPanX | TouchActionPanY)) {
4004 if (effectiveTouchAction == TouchActionPanX)
4005 effectiveTouchAction = TouchActionPanX;
4006 else if (effectiveTouchAction == TouchActionPanY)
4007 effectiveTouchAction = TouchActionPanY;
4008 else if (effectiveTouchAction == TouchActionAuto)
4009 effectiveTouchAction = TouchActionPanX | TouchActionPanY ;
4010 }
3989 } 4011 }
3990 4012
3991 // If we've reached an ancestor that supports a touch action, search no further. 4013 // If we've reached an ancestor that supports a touch action, search no further.
3992 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) 4014 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow())
3993 break; 4015 break;
3994 } 4016 }
3995 } 4017 }
3996 return TouchActionAuto; 4018 return effectiveTouchAction;
3997 } 4019 }
3998 4020
3999 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) 4021 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
4000 { 4022 {
4001 m_mousePositionIsUnknown = false; 4023 m_mousePositionIsUnknown = false;
4002 m_lastKnownMousePosition = event.position(); 4024 m_lastKnownMousePosition = event.position();
4003 m_lastKnownMouseGlobalPosition = event.globalPosition(); 4025 m_lastKnownMouseGlobalPosition = event.globalPosition();
4004 } 4026 }
4005 4027
4006 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m ev, Frame* subframe) 4028 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m ev, Frame* subframe)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
4074 unsigned EventHandler::accessKeyModifiers() 4096 unsigned EventHandler::accessKeyModifiers()
4075 { 4097 {
4076 #if OS(MACOSX) 4098 #if OS(MACOSX)
4077 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4099 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4078 #else 4100 #else
4079 return PlatformEvent::AltKey; 4101 return PlatformEvent::AltKey;
4080 #endif 4102 #endif
4081 } 4103 }
4082 4104
4083 } // namespace WebCore 4105 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/web/tests/TouchActionTest.cpp » ('j') | Source/web/tests/data/touch-action-overflow.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698