| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 while (!layout_object->IsSVGRoot()) | 71 while (!layout_object->IsSVGRoot()) |
| 72 layout_object = layout_object->Parent(); | 72 layout_object = layout_object->Parent(); |
| 73 // Update the target node to point to the SVG root. | 73 // Update the target node to point to the SVG root. |
| 74 target_node = layout_object->GetNode(); | 74 target_node = layout_object->GetNode(); |
| 75 DCHECK(!target_node || | 75 DCHECK(!target_node || |
| 76 (target_node->IsSVGElement() && | 76 (target_node->IsSVGElement() && |
| 77 ToSVGElement(*target_node).IsOutermostSVGSVGElement())); | 77 ToSVGElement(*target_node).IsOutermostSVGSVGElement())); |
| 78 return layout_object; | 78 return layout_object; |
| 79 } | 79 } |
| 80 | 80 |
| 81 unsigned short WebPointerPropertiesButtonToButton( |
| 82 const AtomicString& event_name, |
| 83 WebPointerProperties::Button button) { |
| 84 if (event_name == EventTypeNames::mousemove || |
| 85 event_name == EventTypeNames::mouseleave || |
| 86 event_name == EventTypeNames::mouseenter || |
| 87 event_name == EventTypeNames::mouseover || |
| 88 event_name == EventTypeNames::mouseout) { |
| 89 return 0; |
| 90 } |
| 91 return static_cast<unsigned short>(button); |
| 92 } |
| 93 |
| 81 } // namespace | 94 } // namespace |
| 82 | 95 |
| 83 MouseEvent* MouseEvent::Create(ScriptState* script_state, | 96 MouseEvent* MouseEvent::Create(ScriptState* script_state, |
| 84 const AtomicString& type, | 97 const AtomicString& type, |
| 85 const MouseEventInit& initializer) { | 98 const MouseEventInit& initializer) { |
| 86 if (script_state && script_state->World().IsIsolatedWorld()) | 99 if (script_state && script_state->World().IsIsolatedWorld()) |
| 87 UIEventWithKeyState::DidCreateEventInIsolatedWorld( | 100 UIEventWithKeyState::DidCreateEventInIsolatedWorld( |
| 88 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), | 101 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), |
| 89 initializer.metaKey()); | 102 initializer.metaKey()); |
| 90 return new MouseEvent(type, initializer); | 103 return new MouseEvent(type, initializer); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 detail, | 179 detail, |
| 167 static_cast<WebInputEvent::Modifiers>(event.GetModifiers()), | 180 static_cast<WebInputEvent::Modifiers>(event.GetModifiers()), |
| 168 TimeTicks::FromSeconds(event.TimeStampSeconds()), | 181 TimeTicks::FromSeconds(event.TimeStampSeconds()), |
| 169 abstract_view | 182 abstract_view |
| 170 ? abstract_view->GetInputDeviceCapabilities()->FiresTouchEvents( | 183 ? abstract_view->GetInputDeviceCapabilities()->FiresTouchEvents( |
| 171 event.FromTouch()) | 184 event.FromTouch()) |
| 172 : nullptr), | 185 : nullptr), |
| 173 screen_location_(event.PositionInScreen().x, event.PositionInScreen().y), | 186 screen_location_(event.PositionInScreen().x, event.PositionInScreen().y), |
| 174 movement_delta_(FlooredIntPoint(event.MovementInRootFrame())), | 187 movement_delta_(FlooredIntPoint(event.MovementInRootFrame())), |
| 175 position_type_(PositionType::kPosition), | 188 position_type_(PositionType::kPosition), |
| 176 button_(static_cast<short>(event.button)), | 189 button_(WebPointerPropertiesButtonToButton(event_type, event.button)), |
| 177 buttons_(WebInputEventModifiersToButtons(event.GetModifiers())), | 190 buttons_(WebInputEventModifiersToButtons(event.GetModifiers())), |
| 178 related_target_(related_target), | 191 related_target_(related_target), |
| 179 synthetic_event_type_(event.FromTouch() ? kFromTouch | 192 synthetic_event_type_(event.FromTouch() ? kFromTouch |
| 180 : kRealOrIndistinguishable), | 193 : kRealOrIndistinguishable), |
| 181 region_(region) { | 194 region_(region) { |
| 182 IntPoint root_frame_coordinates = | 195 IntPoint root_frame_coordinates = |
| 183 FlooredIntPoint(event.PositionInRootFrame()); | 196 FlooredIntPoint(event.PositionInRootFrame()); |
| 184 InitCoordinatesFromRootFrame(root_frame_coordinates.X(), | 197 InitCoordinatesFromRootFrame(root_frame_coordinates.X(), |
| 185 root_frame_coordinates.Y()); | 198 root_frame_coordinates.Y()); |
| 186 } | 199 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 599 |
| 587 int MouseEvent::offsetY() { | 600 int MouseEvent::offsetY() { |
| 588 if (!HasPosition()) | 601 if (!HasPosition()) |
| 589 return 0; | 602 return 0; |
| 590 if (!has_cached_relative_position_) | 603 if (!has_cached_relative_position_) |
| 591 ComputeRelativePosition(); | 604 ComputeRelativePosition(); |
| 592 return std::round(offset_location_.Y()); | 605 return std::round(offset_location_.Y()); |
| 593 } | 606 } |
| 594 | 607 |
| 595 } // namespace blink | 608 } // namespace blink |
| OLD | NEW |