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

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

Issue 1233233003: Add Event.isTrusted support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main2
Patch Set: Fix nits Created 5 years, 5 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
« no previous file with comments | « Source/core/events/MouseEvent.h ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 movementX, movementY, 69 movementX, movementY,
70 ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, data Transfer, isSimulated, syntheticEventType, uiCreateTime)); 70 ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, data Transfer, isSimulated, syntheticEventType, uiCreateTime));
71 } 71 }
72 72
73 MouseEvent::MouseEvent() 73 MouseEvent::MouseEvent()
74 : m_button(0) 74 : m_button(0)
75 , m_buttons(0) 75 , m_buttons(0)
76 , m_relatedTarget(nullptr) 76 , m_relatedTarget(nullptr)
77 , m_dataTransfer(nullptr) 77 , m_dataTransfer(nullptr)
78 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) 78 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable)
79 , m_isTrusted(false)
80 { 79 {
81 } 80 }
82 81
83 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance lable, PassRefPtrWillBeRawPtr<AbstractView> view, 82 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance lable, PassRefPtrWillBeRawPtr<AbstractView> view,
84 int detail, int screenX, int screenY, int windowX, int windowY, 83 int detail, int screenX, int screenY, int windowX, int windowY,
85 int movementX, int movementY, 84 int movementX, int movementY,
86 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, 85 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
87 short button, unsigned short buttons, PassRefPtrWillBeRawPtr<EventTarget> re latedTarget, 86 short button, unsigned short buttons, PassRefPtrWillBeRawPtr<EventTarget> re latedTarget,
88 DataTransfer* dataTransfer, bool isSimulated, PlatformMouseEvent::SyntheticE ventType syntheticEventType, 87 DataTransfer* dataTransfer, bool isSimulated, PlatformMouseEvent::SyntheticE ventType syntheticEventType,
89 double uiCreateTime) 88 double uiCreateTime)
90 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint (screenX, screenY), 89 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint (screenX, screenY),
91 IntPoint(windowX, windowY), 90 IntPoint(windowX, windowY),
92 IntPoint(movementX, movementY), 91 IntPoint(movementX, movementY),
93 ctrlKey, altKey, shiftKey, metaKey, isSimulated, 92 ctrlKey, altKey, shiftKey, metaKey, isSimulated,
94 syntheticEventType == PlatformMouseEvent::FromTouch ? InputDevice::fires TouchEventsInputDevice() : InputDevice::doesntFireTouchEventsInputDevice()) 93 syntheticEventType == PlatformMouseEvent::FromTouch ? InputDevice::fires TouchEventsInputDevice() : InputDevice::doesntFireTouchEventsInputDevice())
95 , m_button(button) 94 , m_button(button)
96 , m_buttons(buttons) 95 , m_buttons(buttons)
97 , m_relatedTarget(relatedTarget) 96 , m_relatedTarget(relatedTarget)
98 , m_dataTransfer(dataTransfer) 97 , m_dataTransfer(dataTransfer)
99 , m_syntheticEventType(syntheticEventType) 98 , m_syntheticEventType(syntheticEventType)
100 , m_isTrusted(false)
101 { 99 {
102 setUICreateTime(uiCreateTime); 100 setUICreateTime(uiCreateTime);
103 } 101 }
104 102
105 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init ializer) 103 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init ializer)
106 : MouseRelatedEvent(eventType, initializer.bubbles(), initializer.cancelable (), initializer.view(), initializer.detail(), IntPoint(initializer.screenX(), in itializer.screenY()), 104 : MouseRelatedEvent(eventType, initializer.bubbles(), initializer.cancelable (), initializer.view(), initializer.detail(), IntPoint(initializer.screenX(), in itializer.screenY()),
107 IntPoint(0 /* pageX */, 0 /* pageY */), 105 IntPoint(0 /* pageX */, 0 /* pageY */),
108 IntPoint(initializer.movementX(), initializer.movementY()), 106 IntPoint(initializer.movementX(), initializer.movementY()),
109 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), ini tializer.metaKey(), false /* isSimulated */, initializer.sourceDevice()) 107 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), ini tializer.metaKey(), false /* isSimulated */, initializer.sourceDevice())
110 , m_button(initializer.button()) 108 , m_button(initializer.button())
111 , m_buttons(initializer.buttons()) 109 , m_buttons(initializer.buttons())
112 , m_relatedTarget(initializer.relatedTarget()) 110 , m_relatedTarget(initializer.relatedTarget())
113 , m_dataTransfer(nullptr) 111 , m_dataTransfer(nullptr)
114 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) 112 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable)
115 , m_isTrusted(false)
116 { 113 {
117 initCoordinates(IntPoint(initializer.clientX(), initializer.clientY())); 114 initCoordinates(IntPoint(initializer.clientX(), initializer.clientY()));
118 } 115 }
119 116
120 MouseEvent::~MouseEvent() 117 MouseEvent::~MouseEvent()
121 { 118 {
122 } 119 }
123 120
124 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) 121 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers)
125 { 122 {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 doubleClickEvent->setTrusted(event().isTrusted()); 308 doubleClickEvent->setTrusted(event().isTrusted());
312 if (event().defaultHandled()) 309 if (event().defaultHandled())
313 doubleClickEvent->setDefaultHandled(); 310 doubleClickEvent->setDefaultHandled();
314 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator ::create(doubleClickEvent)); 311 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator ::create(doubleClickEvent));
315 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented ()) 312 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented ())
316 return false; 313 return false;
317 return !swallowEvent; 314 return !swallowEvent;
318 } 315 }
319 316
320 } // namespace blink 317 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/MouseEvent.h ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698