Remove special touch-action hit test mode

Don't try to mimic IE's special hit-testing behavior for touch-action - it probably only adds confusion and is unlikely to cause compat issues in practice.  See http://crbug.com/380203 for details.

Also reduces the hit tests done on touchstart from 2 to 1 for improved performance.

BUG=380203

Review URL: https://codereview.chromium.org/329773002

git-svn-id: svn://svn.chromium.org/blink/trunk@176285 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent cd7fe3ac
......@@ -3483,7 +3483,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
// See http://crbug.com/345372.
m_targetForTouchID.set(point.id(), node);
TouchAction effectiveTouchAction = computeEffectiveTouchAction(pagePoint);
TouchAction effectiveTouchAction = computeEffectiveTouchAction(*node);
if (effectiveTouchAction != TouchActionAuto)
m_frame->page()->chrome().client().setTouchAction(effectiveTouchAction);
}
......@@ -3653,25 +3653,20 @@ TouchAction EventHandler::intersectTouchAction(TouchAction action1, TouchAction
return action1 & action2;
}
TouchAction EventHandler::computeEffectiveTouchAction(const LayoutPoint& point)
TouchAction EventHandler::computeEffectiveTouchAction(const Node& node)
{
// Optimization to minimize risk of this new feature (behavior should be identical
// since there's no way to get non-default touch-action values).
if (!RuntimeEnabledFeatures::cssTouchActionEnabled())
return TouchActionAuto;
HitTestResult taResult = hitTestResultAtPoint(point, HitTestRequest::TouchEvent | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::TouchAction);
Node* node = taResult.innerNode();
if (!node)
return TouchActionAuto;
// Start by permitting all actions, then walk the elements supporting
// touch-action from the target node up to the nearest scrollable ancestor
// and exclude any prohibited actions.
TouchAction effectiveTouchAction = TouchActionAuto;
for (const Node* curNode = node; curNode; curNode = NodeRenderingTraversal::parent(curNode)) {
for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal::parent(curNode)) {
if (RenderObject* renderer = curNode->renderer()) {
if (renderer->visibleForTouchAction()) {
if (renderer->supportsTouchAction()) {
TouchAction action = renderer->style()->touchAction();
effectiveTouchAction = intersectTouchAction(action, effectiveTouchAction);
if (effectiveTouchAction == TouchActionNone)
......
......@@ -246,7 +246,7 @@ private:
bool scroll(ScrollDirection, ScrollGranularity, Node* startNode = 0, Node** stopNode = 0, float delta = 1.0f, IntPoint absolutePoint = IntPoint());
TouchAction intersectTouchAction(const TouchAction, const TouchAction);
TouchAction computeEffectiveTouchAction(const LayoutPoint&);
TouchAction computeEffectiveTouchAction(const Node&);
HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent);
......
......@@ -41,7 +41,6 @@ public:
AllowChildFrameContent = 1 << 10,
ChildFrameHitTest = 1 << 11,
IgnorePointerEventsNone = 1 << 12,
TouchAction = 1 << 13, // Hit testing for touch-action considers only block-level elements
};
typedef unsigned HitTestRequestType;
......@@ -64,7 +63,6 @@ public:
bool allowsChildFrameContent() const { return m_requestType & AllowChildFrameContent; }
bool isChildFrameHitTest() const { return m_requestType & ChildFrameHitTest; }
bool ignorePointerEventsNone() const { return m_requestType & IgnorePointerEventsNone; }
bool touchAction() const { return m_requestType & TouchAction; }
// Convenience functions
bool touchMove() const { return move() && touchEvent(); }
......
......@@ -273,13 +273,7 @@ public:
int expansion() const { return m_bitfields.expansion(); }
bool visibleForTouchAction() const { return false; }
bool visibleToHitTestRequest(const HitTestRequest& request) const
{
if (request.touchAction() && !visibleForTouchAction())
return false;
return renderer().visibleToHitTestRequest(request);
}
bool visibleToHitTestRequest(const HitTestRequest& request) const { return renderer().visibleToHitTestRequest(request); }
EVerticalAlign verticalAlign() const { return renderer().style(m_bitfields.firstLine())->verticalAlign(); }
......
......@@ -3301,7 +3301,7 @@ bool RenderObject::isInert() const
// 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 RenderObject::visibleForTouchAction() const
bool RenderObject::supportsTouchAction() const
{
if (isInline() && !isReplaced())
return false;
......
......@@ -950,14 +950,9 @@ public:
bool isInert() const;
bool visibleForTouchAction() const;
bool supportsTouchAction() const;
bool visibleToHitTestRequest(const HitTestRequest& request) const
{
if (request.touchAction() && !visibleForTouchAction())
return false;
return style()->visibility() == VISIBLE && (request.ignorePointerEventsNone() || style()->pointerEvents() != PE_NONE) && !isInert();
}
bool visibleToHitTestRequest(const HitTestRequest& request) const { return style()->visibility() == VISIBLE && (request.ignorePointerEventsNone() || style()->pointerEvents() != PE_NONE) && !isInert(); }
bool visibleToHitTesting() const { return style()->visibility() == VISIBLE && style()->pointerEvents() != PE_NONE && !isInert(); }
......
......@@ -39,9 +39,9 @@
</span>
</div>
<div class='ta-none' style='height: 0; margin-bottom: 50px'>
<span expected-action='auto'>
touch-action should not be inherited by inline elements
<div class='ta-none' style='height: 0; margin-bottom: 100px'>
<span expected-action='none'>
touch-action should be inherited by inline elements.<br>Note this is different than IE (http://crbug.com/380203)
</span>
</div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment