WebKit Bugzilla
Attachment 348038 Details for
Bug 188929
: Avoid calling setUntrusted in SimulatedMouseEvent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Cleanup
bug-188929-20180824134911.patch (text/plain), 15.51 KB, created by
Ryosuke Niwa
on 2018-08-24 13:49:12 PDT
(
hide
)
Description:
Cleanup
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-24 13:49:12 PDT
Size:
15.51 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 235332) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,36 @@ >+2018-08-24 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Avoid calling setUntrusted in SimulatedMouseEvent >+ https://bugs.webkit.org/show_bug.cgi?id=188929 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added IsTrusted flag to Event constructors instead of creating a trusted event >+ and making it untrusted in the constructor of SimulatedMouseEvent. >+ >+ This makes EventTarget::dispatchEventForBindings the only caller of setUntrusted(). >+ >+ * dom/Event.cpp: >+ (WebCore::Event::Event): >+ * dom/Event.h: >+ * dom/KeyboardEvent.cpp: >+ (WebCore::KeyboardEvent::KeyboardEvent): >+ * dom/MouseEvent.cpp: >+ (WebCore::MouseEvent::create): >+ (WebCore::MouseEvent::MouseEvent): >+ * dom/MouseEvent.h: >+ * dom/MouseRelatedEvent.cpp: >+ (WebCore::MouseRelatedEvent::MouseRelatedEvent): >+ * dom/MouseRelatedEvent.h: >+ * dom/SimulatedClick.cpp: >+ * dom/UIEvent.cpp: >+ (WebCore::UIEvent::UIEvent): >+ * dom/UIEvent.h: >+ * dom/UIEventWithKeyState.h: >+ (WebCore::UIEventWithKeyState::UIEventWithKeyState): >+ * dom/WheelEvent.cpp: >+ (WebCore::WheelEvent::WheelEvent): >+ > 2018-08-24 Ryosuke Niwa <rniwa@webkit.org> > > Pass in IsComposed flag to Event constructors >Index: Source/WebCore/dom/Event.cpp >=================================================================== >--- Source/WebCore/dom/Event.cpp (revision 235331) >+++ Source/WebCore/dom/Event.cpp (working copy) >@@ -63,8 +63,8 @@ Event::Event(const AtomicString& eventTy > ASSERT(!eventType.isNull()); > } > >-Event::Event(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp) >- : Event { timestamp, eventType, IsTrusted::Yes, canBubble, isCancelable, isComposed } >+Event::Event(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, IsTrusted isTrusted) >+ : Event { timestamp, eventType, isTrusted, canBubble, isCancelable, isComposed } > { > ASSERT(!eventType.isNull()); > } >Index: Source/WebCore/dom/Event.h >=================================================================== >--- Source/WebCore/dom/Event.h (revision 235331) >+++ Source/WebCore/dom/Event.h (working copy) >@@ -143,7 +143,7 @@ public: > protected: > explicit Event(IsTrusted = IsTrusted::No); > Event(const AtomicString& type, CanBubble, IsCancelable, IsComposed = IsComposed::No); >- Event(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp); >+ Event(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, IsTrusted isTrusted = IsTrusted::Yes); > Event(const AtomicString& type, const EventInit&, IsTrusted); > > virtual void receivedTarget() { } >Index: Source/WebCore/dom/KeyboardEvent.cpp >=================================================================== >--- Source/WebCore/dom/KeyboardEvent.cpp (revision 235331) >+++ Source/WebCore/dom/KeyboardEvent.cpp (working copy) >@@ -95,7 +95,7 @@ inline KeyboardEvent::KeyboardEvent() = > > inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<WindowProxy>&& view) > : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes, >- key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.modifiers()) >+ key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.modifiers(), IsTrusted::Yes) > , m_underlyingPlatformEvent(std::make_unique<PlatformKeyboardEvent>(key)) > #if ENABLE(KEYBOARD_KEY_ATTRIBUTE) > , m_key(key.key()) >Index: Source/WebCore/dom/MouseEvent.cpp >=================================================================== >--- Source/WebCore/dom/MouseEvent.cpp (revision 235331) >+++ Source/WebCore/dom/MouseEvent.cpp (working copy) >@@ -62,10 +62,10 @@ Ref<MouseEvent> MouseEvent::create(const > > Ref<MouseEvent> MouseEvent::create(const AtomicString& type, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, > const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, unsigned short button, unsigned short buttons, >- EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated) >+ EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated, IsTrusted isTrusted) > { > return adoptRef(*new MouseEvent(type, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, >- screenLocation, windowLocation, movementDelta, modifiers, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated)); >+ screenLocation, windowLocation, movementDelta, modifiers, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated, isTrusted)); > } > > Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, RefPtr<WindowProxy>&& view, int detail, >@@ -80,8 +80,8 @@ MouseEvent::MouseEvent() = default; > MouseEvent::MouseEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, > MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, > const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, unsigned short button, unsigned short buttons, >- EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated) >- : MouseRelatedEvent(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, screenLocation, windowLocation, movementDelta, modifiers, isSimulated) >+ EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, IsSimulated isSimulated, IsTrusted isTrusted) >+ : MouseRelatedEvent(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, screenLocation, windowLocation, movementDelta, modifiers, isSimulated, isTrusted) > , m_button(button == (unsigned short)-1 ? 0 : button) > , m_buttons(buttons) > , m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType) >Index: Source/WebCore/dom/MouseEvent.h >=================================================================== >--- Source/WebCore/dom/MouseEvent.h (revision 235331) >+++ Source/WebCore/dom/MouseEvent.h (working copy) >@@ -36,7 +36,7 @@ class MouseEvent : public MouseRelatedEv > public: > WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail, > const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier>, unsigned short button, unsigned short buttons, >- EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, IsSimulated = IsSimulated::No); >+ EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, IsSimulated = IsSimulated::No, IsTrusted = IsTrusted::Yes); > > WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, RefPtr<WindowProxy>&&, const PlatformMouseEvent&, int detail, Node* relatedTarget); > >@@ -78,7 +78,7 @@ public: > protected: > MouseEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail, > const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier>, unsigned short button, unsigned short buttons, >- EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, IsSimulated); >+ EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, IsSimulated, IsTrusted); > > MouseEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, RefPtr<WindowProxy>&&, int detail, > const IntPoint& screenLocation, const IntPoint& clientLocation, OptionSet<Modifier>, unsigned short button, unsigned short buttons, >Index: Source/WebCore/dom/MouseRelatedEvent.cpp >=================================================================== >--- Source/WebCore/dom/MouseRelatedEvent.cpp (revision 235331) >+++ Source/WebCore/dom/MouseRelatedEvent.cpp (working copy) >@@ -35,8 +35,8 @@ namespace WebCore { > > MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, > MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, >- const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, IsSimulated isSimulated) >- : UIEventWithKeyState(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, modifiers) >+ const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, IsSimulated isSimulated, IsTrusted isTrusted) >+ : UIEventWithKeyState(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, modifiers, isTrusted) > , m_screenLocation(screenLocation) > #if ENABLE(POINTER_LOCK) > , m_movementDelta(movementDelta) >Index: Source/WebCore/dom/MouseRelatedEvent.h >=================================================================== >--- Source/WebCore/dom/MouseRelatedEvent.h (revision 235331) >+++ Source/WebCore/dom/MouseRelatedEvent.h (working copy) >@@ -77,7 +77,8 @@ public: > protected: > MouseRelatedEvent() = default; > MouseRelatedEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime, RefPtr<WindowProxy>&&, int detail, >- const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, IsSimulated = IsSimulated::No); >+ const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, >+ IsSimulated = IsSimulated::No, IsTrusted = IsTrusted::Yes); > MouseRelatedEvent(const AtomicString& type, IsCancelable, MonotonicTime, RefPtr<WindowProxy>&&, const IntPoint& globalLocation, OptionSet<Modifier>); > MouseRelatedEvent(const AtomicString& type, const MouseRelatedEventInit&, IsTrusted = IsTrusted::No); > >Index: Source/WebCore/dom/SimulatedClick.cpp >=================================================================== >--- Source/WebCore/dom/SimulatedClick.cpp (revision 235331) >+++ Source/WebCore/dom/SimulatedClick.cpp (working copy) >@@ -44,13 +44,11 @@ public: > > private: > SimulatedMouseEvent(const AtomicString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source) >- : MouseEvent(eventType, CanBubble::Yes, IsCancelable::Yes, source == SimulatedClickSource::Bindings ? IsComposed::No : IsComposed::Yes, >+ : MouseEvent(eventType, CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes, > underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), WTFMove(view), /* detail */ 0, >- { }, { }, { }, modifiersFromUnderlyingEvent(underlyingEvent), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::Yes) >+ { }, { }, { }, modifiersFromUnderlyingEvent(underlyingEvent), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::Yes, >+ source == SimulatedClickSource::UserAgent ? IsTrusted::Yes : IsTrusted::No) > { >- if (source == SimulatedClickSource::Bindings) >- setUntrusted(); >- > setUnderlyingEvent(underlyingEvent.get()); > > if (is<MouseEvent>(this->underlyingEvent())) { >Index: Source/WebCore/dom/UIEvent.cpp >=================================================================== >--- Source/WebCore/dom/UIEvent.cpp (revision 235331) >+++ Source/WebCore/dom/UIEvent.cpp (working copy) >@@ -39,8 +39,8 @@ UIEvent::UIEvent(const AtomicString& eve > { > } > >-UIEvent::UIEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&& viewArg, int detailArg) >- : Event(eventType, canBubble, isCancelable, isComposed, timestamp) >+UIEvent::UIEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&& viewArg, int detailArg, IsTrusted isTrusted) >+ : Event(eventType, canBubble, isCancelable, isComposed, timestamp, isTrusted) > , m_view(WTFMove(viewArg)) > , m_detail(detailArg) > { >Index: Source/WebCore/dom/UIEvent.h >=================================================================== >--- Source/WebCore/dom/UIEvent.h (revision 235331) >+++ Source/WebCore/dom/UIEvent.h (working copy) >@@ -67,7 +67,7 @@ protected: > UIEvent(); > > UIEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, RefPtr<WindowProxy>&&, int detail); >- UIEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail); >+ UIEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail, IsTrusted = IsTrusted::Yes); > UIEvent(const AtomicString&, const UIEventInit&); > > private: >Index: Source/WebCore/dom/UIEventWithKeyState.h >=================================================================== >--- Source/WebCore/dom/UIEventWithKeyState.h (revision 235331) >+++ Source/WebCore/dom/UIEventWithKeyState.h (working copy) >@@ -55,8 +55,8 @@ protected: > } > > UIEventWithKeyState(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, IsComposed isComposed, >- MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, OptionSet<Modifier> modifiers) >- : UIEvent(type, canBubble, cancelable, isComposed, timestamp, WTFMove(view), detail) >+ MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, OptionSet<Modifier> modifiers, IsTrusted isTrusted) >+ : UIEvent(type, canBubble, cancelable, isComposed, timestamp, WTFMove(view), detail, isTrusted) > , m_modifiers(modifiers) > { > } >Index: Source/WebCore/dom/WheelEvent.cpp >=================================================================== >--- Source/WebCore/dom/WheelEvent.cpp (revision 235331) >+++ Source/WebCore/dom/WheelEvent.cpp (working copy) >@@ -48,8 +48,8 @@ inline WheelEvent::WheelEvent(const Atom > } > > inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view) >- : MouseEvent(eventNames().wheelEvent, CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.globalPosition(), event.position() , { } >- , event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No) >+ : MouseEvent(eventNames().wheelEvent, CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, >+ event.globalPosition(), event.position() , { }, event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No, IsTrusted::Yes) > , m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier) > , m_deltaX(-event.deltaX()) > , m_deltaY(-event.deltaY())
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188929
:
348038
|
348043
|
348045
|
348046