| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool isCancelable = !isMouseEnterOrLeave; | 100 bool isCancelable = !isMouseEnterOrLeave; |
| 101 bool isBubbling = !isMouseEnterOrLeave; | 101 bool isBubbling = !isMouseEnterOrLeave; |
| 102 return new MouseEvent(eventType, isBubbling, isCancelable, view, event, | 102 return new MouseEvent(eventType, isBubbling, isCancelable, view, event, |
| 103 detail, canvasRegionId, relatedTarget); | 103 detail, canvasRegionId, relatedTarget); |
| 104 } | 104 } |
| 105 | 105 |
| 106 MouseEvent* MouseEvent::create(const AtomicString& eventType, | 106 MouseEvent* MouseEvent::create(const AtomicString& eventType, |
| 107 AbstractView* view, | 107 AbstractView* view, |
| 108 Event* underlyingEvent, | 108 Event* underlyingEvent, |
| 109 SimulatedClickCreationScope creationScope) { | 109 SimulatedClickCreationScope creationScope) { |
| 110 PlatformEvent::Modifiers modifiers = PlatformEvent::NoModifiers; | 110 WebInputEvent::Modifiers modifiers = WebInputEvent::NoModifiers; |
| 111 if (UIEventWithKeyState* keyStateEvent = | 111 if (UIEventWithKeyState* keyStateEvent = |
| 112 findEventWithKeyState(underlyingEvent)) { | 112 findEventWithKeyState(underlyingEvent)) { |
| 113 modifiers = keyStateEvent->modifiers(); | 113 modifiers = keyStateEvent->modifiers(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 SyntheticEventType syntheticType = Positionless; | 116 SyntheticEventType syntheticType = Positionless; |
| 117 int screenX = 0; | 117 int screenX = 0; |
| 118 int screenY = 0; | 118 int screenY = 0; |
| 119 if (underlyingEvent && underlyingEvent->isMouseEvent()) { | 119 if (underlyingEvent && underlyingEvent->isMouseEvent()) { |
| 120 syntheticType = RealOrIndistinguishable; | 120 syntheticType = RealOrIndistinguishable; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const WebMouseEvent& event, | 155 const WebMouseEvent& event, |
| 156 int detail, | 156 int detail, |
| 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<WebInputEvent::Modifiers>(event.modifiers()), |
| 166 TimeTicks::FromSeconds(event.timeStampSeconds()), | 166 TimeTicks::FromSeconds(event.timeStampSeconds()), |
| 167 abstractView | 167 abstractView |
| 168 ? abstractView->getInputDeviceCapabilities()->firesTouchEvents( | 168 ? abstractView->getInputDeviceCapabilities()->firesTouchEvents( |
| 169 event.fromTouch()) | 169 event.fromTouch()) |
| 170 : nullptr), | 170 : nullptr), |
| 171 m_screenLocation(event.globalX, event.globalY), | 171 m_screenLocation(event.globalX, event.globalY), |
| 172 m_movementDelta(flooredIntPoint(event.movementInRootFrame())), | 172 m_movementDelta(flooredIntPoint(event.movementInRootFrame())), |
| 173 m_positionType(PositionType::Position), | 173 m_positionType(PositionType::Position), |
| 174 m_button(static_cast<short>(event.button)), | 174 m_button(static_cast<short>(event.button)), |
| 175 m_buttons(platformModifiersToButtons(event.modifiers())), | 175 m_buttons(webInputEventModifiersToButtons(event.modifiers())), |
| 176 m_relatedTarget(relatedTarget), | 176 m_relatedTarget(relatedTarget), |
| 177 m_syntheticEventType(event.fromTouch() ? FromTouch | 177 m_syntheticEventType(event.fromTouch() ? FromTouch |
| 178 : RealOrIndistinguishable), | 178 : RealOrIndistinguishable), |
| 179 m_region(region) { | 179 m_region(region) { |
| 180 IntPoint rootFrameCoordinates = flooredIntPoint(event.positionInRootFrame()); | 180 IntPoint rootFrameCoordinates = flooredIntPoint(event.positionInRootFrame()); |
| 181 initCoordinatesFromRootFrame(rootFrameCoordinates.x(), | 181 initCoordinatesFromRootFrame(rootFrameCoordinates.x(), |
| 182 rootFrameCoordinates.y()); | 182 rootFrameCoordinates.y()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 MouseEvent::MouseEvent(const AtomicString& eventType, | 185 MouseEvent::MouseEvent(const AtomicString& eventType, |
| 186 bool canBubble, | 186 bool canBubble, |
| 187 bool cancelable, | 187 bool cancelable, |
| 188 AbstractView* abstractView, | 188 AbstractView* abstractView, |
| 189 int detail, | 189 int detail, |
| 190 int screenX, | 190 int screenX, |
| 191 int screenY, | 191 int screenY, |
| 192 int windowX, | 192 int windowX, |
| 193 int windowY, | 193 int windowY, |
| 194 int movementX, | 194 int movementX, |
| 195 int movementY, | 195 int movementY, |
| 196 PlatformEvent::Modifiers modifiers, | 196 WebInputEvent::Modifiers modifiers, |
| 197 short button, | 197 short button, |
| 198 unsigned short buttons, | 198 unsigned short buttons, |
| 199 EventTarget* relatedTarget, | 199 EventTarget* relatedTarget, |
| 200 TimeTicks platformTimeStamp, | 200 TimeTicks platformTimeStamp, |
| 201 SyntheticEventType syntheticEventType, | 201 SyntheticEventType syntheticEventType, |
| 202 const String& region) | 202 const String& region) |
| 203 : UIEventWithKeyState( | 203 : UIEventWithKeyState( |
| 204 eventType, | 204 eventType, |
| 205 canBubble, | 205 canBubble, |
| 206 cancelable, | 206 cancelable, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Correct values are computed lazily, see computeRelativePosition. | 281 // Correct values are computed lazily, see computeRelativePosition. |
| 282 m_layerLocation = m_pageLocation; | 282 m_layerLocation = m_pageLocation; |
| 283 m_offsetLocation = m_pageLocation; | 283 m_offsetLocation = m_pageLocation; |
| 284 | 284 |
| 285 computePageLocation(); | 285 computePageLocation(); |
| 286 m_hasCachedRelativePosition = false; | 286 m_hasCachedRelativePosition = false; |
| 287 } | 287 } |
| 288 | 288 |
| 289 MouseEvent::~MouseEvent() {} | 289 MouseEvent::~MouseEvent() {} |
| 290 | 290 |
| 291 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) { | 291 unsigned short MouseEvent::webInputEventModifiersToButtons(unsigned modifiers) { |
| 292 unsigned short buttons = 0; | 292 unsigned short buttons = 0; |
| 293 | 293 |
| 294 if (modifiers & PlatformEvent::LeftButtonDown) | 294 if (modifiers & WebInputEvent::LeftButtonDown) |
| 295 buttons |= static_cast<unsigned short>(WebPointerProperties::Buttons::Left); | 295 buttons |= static_cast<unsigned short>(WebPointerProperties::Buttons::Left); |
| 296 if (modifiers & PlatformEvent::RightButtonDown) | 296 if (modifiers & WebInputEvent::RightButtonDown) |
| 297 buttons |= | 297 buttons |= |
| 298 static_cast<unsigned short>(WebPointerProperties::Buttons::Right); | 298 static_cast<unsigned short>(WebPointerProperties::Buttons::Right); |
| 299 if (modifiers & PlatformEvent::MiddleButtonDown) | 299 if (modifiers & WebInputEvent::MiddleButtonDown) |
| 300 buttons |= | 300 buttons |= |
| 301 static_cast<unsigned short>(WebPointerProperties::Buttons::Middle); | 301 static_cast<unsigned short>(WebPointerProperties::Buttons::Middle); |
| 302 | 302 |
| 303 return buttons; | 303 return buttons; |
| 304 } | 304 } |
| 305 | 305 |
| 306 void MouseEvent::initMouseEvent(ScriptState* scriptState, | 306 void MouseEvent::initMouseEvent(ScriptState* scriptState, |
| 307 const AtomicString& type, | 307 const AtomicString& type, |
| 308 bool canBubble, | 308 bool canBubble, |
| 309 bool cancelable, | 309 bool cancelable, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 336 void MouseEvent::initMouseEventInternal( | 336 void MouseEvent::initMouseEventInternal( |
| 337 const AtomicString& type, | 337 const AtomicString& type, |
| 338 bool canBubble, | 338 bool canBubble, |
| 339 bool cancelable, | 339 bool cancelable, |
| 340 AbstractView* view, | 340 AbstractView* view, |
| 341 int detail, | 341 int detail, |
| 342 int screenX, | 342 int screenX, |
| 343 int screenY, | 343 int screenY, |
| 344 int clientX, | 344 int clientX, |
| 345 int clientY, | 345 int clientY, |
| 346 PlatformEvent::Modifiers modifiers, | 346 WebInputEvent::Modifiers modifiers, |
| 347 short button, | 347 short button, |
| 348 EventTarget* relatedTarget, | 348 EventTarget* relatedTarget, |
| 349 InputDeviceCapabilities* sourceCapabilities, | 349 InputDeviceCapabilities* sourceCapabilities, |
| 350 unsigned short buttons) { | 350 unsigned short buttons) { |
| 351 initUIEventInternal(type, canBubble, cancelable, relatedTarget, view, detail, | 351 initUIEventInternal(type, canBubble, cancelable, relatedTarget, view, detail, |
| 352 sourceCapabilities); | 352 sourceCapabilities); |
| 353 | 353 |
| 354 m_screenLocation = IntPoint(screenX, screenY); | 354 m_screenLocation = IntPoint(screenX, screenY); |
| 355 m_button = button; | 355 m_button = button; |
| 356 m_buttons = buttons; | 356 m_buttons = buttons; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 562 |
| 563 int MouseEvent::offsetY() { | 563 int MouseEvent::offsetY() { |
| 564 if (!hasPosition()) | 564 if (!hasPosition()) |
| 565 return 0; | 565 return 0; |
| 566 if (!m_hasCachedRelativePosition) | 566 if (!m_hasCachedRelativePosition) |
| 567 computeRelativePosition(); | 567 computeRelativePosition(); |
| 568 return std::round(m_offsetLocation.y()); | 568 return std::round(m_offsetLocation.y()); |
| 569 } | 569 } |
| 570 | 570 |
| 571 } // namespace blink | 571 } // namespace blink |
| OLD | NEW |