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

Unified Diff: third_party/WebKit/Source/core/input/TouchActionUtil.cpp

Issue 2916563003: Compute effective touch action in StyleAdjuster. (Closed)
Patch Set: Unifying ScrollsOverflow Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/TouchActionUtil.cpp
diff --git a/third_party/WebKit/Source/core/input/TouchActionUtil.cpp b/third_party/WebKit/Source/core/input/TouchActionUtil.cpp
index e482126c98af4e35d3c819b9410e3d3f779298b9..a582acef1feadb72a2c85a9d07ed5d346eec1658 100644
--- a/third_party/WebKit/Source/core/input/TouchActionUtil.cpp
+++ b/third_party/WebKit/Source/core/input/TouchActionUtil.cpp
@@ -14,21 +14,6 @@ namespace TouchActionUtil {
namespace {
-// touch-action applies to all elements with both width AND height properties.
-// According to the CSS Box Model Spec
-// (http://dev.w3.org/csswg/css-box/#the-width-and-height-properties)
-// width applies to all elements but non-replaced inline elements, table rows,
-// and row groups and height applies to all elements but non-replaced inline
-// elements, table columns, and column groups.
-bool SupportsTouchAction(const LayoutObject& object) {
- if (object.IsInline() && !object.IsAtomicInlineLevel())
- return false;
- if (object.IsTableRow() || object.IsLayoutTableCol())
- return false;
-
- return true;
-}
-
const Node* ParentNodeAcrossFrames(const Node* cur_node) {
Node* parent_node = FlatTreeTraversal::Parent(*cur_node);
if (parent_node)
@@ -45,30 +30,13 @@ const Node* ParentNodeAcrossFrames(const Node* cur_node) {
} // namespace
TouchAction ComputeEffectiveTouchAction(const Node& node) {
- // Start by permitting all actions, then walk the elements supporting
- // touch-action from the target node up to root document, exclude any
- // prohibited actions at or below the element that supports them.
- // I.e. pan-related actions are considered up to the nearest scroller,
- // and zoom related actions are considered up to the root.
TouchAction effective_touch_action = TouchAction::kTouchActionAuto;
- TouchAction handled_touch_actions = TouchAction::kTouchActionNone;
for (const Node* cur_node = &node; cur_node;
cur_node = ParentNodeAcrossFrames(cur_node)) {
- if (LayoutObject* layout_object = cur_node->GetLayoutObject()) {
- if (SupportsTouchAction(*layout_object)) {
- TouchAction action = layout_object->Style()->GetTouchAction();
- action |= handled_touch_actions;
- effective_touch_action &= action;
- if (effective_touch_action == TouchAction::kTouchActionNone)
- break;
- }
-
- // If we've reached an ancestor that supports panning, stop allowing
- // panning to be disabled.
- if ((layout_object->IsBox() &&
- ToLayoutBox(layout_object)->ScrollsOverflow()) ||
- layout_object->IsLayoutView())
- handled_touch_actions |= TouchAction::kTouchActionPan;
+ if (cur_node->GetLayoutObject()) {
+ effective_touch_action =
+ cur_node->GetLayoutObject()->Style()->GetEffectiveTouchAction();
+ break;
}
}
return effective_touch_action;

Powered by Google App Engine
This is Rietveld 408576698