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