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 5ec337e655cfa8a1cfe03b4df1cb535a050dfb01..8c73004514e9e6197dca392c5b3ae87ba475aff4 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" |
@@ -359,6 +360,7 @@ DEFINE_TRACE(EventHandler) |
visitor->trace(m_previousWheelScrolledNode); |
visitor->trace(m_scrollbarHandlingScrollGesture); |
visitor->trace(m_targetForTouchID); |
+ visitor->trace(m_regionForTouchID); |
visitor->trace(m_touchSequenceDocument); |
visitor->trace(m_scrollGestureHandlingNode); |
visitor->trace(m_previousGestureScrolledNode); |
@@ -3844,7 +3846,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. |
@@ -3971,6 +3974,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 = ComposedTreeTraversal::parent(*node); |
@@ -4017,16 +4027,19 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve |
const PlatformTouchPoint& point = points[i]; |
PlatformTouchPoint::State 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; |
@@ -4072,6 +4085,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) { |