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)); |