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

Unified Diff: third_party/WebKit/Source/core/events/PointerEventFactory.cpp

Issue 2314093002: Revert of Make a pen in eraser mode visible thru PointerEvent.buttons (Closed)
Patch Set: Created 4 years, 3 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/events/PointerEventFactory.cpp
diff --git a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
index 671129364bd1a03a814805c953427551c49a2d0a..ef93631cd36dd7b0459ea194c434603f576bb1d1 100644
--- a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
+++ b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
@@ -21,8 +21,6 @@
case WebPointerProperties::PointerType::Touch:
return "touch";
case WebPointerProperties::PointerType::Pen:
- case WebPointerProperties::PointerType::Eraser:
- // TODO(mustaq): Fix when the spec starts supporting hovering erasers.
return "pen";
case WebPointerProperties::PointerType::Mouse:
return "mouse";
@@ -56,22 +54,16 @@
unsigned short buttonToButtonsBitfield(WebPointerProperties::Button button)
{
-#define CASE_BUTTON_TO_BUTTONS(enumLabel) \
- case WebPointerProperties::Button::enumLabel:\
- return static_cast<unsigned short>(WebPointerProperties::Buttons::enumLabel)
-
switch (button) {
- CASE_BUTTON_TO_BUTTONS(NoButton);
- CASE_BUTTON_TO_BUTTONS(Left);
- CASE_BUTTON_TO_BUTTONS(Right);
- CASE_BUTTON_TO_BUTTONS(Middle);
- CASE_BUTTON_TO_BUTTONS(X1);
- CASE_BUTTON_TO_BUTTONS(X2);
- CASE_BUTTON_TO_BUTTONS(Eraser);
- }
-
-#undef CASE_BUTTON_TO_BUTTONS
-
+ case WebPointerProperties::Button::NoButton:
+ return static_cast<unsigned short>(MouseEvent::Buttons::None);
+ case WebPointerProperties::Button::Left:
+ return static_cast<unsigned short>(MouseEvent::Buttons::Left);
+ case WebPointerProperties::Button::Right:
+ return static_cast<unsigned short>(MouseEvent::Buttons::Right);
+ case WebPointerProperties::Button::Middle:
+ return static_cast<unsigned short>(MouseEvent::Buttons::Middle);
+ }
NOTREACHED();
return 0;
}
@@ -97,15 +89,7 @@
const IncomingId incomingId(pointerType, pointerProperties.id);
int pointerId = addIdAndActiveButtons(incomingId, buttons != 0);
- // Tweak the |buttons| to reflect pen eraser mode only if the pen is in
- // active buttons state w/o even considering the eraser button.
- // TODO(mustaq): Fix when the spec starts supporting hovering erasers.
- if (pointerType == WebPointerProperties::PointerType::Eraser && buttons != 0) {
- buttons |= static_cast<unsigned>(WebPointerProperties::Buttons::Eraser);
- buttons &= ~static_cast<unsigned>(WebPointerProperties::Buttons::Left);
- }
pointerEventInit.setButtons(buttons);
-
pointerEventInit.setPointerId(pointerId);
pointerEventInit.setPointerType(pointerTypeNameForWebPointPointerType(pointerType));
pointerEventInit.setIsPrimary(isPrimary(pointerId));
@@ -158,12 +142,7 @@
if (pointerEventName == EventTypeNames::pointerdown
|| pointerEventName == EventTypeNames::pointerup) {
- WebPointerProperties::Button button = mouseEvent.pointerProperties().button;
- // TODO(mustaq): Fix when the spec starts supporting hovering erasers.
- if (mouseEvent.pointerProperties().pointerType == WebPointerProperties::PointerType::Eraser
- && button == WebPointerProperties::Button::Left)
- button = WebPointerProperties::Button::Eraser;
- pointerEventInit.setButton(static_cast<int>(button));
+ pointerEventInit.setButton(static_cast<int>(mouseEvent.pointerProperties().button));
} else {
DCHECK(pointerEventName == EventTypeNames::pointermove);
pointerEventInit.setButton(static_cast<int>(WebPointerProperties::Button::NoButton));
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.cpp ('k') | third_party/WebKit/public/platform/WebPointerProperties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698