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

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

Issue 1855513002: Consider isPrimary and pointerType when preventing compat mouse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Running "cl format" Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/PointerEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
index f784bbcc17891a48cdfd2f466996e4e401ae6b86..6bade5172d119858510104f1bd64443bc689b7ee 100644
--- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -12,6 +12,8 @@ namespace blink {
namespace {
+size_t toPointerTypeIndex(WebPointerProperties::PointerType t) { return static_cast<size_t>(t); }
+
const AtomicString& pointerEventNameForTouchPointState(PlatformTouchPoint::TouchState state)
{
switch (state) {
@@ -115,8 +117,10 @@ void PointerEventManager::sendMouseAndPossiblyPointerNodeTransitionEvents(
// stage. So if the event is not frame boundary transition it is only a
// compatibility mouse event and we do not need to change pointer event
// behavior regarding preventMouseEvent state in that case.
- if (isFrameBoundaryTransition && pointerEvent->buttons() == 0) {
- m_preventMouseEventForPointerTypeMouse = false;
+ if (isFrameBoundaryTransition && pointerEvent->buttons() == 0
+ && pointerEvent->isPrimary()) {
+ m_preventMouseEventForPointerType[toPointerTypeIndex(
+ mouseEvent.pointerProperties().pointerType)] = false;
}
processCaptureAndPositionOfPointerEvent(pointerEvent, enteredNode,
@@ -355,8 +359,10 @@ WebInputEventResult PointerEventManager::sendMousePointerEvent(
// This is for when the mouse is released outside of the page.
if (pointerEvent->type() == EventTypeNames::pointermove
- && !pointerEvent->buttons()) {
- m_preventMouseEventForPointerTypeMouse = false;
+ && !pointerEvent->buttons()
+ && pointerEvent->isPrimary()) {
+ m_preventMouseEventForPointerType[toPointerTypeIndex(
+ mouseEvent.pointerProperties().pointerType)] = false;
}
processCaptureAndPositionOfPointerEvent(pointerEvent, target,
@@ -369,10 +375,14 @@ WebInputEventResult PointerEventManager::sendMousePointerEvent(
dispatchPointerEvent(effectiveTarget, pointerEvent);
if (result != WebInputEventResult::NotHandled
- && pointerEvent->type() == EventTypeNames::pointerdown)
- m_preventMouseEventForPointerTypeMouse = true;
+ && pointerEvent->type() == EventTypeNames::pointerdown
+ && pointerEvent->isPrimary()) {
+ m_preventMouseEventForPointerType[toPointerTypeIndex(
+ mouseEvent.pointerProperties().pointerType)] = true;
+ }
- if (!m_preventMouseEventForPointerTypeMouse) {
+ if (pointerEvent->isPrimary() && !m_preventMouseEventForPointerType[toPointerTypeIndex(
+ mouseEvent.pointerProperties().pointerType)]) {
result = EventHandler::mergeEventResult(result,
dispatchMouseEvent(effectiveTarget, mouseEventType, mouseEvent,
nullptr, clickCount));
@@ -380,7 +390,10 @@ WebInputEventResult PointerEventManager::sendMousePointerEvent(
if (pointerEvent->buttons() == 0) {
releasePointerCapture(pointerEvent->pointerId());
- m_preventMouseEventForPointerTypeMouse = false;
+ if (pointerEvent->isPrimary()) {
+ m_preventMouseEventForPointerType[toPointerTypeIndex(
+ mouseEvent.pointerProperties().pointerType)] = false;
+ }
}
return result;
@@ -397,7 +410,8 @@ PointerEventManager::~PointerEventManager()
void PointerEventManager::clear()
{
- m_preventMouseEventForPointerTypeMouse = false;
+ for (auto& entry : m_preventMouseEventForPointerType)
+ entry = false;
m_pointerEventFactory.clear();
m_nodeUnderPointer.clear();
m_pointerCaptureTarget.clear();
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698