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

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

Issue 2296303002: Make a pen in eraser mode visible thru PointerEvent.buttons (Closed)
Patch Set: Incremental patch on crrev.com/2289273002 Created 4 years, 4 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/events/MouseEvent.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/events/PointerEventFactory.cpp
diff --git a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
index 4ca7e61e874a846d55d263cfcaad3cb2af24b636..123369f612b68341f789a8fa11292231c029d95a 100644
--- a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
+++ b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
@@ -22,6 +22,7 @@ const char* pointerTypeNameForWebPointPointerType(WebPointerProperties::PointerT
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";
@@ -78,8 +79,10 @@ const int PointerEventFactory::s_mouseId = 1;
float getPointerEventPressure(float force, int buttons)
{
- if (std::isnan(force))
- return buttons ? 0.5 : 0;
+ if (std::isnan(force)) {
+ // TODO(mustaq): Fix when the spec starts supporting hovering erasers.
+ return (buttons & ~static_cast<unsigned>(MouseEvent::Buttons::Eraser)) ? 0.5 : 0;
+ }
return force;
}
@@ -90,7 +93,13 @@ void PointerEventFactory::setIdTypeButtons(PointerEventInit& pointerEventInit,
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)
Navid Zolghadr 2016/08/31 20:01:16 I wonder if we can just do this when pointerType i
mustaq 2016/08/31 20:29:37 I don't like this for two reasons: [A] That would
+ buttons |= static_cast<unsigned>(MouseEvent::Buttons::Eraser);
pointerEventInit.setButtons(buttons);
+
pointerEventInit.setPointerId(pointerId);
pointerEventInit.setPointerType(pointerTypeNameForWebPointPointerType(pointerType));
pointerEventInit.setIsPrimary(isPrimary(pointerId));
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698