Index: third_party/WebKit/Source/core/input/EventHandler.cpp |
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp |
index d0507f4eba308a0f11aae74c66b0a11d0100f335..8556841c8e42b1408085893afd264a63529f6a97 100644 |
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
@@ -56,6 +56,7 @@ |
#include "core/frame/LocalFrame.h" |
#include "core/frame/Settings.h" |
#include "core/frame/VisualViewport.h" |
+#include "core/html/HTMLCanvasElement.h" |
#include "core/html/HTMLDialogElement.h" |
#include "core/html/HTMLFrameElementBase.h" |
#include "core/html/HTMLFrameSetElement.h" |
@@ -288,6 +289,7 @@ DEFINE_TRACE(EventHandler) |
visitor->trace(m_frameSetBeingResized); |
visitor->trace(m_scrollbarHandlingScrollGesture); |
visitor->trace(m_targetForTouchID); |
+ visitor->trace(m_regionForTouchID); |
visitor->trace(m_touchSequenceDocument); |
visitor->trace(m_scrollGestureHandlingNode); |
visitor->trace(m_previousGestureScrolledNode); |
@@ -3686,7 +3688,8 @@ WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent& |
touchInfo.adjustedPagePoint, |
touchInfo.adjustedRadius, |
point.rotationAngle(), |
- point.force()); |
+ point.force(), |
+ touchInfo.region); |
// Ensure this target's touch list exists, even if it ends up empty, so |
// it can always be passed to TouchEvent::Create below. |
@@ -3812,6 +3815,13 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve |
if (!node) |
continue; |
+ if (isHTMLCanvasElement(node)) { |
+ std::pair<Element*, String> regionInfo = toHTMLCanvasElement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); |
+ if (regionInfo.first) |
+ node = regionInfo.first; |
+ m_regionForTouchID.set(point.id(), regionInfo.second); |
+ } |
+ |
// Touch events should not go to text nodes |
if (node->isTextNode()) |
node = FlatTreeTraversal::parent(*node); |
@@ -3858,16 +3868,19 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve |
const PlatformTouchPoint& point = points[i]; |
PlatformTouchPoint::TouchState pointState = point.state(); |
RefPtrWillBeRawPtr<EventTarget> touchTarget = nullptr; |
+ String regionID; |
if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) { |
// The target should be the original target for this touch, so get |
// it from the hashmap. As it's a release or cancel we also remove |
// it from the map. |
touchTarget = m_targetForTouchID.take(point.id()); |
+ regionID = m_regionForTouchID.take(point.id()); |
} else { |
// No hittest is performed on move or stationary, since the target |
// is not allowed to change anyway. |
touchTarget = m_targetForTouchID.get(point.id()); |
+ regionID = m_regionForTouchID.get(point.id()); |
} |
LocalFrame* targetFrame = nullptr; |
@@ -3913,6 +3926,7 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve |
touchInfo.adjustedRadius = point.radius().scaledBy(scaleFactor); |
touchInfo.knownTarget = knownTarget; |
touchInfo.consumed = false; |
+ touchInfo.region = regionID; |
} |
if (!m_inPointerCanceledState) { |