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

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

Issue 1654653002: Canvas2d: Implement rerouting event by hit region's control. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT ype == EventTypeNames::mouseleave; 44 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT ype == EventTypeNames::mouseleave;
45 bool isCancelable = !isMouseEnterOrLeave; 45 bool isCancelable = !isMouseEnterOrLeave;
46 bool isBubbling = !isMouseEnterOrLeave; 46 bool isBubbling = !isMouseEnterOrLeave;
47 47
48 return MouseEvent::create( 48 return MouseEvent::create(
49 eventType, isBubbling, isCancelable, view, 49 eventType, isBubbling, isCancelable, view,
50 detail, event.globalPosition().x(), event.globalPosition().y(), event.po sition().x(), event.position().y(), 50 detail, event.globalPosition().x(), event.globalPosition().y(), event.po sition().x(), event.position().y(),
51 event.movementDelta().x(), event.movementDelta().y(), 51 event.movementDelta().x(), event.movementDelta().y(),
52 event.modifiers(), event.button(), 52 event.modifiers(), event.button(),
53 platformModifiersToButtons(event.modifiers()), 53 platformModifiersToButtons(event.modifiers()),
54 relatedTarget, event.timestamp(), event.syntheticEventType()); 54 relatedTarget, event.timestamp(), event.syntheticEventType(), event.regi on());
55 } 55 }
56 56
57 PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, 57 PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
58 int detail, int screenX, int screenY, int windowX, int windowY, 58 int detail, int screenX, int screenY, int windowX, int windowY,
59 int movementX, int movementY, 59 int movementX, int movementY,
60 PlatformEvent::Modifiers modifiers, 60 PlatformEvent::Modifiers modifiers,
61 short button, unsigned short buttons, 61 short button, unsigned short buttons,
62 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, 62 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget,
63 double platformTimeStamp, 63 double platformTimeStamp,
64 PlatformMouseEvent::SyntheticEventType syntheticEventType) 64 PlatformMouseEvent::SyntheticEventType syntheticEventType,
65 const String& region)
65 { 66 {
66 return adoptRefWillBeNoop(new MouseEvent(type, canBubble, cancelable, view, 67 return adoptRefWillBeNoop(new MouseEvent(type, canBubble, cancelable, view,
67 detail, screenX, screenY, windowX, windowY, 68 detail, screenX, screenY, windowX, windowY,
68 movementX, movementY, 69 movementX, movementY,
69 modifiers, button, buttons, relatedTarget, platformTimeStamp, syntheticE ventType)); 70 modifiers, button, buttons, relatedTarget, platformTimeStamp, syntheticE ventType, region));
70 } 71 }
71 72
72 PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& eventT ype, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> un derlyingEvent, SimulatedClickCreationScope creationScope) 73 PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& eventT ype, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> un derlyingEvent, SimulatedClickCreationScope creationScope)
73 { 74 {
74 PlatformEvent::Modifiers modifiers = PlatformEvent::NoModifiers; 75 PlatformEvent::Modifiers modifiers = PlatformEvent::NoModifiers;
75 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve nt.get())) { 76 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve nt.get())) {
76 modifiers = keyStateEvent->modifiers(); 77 modifiers = keyStateEvent->modifiers();
77 } 78 }
78 79
79 PlatformMouseEvent::SyntheticEventType syntheticType = PlatformMouseEvent::P ositionless; 80 PlatformMouseEvent::SyntheticEventType syntheticType = PlatformMouseEvent::P ositionless;
(...skipping 29 matching lines...) Expand all
109 { 110 {
110 } 111 }
111 112
112 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance lable, PassRefPtrWillBeRawPtr<AbstractView> view, 113 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance lable, PassRefPtrWillBeRawPtr<AbstractView> view,
113 int detail, int screenX, int screenY, int windowX, int windowY, 114 int detail, int screenX, int screenY, int windowX, int windowY,
114 int movementX, int movementY, 115 int movementX, int movementY,
115 PlatformEvent::Modifiers modifiers, 116 PlatformEvent::Modifiers modifiers,
116 short button, unsigned short buttons, 117 short button, unsigned short buttons,
117 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, 118 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget,
118 double platformTimeStamp, 119 double platformTimeStamp,
119 PlatformMouseEvent::SyntheticEventType syntheticEventType) 120 PlatformMouseEvent::SyntheticEventType syntheticEventType,
121 const String& region)
120 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint (screenX, screenY), 122 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint (screenX, screenY),
121 IntPoint(windowX, windowY), IntPoint(movementX, movementY), modifiers, 123 IntPoint(windowX, windowY), IntPoint(movementX, movementY), modifiers,
122 platformTimeStamp, 124 platformTimeStamp,
123 syntheticEventType == PlatformMouseEvent::Positionless ? PositionType::P ositionless : PositionType::Position, 125 syntheticEventType == PlatformMouseEvent::Positionless ? PositionType::P ositionless : PositionType::Position,
124 syntheticEventType == PlatformMouseEvent::FromTouch ? InputDeviceCapabil ities::firesTouchEventsSourceCapabilities() : InputDeviceCapabilities::doesntFir eTouchEventsSourceCapabilities()) 126 syntheticEventType == PlatformMouseEvent::FromTouch ? InputDeviceCapabil ities::firesTouchEventsSourceCapabilities() : InputDeviceCapabilities::doesntFir eTouchEventsSourceCapabilities())
125 , m_button(button) 127 , m_button(button)
126 , m_buttons(buttons) 128 , m_buttons(buttons)
127 , m_relatedTarget(relatedTarget) 129 , m_relatedTarget(relatedTarget)
128 , m_syntheticEventType(syntheticEventType) 130 , m_syntheticEventType(syntheticEventType)
131 , m_region(region)
129 { 132 {
130 } 133 }
131 134
132 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init ializer) 135 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init ializer)
133 : MouseRelatedEvent(eventType, initializer) 136 : MouseRelatedEvent(eventType, initializer)
134 , m_button(initializer.button()) 137 , m_button(initializer.button())
135 , m_buttons(initializer.buttons()) 138 , m_buttons(initializer.buttons())
136 , m_relatedTarget(initializer.relatedTarget()) 139 , m_relatedTarget(initializer.relatedTarget())
137 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) 140 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable)
141 , m_region(initializer.region())
138 { 142 {
139 } 143 }
140 144
141 MouseEvent::~MouseEvent() 145 MouseEvent::~MouseEvent()
142 { 146 {
143 } 147 }
144 148
145 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) 149 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers)
146 { 150 {
147 unsigned short buttons = 0; 151 unsigned short buttons = 0;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); 307 doubleClickEvent->setTrusted(mouseEvent.isTrusted());
304 if (mouseEvent.defaultHandled()) 308 if (mouseEvent.defaultHandled())
305 doubleClickEvent->setDefaultHandled(); 309 doubleClickEvent->setDefaultHandled();
306 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator ::create(doubleClickEvent)); 310 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator ::create(doubleClickEvent));
307 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented ()) 311 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented ())
308 return false; 312 return false;
309 return !swallowEvent; 313 return !swallowEvent;
310 } 314 }
311 315
312 } // namespace blink 316 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698