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

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

Issue 2747763002: Add use count for click retargeting due to capture (Closed)
Patch Set: Created 3 years, 9 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/MouseEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
index 3672b0fa43f8f76190a6cdaffc828cdb4de6aa81..8649084de97f92988e9453a00c88478142c24961 100644
--- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -233,7 +233,8 @@ WebInputEventResult MouseEventManager::setMousePositionAndDispatchMouseEvent(
WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded(
Node* target,
const WebMouseEvent& mouseEvent,
- const String& canvasRegionId) {
+ const String& canvasRegionId,
+ Node* targetWithoutCapture) {
// We only prevent click event when the click may cause contextmenu to popup.
// However, we always send auxclick.
bool contextMenuEvent =
@@ -267,6 +268,23 @@ WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded(
clickTargetNode = target->commonAncestor(
*m_clickNode, EventHandlingUtil::parentForClickEvent);
}
+
+ // This block is only for the purpose of gathering the metric and can be
+ // removed as soon as we don't need the metric.
+ if (targetWithoutCapture != target) {
+ Node* alternativeClickTargetNode = nullptr;
+ if (m_clickNode == targetWithoutCapture) {
+ alternativeClickTargetNode = m_clickNode;
+ } else if (m_clickNode->document() == targetWithoutCapture->document()) {
+ alternativeClickTargetNode = targetWithoutCapture->commonAncestor(
+ *m_clickNode, EventHandlingUtil::parentForClickEvent);
+ }
+ if (alternativeClickTargetNode != clickTargetNode) {
+ UseCounter::count(m_frame,
+ UseCounter::PointerEventClickRetargetCausedByCapture);
+ }
+ }
+
if (clickTargetNode) {
clickEventResult = dispatchMouseEvent(
clickTargetNode,
« no previous file with comments | « third_party/WebKit/Source/core/input/MouseEventManager.h ('k') | third_party/WebKit/Source/core/input/PointerEventManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698