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

Side by Side Diff: third_party/WebKit/Source/core/events/PointerEventFactory.cpp

Issue 2289273002: Eraser tool type plumbing from ui/events to web events and PPAPI. (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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/events/PointerEventFactory.h" 5 #include "core/events/PointerEventFactory.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "platform/geometry/FloatSize.h" 8 #include "platform/geometry/FloatSize.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 namespace { 12 namespace {
13 13
14 inline int toInt(WebPointerProperties::PointerType t) { return static_cast<int>( t); } 14 inline int toInt(WebPointerProperties::PointerType t) { return static_cast<int>( t); }
15 15
16 const char* pointerTypeNameForWebPointPointerType(WebPointerProperties::PointerT ype type) 16 const char* pointerTypeNameForWebPointPointerType(WebPointerProperties::PointerT ype type)
17 { 17 {
18 switch (type) { 18 switch (type) {
19 case WebPointerProperties::PointerType::Unknown: 19 case WebPointerProperties::PointerType::Unknown:
20 return ""; 20 return "";
21 case WebPointerProperties::PointerType::Touch: 21 case WebPointerProperties::PointerType::Touch:
22 return "touch"; 22 return "touch";
23 case WebPointerProperties::PointerType::Pen: 23 case WebPointerProperties::PointerType::Pen:
24 case WebPointerProperties::PointerType::Eraser:
24 return "pen"; 25 return "pen";
25 case WebPointerProperties::PointerType::Mouse: 26 case WebPointerProperties::PointerType::Mouse:
26 return "mouse"; 27 return "mouse";
27 } 28 }
28 NOTREACHED(); 29 NOTREACHED();
29 return ""; 30 return "";
30 } 31 }
31 32
32 const AtomicString& pointerEventNameForMouseEventName( 33 const AtomicString& pointerEventNameForMouseEventName(
33 const AtomicString& mouseEventName) 34 const AtomicString& mouseEventName)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 UIEventWithKeyState::setFromPlatformModifiers(pointerEventInit, mouseEvent.g etModifiers()); 156 UIEventWithKeyState::setFromPlatformModifiers(pointerEventInit, mouseEvent.g etModifiers());
156 157
157 // Make sure chorded buttons fire pointermove instead of pointerup/down. 158 // Make sure chorded buttons fire pointermove instead of pointerup/down.
158 if ((pointerEventName == EventTypeNames::pointerdown 159 if ((pointerEventName == EventTypeNames::pointerdown
159 && (buttons & ~buttonToButtonsBitfield(mouseEvent.pointerProperties().bu tton)) != 0) 160 && (buttons & ~buttonToButtonsBitfield(mouseEvent.pointerProperties().bu tton)) != 0)
160 || (pointerEventName == EventTypeNames::pointerup && buttons != 0)) 161 || (pointerEventName == EventTypeNames::pointerup && buttons != 0))
161 pointerEventName = EventTypeNames::pointermove; 162 pointerEventName = EventTypeNames::pointermove;
162 163
163 164
164 pointerEventInit.setView(view); 165 pointerEventInit.setView(view);
165 166 LOG(ERROR) << "PointerEventFactory::create. Pointer: " << static_cast<int>(m ouseEvent.pointerProperties().pointerType);
166 return PointerEvent::create(pointerEventName, pointerEventInit); 167 return PointerEvent::create(pointerEventName, pointerEventInit);
167 } 168 }
168 169
169 PointerEvent* PointerEventFactory::create(const AtomicString& type, 170 PointerEvent* PointerEventFactory::create(const AtomicString& type,
170 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers, 171 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers,
171 const FloatSize& pointRadius, 172 const FloatSize& pointRadius,
172 const FloatPoint& clientPoint, 173 const FloatPoint& clientPoint,
173 DOMWindow* view) 174 DOMWindow* view)
174 { 175 {
175 const PlatformTouchPoint::TouchState pointState = touchPoint.state(); 176 const PlatformTouchPoint::TouchState pointState = touchPoint.state();
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (properties.pointerType 395 if (properties.pointerType
395 == WebPointerProperties::PointerType::Mouse) 396 == WebPointerProperties::PointerType::Mouse)
396 return PointerEventFactory::s_mouseId; 397 return PointerEventFactory::s_mouseId;
397 IncomingId id(properties.pointerType, properties.id); 398 IncomingId id(properties.pointerType, properties.id);
398 if (m_pointerIncomingIdMapping.contains(id)) 399 if (m_pointerIncomingIdMapping.contains(id))
399 return m_pointerIncomingIdMapping.get(id); 400 return m_pointerIncomingIdMapping.get(id);
400 return PointerEventFactory::s_invalidId; 401 return PointerEventFactory::s_invalidId;
401 } 402 }
402 403
403 } // namespace blink 404 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698