OLD | NEW |
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 146 matching lines...) Loading... |
157 const String& region, | 157 const String& region, |
158 EventTarget* relatedTarget) | 158 EventTarget* relatedTarget) |
159 : UIEventWithKeyState( | 159 : UIEventWithKeyState( |
160 eventType, | 160 eventType, |
161 canBubble, | 161 canBubble, |
162 cancelable, | 162 cancelable, |
163 abstractView, | 163 abstractView, |
164 detail, | 164 detail, |
165 static_cast<PlatformEvent::Modifiers>(event.modifiers()), | 165 static_cast<PlatformEvent::Modifiers>(event.modifiers()), |
166 TimeTicks::FromSeconds(event.timeStampSeconds()), | 166 TimeTicks::FromSeconds(event.timeStampSeconds()), |
167 abstractView | 167 InputDeviceCapabilitiesValue(event.fromTouch())), |
168 ? abstractView->getInputDeviceCapabilities()->firesTouchEvents( | |
169 event.fromTouch()) | |
170 : nullptr), | |
171 m_screenLocation(event.globalX, event.globalY), | 168 m_screenLocation(event.globalX, event.globalY), |
172 m_movementDelta(flooredIntPoint(event.movementInRootFrame())), | 169 m_movementDelta(flooredIntPoint(event.movementInRootFrame())), |
173 m_positionType(PositionType::Position), | 170 m_positionType(PositionType::Position), |
174 m_button(static_cast<short>(event.button)), | 171 m_button(static_cast<short>(event.button)), |
175 m_buttons(platformModifiersToButtons(event.modifiers())), | 172 m_buttons(platformModifiersToButtons(event.modifiers())), |
176 m_relatedTarget(relatedTarget), | 173 m_relatedTarget(relatedTarget), |
177 m_syntheticEventType(event.fromTouch() ? FromTouch | 174 m_syntheticEventType(event.fromTouch() ? FromTouch |
178 : RealOrIndistinguishable), | 175 : RealOrIndistinguishable), |
179 m_region(region) { | 176 m_region(region) { |
180 IntPoint rootFrameCoordinates = flooredIntPoint(event.positionInRootFrame()); | 177 IntPoint rootFrameCoordinates = flooredIntPoint(event.positionInRootFrame()); |
(...skipping 20 matching lines...) Loading... |
201 SyntheticEventType syntheticEventType, | 198 SyntheticEventType syntheticEventType, |
202 const String& region) | 199 const String& region) |
203 : UIEventWithKeyState( | 200 : UIEventWithKeyState( |
204 eventType, | 201 eventType, |
205 canBubble, | 202 canBubble, |
206 cancelable, | 203 cancelable, |
207 abstractView, | 204 abstractView, |
208 detail, | 205 detail, |
209 modifiers, | 206 modifiers, |
210 platformTimeStamp, | 207 platformTimeStamp, |
211 abstractView | 208 InputDeviceCapabilitiesValue(syntheticEventType == FromTouch)), |
212 ? abstractView->getInputDeviceCapabilities()->firesTouchEvents( | |
213 syntheticEventType == FromTouch) | |
214 : nullptr), | |
215 m_screenLocation(screenX, screenY), | 209 m_screenLocation(screenX, screenY), |
216 m_movementDelta(movementX, movementY), | 210 m_movementDelta(movementX, movementY), |
217 m_positionType(syntheticEventType == Positionless | 211 m_positionType(syntheticEventType == Positionless |
218 ? PositionType::Positionless | 212 ? PositionType::Positionless |
219 : PositionType::Position), | 213 : PositionType::Position), |
220 m_button(button), | 214 m_button(button), |
221 m_buttons(buttons), | 215 m_buttons(buttons), |
222 m_relatedTarget(relatedTarget), | 216 m_relatedTarget(relatedTarget), |
223 m_syntheticEventType(syntheticEventType), | 217 m_syntheticEventType(syntheticEventType), |
224 m_region(region) { | 218 m_region(region) { |
(...skipping 98 matching lines...) Loading... |
323 if (isBeingDispatched()) | 317 if (isBeingDispatched()) |
324 return; | 318 return; |
325 | 319 |
326 if (scriptState && scriptState->world().isIsolatedWorld()) | 320 if (scriptState && scriptState->world().isIsolatedWorld()) |
327 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, | 321 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, |
328 shiftKey, metaKey); | 322 shiftKey, metaKey); |
329 | 323 |
330 initModifiers(ctrlKey, altKey, shiftKey, metaKey); | 324 initModifiers(ctrlKey, altKey, shiftKey, metaKey); |
331 initMouseEventInternal(type, canBubble, cancelable, view, detail, screenX, | 325 initMouseEventInternal(type, canBubble, cancelable, view, detail, screenX, |
332 screenY, clientX, clientY, modifiers(), button, | 326 screenY, clientX, clientY, modifiers(), button, |
333 relatedTarget, nullptr, buttons); | 327 relatedTarget, InputDeviceCapabilities::Null, buttons); |
334 } | 328 } |
335 | 329 |
336 void MouseEvent::initMouseEventInternal( | 330 void MouseEvent::initMouseEventInternal( |
337 const AtomicString& type, | 331 const AtomicString& type, |
338 bool canBubble, | 332 bool canBubble, |
339 bool cancelable, | 333 bool cancelable, |
340 AbstractView* view, | 334 AbstractView* view, |
341 int detail, | 335 int detail, |
342 int screenX, | 336 int screenX, |
343 int screenY, | 337 int screenY, |
344 int clientX, | 338 int clientX, |
345 int clientY, | 339 int clientY, |
346 PlatformEvent::Modifiers modifiers, | 340 PlatformEvent::Modifiers modifiers, |
347 short button, | 341 short button, |
348 EventTarget* relatedTarget, | 342 EventTarget* relatedTarget, |
349 InputDeviceCapabilities* sourceCapabilities, | 343 const InputDeviceCapabilitiesValue& sourceCapabilities, |
350 unsigned short buttons) { | 344 unsigned short buttons) { |
351 initUIEventInternal(type, canBubble, cancelable, relatedTarget, view, detail, | 345 initUIEventInternal(type, canBubble, cancelable, relatedTarget, view, detail, |
352 sourceCapabilities); | 346 sourceCapabilities); |
353 | 347 |
354 m_screenLocation = IntPoint(screenX, screenY); | 348 m_screenLocation = IntPoint(screenX, screenY); |
355 m_button = button; | 349 m_button = button; |
356 m_buttons = buttons; | 350 m_buttons = buttons; |
357 m_relatedTarget = relatedTarget; | 351 m_relatedTarget = relatedTarget; |
358 m_modifiers = modifiers; | 352 m_modifiers = modifiers; |
359 | 353 |
(...skipping 88 matching lines...) Loading... |
448 // Special case: If it's a double click event, we also send the dblclick | 442 // Special case: If it's a double click event, we also send the dblclick |
449 // event. This is not part of the DOM specs, but is used for compatibility | 443 // event. This is not part of the DOM specs, but is used for compatibility |
450 // with the ondblclick="" attribute. This is treated as a separate event in | 444 // with the ondblclick="" attribute. This is treated as a separate event in |
451 // other DOM-compliant browsers like Firefox, and so we do the same. | 445 // other DOM-compliant browsers like Firefox, and so we do the same. |
452 MouseEvent* doubleClickEvent = MouseEvent::create(); | 446 MouseEvent* doubleClickEvent = MouseEvent::create(); |
453 doubleClickEvent->initMouseEventInternal( | 447 doubleClickEvent->initMouseEventInternal( |
454 EventTypeNames::dblclick, mouseEvent.bubbles(), mouseEvent.cancelable(), | 448 EventTypeNames::dblclick, mouseEvent.bubbles(), mouseEvent.cancelable(), |
455 mouseEvent.view(), mouseEvent.detail(), mouseEvent.screenX(), | 449 mouseEvent.view(), mouseEvent.detail(), mouseEvent.screenX(), |
456 mouseEvent.screenY(), mouseEvent.clientX(), mouseEvent.clientY(), | 450 mouseEvent.screenY(), mouseEvent.clientX(), mouseEvent.clientY(), |
457 mouseEvent.modifiers(), mouseEvent.button(), relatedTarget, | 451 mouseEvent.modifiers(), mouseEvent.button(), relatedTarget, |
458 mouseEvent.sourceCapabilities(), mouseEvent.buttons()); | 452 mouseEvent.sourceCapabilitiesValue(), mouseEvent.buttons()); |
459 doubleClickEvent->setComposed(mouseEvent.composed()); | 453 doubleClickEvent->setComposed(mouseEvent.composed()); |
460 | 454 |
461 // Inherit the trusted status from the original event. | 455 // Inherit the trusted status from the original event. |
462 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); | 456 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); |
463 if (mouseEvent.defaultHandled()) | 457 if (mouseEvent.defaultHandled()) |
464 doubleClickEvent->setDefaultHandled(); | 458 doubleClickEvent->setDefaultHandled(); |
465 DispatchEventResult doubleClickDispatchResult = | 459 DispatchEventResult doubleClickDispatchResult = |
466 EventDispatcher::dispatchEvent( | 460 EventDispatcher::dispatchEvent( |
467 dispatcher.node(), | 461 dispatcher.node(), |
468 MouseEventDispatchMediator::create(doubleClickEvent)); | 462 MouseEventDispatchMediator::create(doubleClickEvent)); |
(...skipping 93 matching lines...) Loading... |
562 | 556 |
563 int MouseEvent::offsetY() { | 557 int MouseEvent::offsetY() { |
564 if (!hasPosition()) | 558 if (!hasPosition()) |
565 return 0; | 559 return 0; |
566 if (!m_hasCachedRelativePosition) | 560 if (!m_hasCachedRelativePosition) |
567 computeRelativePosition(); | 561 computeRelativePosition(); |
568 return std::round(m_offsetLocation.y()); | 562 return std::round(m_offsetLocation.y()); |
569 } | 563 } |
570 | 564 |
571 } // namespace blink | 565 } // namespace blink |
OLD | NEW |