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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
old mode 100644
new mode 100755
index c0466e38edf8f049f52f8cc888c43ae3f00f1842..08894ef41568cf8413482137d9f7f7e435d99cbc
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -3979,13 +3979,35 @@ TouchAction EventHandler::computeEffectiveTouchAction(const Node& node)
// the target node up to the nearest scrollable ancestor and exclude any
// prohibited actions. For now this is trivial, but when we add more types
// of actions it'll get a little more complex.
+ TouchAction effectiveTouchAction = TouchActionAuto;
for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal::parent(curNode)) {
// The spec says only block and SVG elements get touch-action.
// FIXME(rbyers): Add correct support for SVG, crbug.com/247396.
if (RenderObject* renderer = curNode->renderer()) {
if (renderer->isRenderBlockFlow()) {
- if (renderer->style()->touchAction() == TouchActionNone)
- return TouchActionNone;
+ TouchAction action = renderer->style()->touchAction();
+ if (action == TouchActionNone) {
+ 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.
+ } 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.
+ if (effectiveTouchAction == TouchActionPanY) {
+ effectiveTouchAction = TouchActionNone;
+ } else if (effectiveTouchAction == TouchActionAuto || effectiveTouchAction == (TouchActionPanX | TouchActionPanY)) {
+ effectiveTouchAction = TouchActionPanX;
+ }
+ } else if (action == TouchActionPanY) {
+ if (effectiveTouchAction == TouchActionPanX) {
+ effectiveTouchAction = TouchActionNone;
+ } else if (effectiveTouchAction == TouchActionAuto || effectiveTouchAction == (TouchActionPanX | TouchActionPanY)) {
+ effectiveTouchAction = TouchActionPanY;
+ }
+ } else if (action == (TouchActionPanX | TouchActionPanY)) {
+ if (effectiveTouchAction == TouchActionPanX)
+ effectiveTouchAction = TouchActionPanX;
+ else if (effectiveTouchAction == TouchActionPanY)
+ effectiveTouchAction = TouchActionPanY;
+ else if (effectiveTouchAction == TouchActionAuto)
+ effectiveTouchAction = TouchActionPanX | TouchActionPanY;
+ }
}
// If we've reached an ancestor that supports a touch action, search no further.
@@ -3993,7 +4015,7 @@ TouchAction EventHandler::computeEffectiveTouchAction(const Node& node)
break;
}
}
- return TouchActionAuto;
+ return effectiveTouchAction;
}
void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
« 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