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

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

Issue 1968653005: Set width=height=1 of mouse like pointer events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 "platform/geometry/FloatSize.h" 7 #include "platform/geometry/FloatSize.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 const AtomicString& pointerEventNameForMouseEventName( 31 const AtomicString& pointerEventNameForMouseEventName(
32 const AtomicString& mouseEventName) 32 const AtomicString& mouseEventName)
33 { 33 {
34 #define RETURN_CORRESPONDING_PE_NAME(eventSuffix) \ 34 #define RETURN_CORRESPONDING_PE_NAME(eventSuffix) \
35 if (mouseEventName == EventTypeNames::mouse##eventSuffix) {\ 35 if (mouseEventName == EventTypeNames::mouse##eventSuffix) {\
36 return EventTypeNames::pointer##eventSuffix;\ 36 return EventTypeNames::pointer##eventSuffix;\
37 } 37 }
38 38
39 RETURN_CORRESPONDING_PE_NAME(down); 39 RETURN_CORRESPONDING_PE_NAME(down);
40 RETURN_CORRESPONDING_PE_NAME(enter);
mustaq 2016/05/11 20:42:57 Let's leave them as is. There's no harm in keeping
Navid Zolghadr 2016/05/11 20:50:20 Sure. I will add a DCHECK separately in the create
Navid Zolghadr 2016/05/12 20:13:21 Done.
41 RETURN_CORRESPONDING_PE_NAME(leave);
42 RETURN_CORRESPONDING_PE_NAME(move); 40 RETURN_CORRESPONDING_PE_NAME(move);
43 RETURN_CORRESPONDING_PE_NAME(out);
44 RETURN_CORRESPONDING_PE_NAME(over);
45 RETURN_CORRESPONDING_PE_NAME(up); 41 RETURN_CORRESPONDING_PE_NAME(up);
46 42
47 #undef RETURN_CORRESPONDING_PE_NAME 43 #undef RETURN_CORRESPONDING_PE_NAME
48 44
49 ASSERT_NOT_REACHED(); 45 ASSERT_NOT_REACHED();
50 return emptyAtom; 46 return emptyAtom;
51 } 47 }
52 48
53 } // namespace 49 } // namespace
54 50
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 setBubblesAndCancelable(pointerEventInit, pointerEventName); 95 setBubblesAndCancelable(pointerEventInit, pointerEventName);
100 96
101 pointerEventInit.setScreenX(mouseEvent.globalPosition().x()); 97 pointerEventInit.setScreenX(mouseEvent.globalPosition().x());
102 pointerEventInit.setScreenY(mouseEvent.globalPosition().y()); 98 pointerEventInit.setScreenY(mouseEvent.globalPosition().y());
103 pointerEventInit.setClientX(mouseEvent.position().x()); 99 pointerEventInit.setClientX(mouseEvent.position().x());
104 pointerEventInit.setClientY(mouseEvent.position().y()); 100 pointerEventInit.setClientY(mouseEvent.position().y());
105 101
106 if (pointerEventName == EventTypeNames::pointerdown 102 if (pointerEventName == EventTypeNames::pointerdown
107 || pointerEventName == EventTypeNames::pointerup) { 103 || pointerEventName == EventTypeNames::pointerup) {
108 pointerEventInit.setButton(mouseEvent.button()); 104 pointerEventInit.setButton(mouseEvent.button());
109 } else { 105 } else { // Only when pointerEventName == EventTypeNames::pointermove
mustaq 2016/05/11 20:42:57 The comment is not 100% correct: we are actually h
Navid Zolghadr 2016/05/11 20:50:20 No. The boundary events use another create functio
mustaq 2016/05/12 14:03:09 The create() call in sendMouseAndPossiblyPointerNo
Navid Zolghadr 2016/05/12 14:36:43 I'm not quite sure about the source of confusion h
Navid Zolghadr 2016/05/12 20:13:21 Done.
110 // TODO(crbug.com/587955): We are setting NoButton for transition
111 // pointerevents should be resolved as part of this bug
112 pointerEventInit.setButton(NoButton); 106 pointerEventInit.setButton(NoButton);
113 } 107 }
114 pointerEventInit.setPressure(getPointerEventPressure( 108 pointerEventInit.setPressure(getPointerEventPressure(
115 mouseEvent.pointerProperties().force, pointerEventInit.buttons())); 109 mouseEvent.pointerProperties().force, pointerEventInit.buttons()));
116 110
111 // Set width/height to 1 because we don't get any information from lower
mustaq 2016/05/11 20:42:57 "...because it matches Edge (and supported by the
Navid Zolghadr 2016/05/11 20:50:20 Sure.
Navid Zolghadr 2016/05/12 20:13:21 Done.
112 // lever APIs.
113 pointerEventInit.setWidth(1);
114 pointerEventInit.setHeight(1);
115
117 UIEventWithKeyState::setFromPlatformModifiers(pointerEventInit, mouseEvent.g etModifiers()); 116 UIEventWithKeyState::setFromPlatformModifiers(pointerEventInit, mouseEvent.g etModifiers());
118 117
119 // Make sure chorded buttons fire pointermove instead of pointerup/down. 118 // Make sure chorded buttons fire pointermove instead of pointerup/down.
120 if ((pointerEventName == EventTypeNames::pointerdown 119 if ((pointerEventName == EventTypeNames::pointerdown
121 && (buttons & ~MouseEvent::buttonToButtons(mouseEvent.button())) != 0) 120 && (buttons & ~MouseEvent::buttonToButtons(mouseEvent.button())) != 0)
122 || (pointerEventName == EventTypeNames::pointerup && buttons != 0)) 121 || (pointerEventName == EventTypeNames::pointerup && buttons != 0))
123 pointerEventName = EventTypeNames::pointermove; 122 pointerEventName = EventTypeNames::pointermove;
124 123
125 124
126 pointerEventInit.setView(view); 125 pointerEventInit.setView(view);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 if (properties.pointerType 362 if (properties.pointerType
364 == WebPointerProperties::PointerType::Mouse) 363 == WebPointerProperties::PointerType::Mouse)
365 return PointerEventFactory::s_mouseId; 364 return PointerEventFactory::s_mouseId;
366 IncomingId id(properties.pointerType, properties.id); 365 IncomingId id(properties.pointerType, properties.id);
367 if (m_pointerIncomingIdMapping.contains(id)) 366 if (m_pointerIncomingIdMapping.contains(id))
368 return m_pointerIncomingIdMapping.get(id); 367 return m_pointerIncomingIdMapping.get(id);
369 return PointerEventFactory::s_invalidId; 368 return PointerEventFactory::s_invalidId;
370 } 369 }
371 370
372 } // namespace blink 371 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698