| 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 2bbb8654d16dd90a4ce7f35ef1766e82490ffa2c..0e96f0fbfc63ed24f8f20def8ef01cb7350dee33 100644
|
| --- a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
|
| +++ b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
|
| @@ -17,20 +17,20 @@ inline int ToInt(WebPointerProperties::PointerType t) {
|
|
|
| const char* PointerTypeNameForWebPointPointerType(
|
| WebPointerProperties::PointerType type) {
|
| + // TODO(mustaq): Fix when the spec starts supporting hovering erasers.
|
| switch (type) {
|
| case WebPointerProperties::PointerType::kUnknown:
|
| return "";
|
| case WebPointerProperties::PointerType::kTouch:
|
| return "touch";
|
| case WebPointerProperties::PointerType::kPen:
|
| - case WebPointerProperties::PointerType::kEraser:
|
| - // TODO(mustaq): Fix when the spec starts supporting hovering erasers.
|
| return "pen";
|
| case WebPointerProperties::PointerType::kMouse:
|
| return "mouse";
|
| + default:
|
| + NOTREACHED();
|
| + return "";
|
| }
|
| - NOTREACHED();
|
| - return "";
|
| }
|
|
|
| const AtomicString& PointerEventNameForMouseEventName(
|
| @@ -188,21 +188,22 @@ void PointerEventFactory::SetIdTypeButtons(
|
| PointerEventInit& pointer_event_init,
|
| const WebPointerProperties& pointer_properties,
|
| unsigned buttons) {
|
| - const WebPointerProperties::PointerType pointer_type =
|
| + WebPointerProperties::PointerType pointer_type =
|
| pointer_properties.pointer_type;
|
| - const IncomingId incoming_id(pointer_type, pointer_properties.id);
|
| - int pointer_id = AddIdAndActiveButtons(incoming_id, 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 (pointer_type == WebPointerProperties::PointerType::kEraser &&
|
| - buttons != 0) {
|
| - buttons |= static_cast<unsigned>(WebPointerProperties::Buttons::kEraser);
|
| - buttons &= ~static_cast<unsigned>(WebPointerProperties::Buttons::kLeft);
|
| + if (pointer_type == WebPointerProperties::PointerType::kEraser) {
|
| + if (buttons != 0) {
|
| + buttons |= static_cast<unsigned>(WebPointerProperties::Buttons::kEraser);
|
| + buttons &= ~static_cast<unsigned>(WebPointerProperties::Buttons::kLeft);
|
| + }
|
| + pointer_type = WebPointerProperties::PointerType::kPen;
|
| }
|
| pointer_event_init.setButtons(buttons);
|
|
|
| + const IncomingId incoming_id(pointer_type, pointer_properties.id);
|
| + int pointer_id = AddIdAndActiveButtons(incoming_id, buttons != 0);
|
| pointer_event_init.setPointerId(pointer_id);
|
| pointer_event_init.setPointerType(
|
| PointerTypeNameForWebPointPointerType(pointer_type));
|
| @@ -515,6 +516,8 @@ bool PointerEventFactory::Remove(const int mapped_id) {
|
| return true;
|
| }
|
|
|
| +// This function does not work with pointer type of eraser, because we save
|
| +// them as pen type in the pointer id map.
|
| Vector<int> PointerEventFactory::GetPointerIdsOfType(
|
| WebPointerProperties::PointerType pointer_type) const {
|
| Vector<int> mapped_ids;
|
|
|