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

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

Issue 2406263003: Make PointerEvent coordinates fractional for touch (Closed)
Patch Set: Rebased. Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 modifiers = keyStateEvent->modifiers(); 97 modifiers = keyStateEvent->modifiers();
98 } 98 }
99 99
100 PlatformMouseEvent::SyntheticEventType syntheticType = 100 PlatformMouseEvent::SyntheticEventType syntheticType =
101 PlatformMouseEvent::Positionless; 101 PlatformMouseEvent::Positionless;
102 int screenX = 0; 102 int screenX = 0;
103 int screenY = 0; 103 int screenY = 0;
104 if (underlyingEvent && underlyingEvent->isMouseEvent()) { 104 if (underlyingEvent && underlyingEvent->isMouseEvent()) {
105 syntheticType = PlatformMouseEvent::RealOrIndistinguishable; 105 syntheticType = PlatformMouseEvent::RealOrIndistinguishable;
106 MouseEvent* mouseEvent = toMouseEvent(underlyingEvent); 106 MouseEvent* mouseEvent = toMouseEvent(underlyingEvent);
107 screenX = mouseEvent->screenLocation().x(); 107 screenX = mouseEvent->screenX();
108 screenY = mouseEvent->screenLocation().y(); 108 screenY = mouseEvent->screenY();
109 } 109 }
110 110
111 double timestamp = underlyingEvent ? underlyingEvent->platformTimeStamp() 111 double timestamp = underlyingEvent ? underlyingEvent->platformTimeStamp()
112 : monotonicallyIncreasingTime(); 112 : monotonicallyIncreasingTime();
113 MouseEvent* createdEvent = MouseEvent::create( 113 MouseEvent* createdEvent = MouseEvent::create(
114 eventType, true, true, view, 0, screenX, screenY, 0, 0, 0, 0, modifiers, 114 eventType, true, true, view, 0, screenX, screenY, 0, 0, 0, 0, modifiers,
115 0, 0, nullptr, timestamp, syntheticType, String(), nullptr); 115 0, 0, nullptr, timestamp, syntheticType, String(), nullptr);
116 116
117 createdEvent->setTrusted(creationScope == 117 createdEvent->setTrusted(creationScope ==
118 SimulatedClickCreationScope::FromUserAgent); 118 SimulatedClickCreationScope::FromUserAgent);
119 createdEvent->setUnderlyingEvent(underlyingEvent); 119 createdEvent->setUnderlyingEvent(underlyingEvent);
120 if (syntheticType == PlatformMouseEvent::RealOrIndistinguishable) { 120 if (syntheticType == PlatformMouseEvent::RealOrIndistinguishable) {
121 MouseEvent* mouseEvent = toMouseEvent(createdEvent->underlyingEvent()); 121 MouseEvent* mouseEvent = toMouseEvent(createdEvent->underlyingEvent());
122 createdEvent->initCoordinates(mouseEvent->clientLocation()); 122 createdEvent->initCoordinates(mouseEvent->clientX(), mouseEvent->clientY());
123 } 123 }
124 124
125 return createdEvent; 125 return createdEvent;
126 } 126 }
127 127
128 MouseEvent::MouseEvent() 128 MouseEvent::MouseEvent()
129 : m_button(0), 129 : m_button(0),
130 m_buttons(0), 130 m_buttons(0),
131 m_relatedTarget(nullptr), 131 m_relatedTarget(nullptr),
132 m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) {} 132 m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) {}
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 unsigned short buttons) { 251 unsigned short buttons) {
252 initUIEventInternal(type, canBubble, cancelable, relatedTarget, view, detail, 252 initUIEventInternal(type, canBubble, cancelable, relatedTarget, view, detail,
253 sourceCapabilities); 253 sourceCapabilities);
254 254
255 m_screenLocation = IntPoint(screenX, screenY); 255 m_screenLocation = IntPoint(screenX, screenY);
256 m_button = button; 256 m_button = button;
257 m_buttons = buttons; 257 m_buttons = buttons;
258 m_relatedTarget = relatedTarget; 258 m_relatedTarget = relatedTarget;
259 m_modifiers = modifiers; 259 m_modifiers = modifiers;
260 260
261 initCoordinates(IntPoint(clientX, clientY)); 261 initCoordinates(clientX, clientY);
262 262
263 // FIXME: SyntheticEventType is not set to RealOrIndistinguishable here. 263 // FIXME: SyntheticEventType is not set to RealOrIndistinguishable here.
264 } 264 }
265 265
266 const AtomicString& MouseEvent::interfaceName() const { 266 const AtomicString& MouseEvent::interfaceName() const {
267 return EventNames::MouseEvent; 267 return EventNames::MouseEvent;
268 } 268 }
269 269
270 bool MouseEvent::isMouseEvent() const { 270 bool MouseEvent::isMouseEvent() const {
271 return true; 271 return true;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 DispatchEventResult doubleClickDispatchResult = 366 DispatchEventResult doubleClickDispatchResult =
367 EventDispatcher::dispatchEvent( 367 EventDispatcher::dispatchEvent(
368 dispatcher.node(), 368 dispatcher.node(),
369 MouseEventDispatchMediator::create(doubleClickEvent)); 369 MouseEventDispatchMediator::create(doubleClickEvent));
370 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled) 370 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled)
371 return doubleClickDispatchResult; 371 return doubleClickDispatchResult;
372 return dispatchResult; 372 return dispatchResult;
373 } 373 }
374 374
375 } // namespace blink 375 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698