Chromium Code Reviews| Index: third_party/WebKit/Source/core/input/TouchEventManager.cpp |
| diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp |
| index 5fbb1139f481d6dcf3bea6dfe89f759b3deb01d4..7a9a4d7be521570af115eba5d9ae58dea7246227 100644 |
| --- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp |
| +++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp |
| @@ -169,9 +169,6 @@ WebInputEventResult TouchEventManager::dispatchTouchEvents( |
| const PlatformTouchPoint& point = touchInfo.point; |
| PlatformTouchPoint::TouchState pointState = point.state(); |
| - if (touchInfo.consumed) |
| - continue; |
| - |
| Touch* touch = Touch::create( |
| touchInfo.targetFrame.get(), |
| touchInfo.touchNode.get(), |
| @@ -269,31 +266,31 @@ void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( |
| // the corresponding pointer event target. |
| if (touchInfo.point.state() == PlatformTouchPoint::TouchPressed) { |
| HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent | HitTestRequest::ReadOnly | HitTestRequest::Active; |
| - LayoutPoint pagePoint = roundedLayoutPoint(m_frame->view()->rootFrameToContents(touchInfo.point.pos())); |
| HitTestResult result; |
| - if (!m_touchSequenceDocument) { |
| - result = m_frame->eventHandler().hitTestResultAtPoint(pagePoint, hitType); |
|
mustaq
2016/05/11 14:30:55
Looks like we are not covering this case anymore.
Navid Zolghadr
2016/05/11 16:43:42
We are not. This scenario (which is generally the
|
| - } else if (m_touchSequenceDocument->frame()) { |
| - LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceDocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); |
| - result = EventHandler::hitTestResultInFrame(m_touchSequenceDocument->frame(), framePoint, hitType); |
| - } else { |
| - continue; |
| + if (m_touchSequenceDocument && (!touchInfo.touchNode |
|
dtapuska
2016/05/13 16:51:36
Can we add a comment what the intent of this code
Navid Zolghadr
2016/05/16 20:01:50
Done.
|
| + || &touchInfo.touchNode->document() != m_touchSequenceDocument)) { |
| + if (m_touchSequenceDocument->frame()) { |
| + LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceDocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); |
| + result = EventHandler::hitTestResultInFrame(m_touchSequenceDocument->frame(), framePoint, hitType); |
| + Node* node = result.innerNode(); |
| + if (!node) |
| + continue; |
| + if (isHTMLCanvasElement(node)) { |
| + std::pair<Element*, String> regionInfo = toHTMLCanvasElement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); |
| + if (regionInfo.first) |
| + node = regionInfo.first; |
| + touchInfo.region = regionInfo.second; |
| + } |
| + // Touch events should not go to text nodes. |
| + if (node->isTextNode()) |
| + node = FlatTreeTraversal::parent(*node); |
| + touchInfo.touchNode = node; |
| + } else { |
| + continue; |
| + } |
| } |
| - |
| - Node* node = result.innerNode(); |
| - if (!node) |
| + if (!touchInfo.touchNode) |
| continue; |
| - if (isHTMLCanvasElement(node)) { |
| - std::pair<Element*, String> regionInfo = toHTMLCanvasElement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); |
| - if (regionInfo.first) |
| - node = regionInfo.first; |
| - touchInfo.region = regionInfo.second; |
| - } |
| - // Touch events should not go to text nodes. |
| - if (node->isTextNode()) |
| - node = FlatTreeTraversal::parent(*node); |
| - touchInfo.touchNode = node; |
| - |
| if (!m_touchSequenceDocument) { |
| // Keep track of which document should receive all touch events |
| // in the active sequence. This must be a single document to |
| @@ -311,12 +308,6 @@ void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( |
| m_targetForTouchID.set(touchInfo.point.id(), touchInfo.touchNode); |
| m_regionForTouchID.set(touchInfo.point.id(), touchInfo.region); |
| - |
| - TouchAction effectiveTouchAction = |
| - TouchActionUtil::computeEffectiveTouchAction( |
| - *touchInfo.touchNode); |
| - if (effectiveTouchAction != TouchActionAuto) |
| - m_frame->page()->chromeClient().setTouchAction(effectiveTouchAction); |
| } |
| } |
| } |
| @@ -384,12 +375,11 @@ void TouchEventManager::setAllPropertiesOfTouchInfos( |
| touchInfo.adjustedPagePoint = pagePoint.scaledBy(scaleFactor); |
| touchInfo.adjustedRadius = touchInfo.point.radius().scaledBy(scaleFactor); |
| touchInfo.knownTarget = knownTarget; |
| - touchInfo.consumed = false; |
| touchInfo.region = regionID; |
| } |
| } |
| -bool TouchEventManager::generateTouchInfosAfterHittest( |
| +bool TouchEventManager::reHitTestTouchPointsIfNeeded( |
| const PlatformTouchEvent& event, |
| HeapVector<TouchInfo>& touchInfos) |
| { |
| @@ -419,12 +409,6 @@ bool TouchEventManager::generateTouchInfosAfterHittest( |
| return false; |
| } |
| - for (const auto& point : event.touchPoints()) { |
| - TouchEventManager::TouchInfo touchInfo; |
| - touchInfo.point = point; |
| - touchInfos.append(touchInfo); |
| - } |
| - |
| updateTargetAndRegionMapsForTouchStarts(touchInfos); |
| m_touchPressed = !allTouchesReleased; |
| @@ -447,8 +431,11 @@ bool TouchEventManager::generateTouchInfosAfterHittest( |
| WebInputEventResult TouchEventManager::handleTouchEvent( |
| const PlatformTouchEvent& event, |
| - const HeapVector<TouchInfo>& touchInfos) |
| + HeapVector<TouchInfo>& touchInfos) |
| { |
| + if (!reHitTestTouchPointsIfNeeded(event, touchInfos)) |
| + return WebInputEventResult::NotHandled; |
| + |
| // Note that the disposition of any pointer events affects only the generation of touch |
| // events. If all pointer events were handled (and hence no touch events were fired), that |
| // is still equivalent to the touch events going unhandled because pointer event handler |