Title: [235306] releases/WebKitGTK/webkit-2.22/Source
Revision
235306
Author
carlo...@webkit.org
Date
2018-08-24 01:10:32 -0700 (Fri, 24 Aug 2018)

Log Message

Merge r235158 - Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
https://bugs.webkit.org/show_bug.cgi?id=188777

Reviewed by Simon Fraser.

Source/WebCore:

Replaced boolean arguments and instance variables for modifier keys (ctrl, alt, shift, and meta keys) in
UIEventWithKeyState with OptionSet<Modifier> and isSimulated boolean in MouseRelatedEvent with IsSimulated
enum class.

Also made movementDelta always compiled instead of only when ENABLE(POINTER_LOCK) to simplify the code.

No new tests since there should be no observable behavioral change.

* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent):
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
(WebCore::KeyboardEvent::initKeyboardEvent): Call setModifierKeys.
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
(WebCore::MouseEvent::initMouseEvent): Ditto.
* dom/MouseEvent.h:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent): Added a new variant which takes the minimum arguments
for gesture & touch events. In those events, detail is always set to 0, movementDelta is always set to 0,0,
and they are never simulated.
* dom/MouseRelatedEvent.h:
(WebCore::MouseRelatedEvent::IsSimulated): Added.
* dom/SimulatedClick.cpp:
(WebCore::SimulatedMouseEvent::SimulatedMouseEvent): Get OptionSet<Modifier> out of the underlying event
instead of manually setting each key state. This code now preserves the state of caps lock and alt-graph
keys but this is not observable because we have yet to implement getModifierState on MouseEvent.
(WebCore::SimulatedMouseEvent::modifiersFromUnderlyingEvent): Added.
* dom/TouchEvent.cpp:
(WebCore::TouchEvent::TouchEvent):
* dom/TouchEvent.h:
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::Modifier): Alias to PlatformEvent::Modifier.
(WebCore::UIEventWithKeyState::ctrlKey const): Updated to use m_modifiers.
(WebCore::UIEventWithKeyState::shiftKey const): Ditto.
(WebCore::UIEventWithKeyState::altKey const): Ditto.
(WebCore::UIEventWithKeyState::metaKey const): Ditto.
(WebCore::UIEventWithKeyState::altGraphKey const): Ditto.
(WebCore::UIEventWithKeyState::capsLockKey const): Ditto.
(WebCore::UIEventWithKeyState::modifierKeys): Added.
(WebCore::UIEventWithKeyState::UIEventWithKeyState): Now takes OptionSet<Modifier>.
(WebCore::UIEventWithKeyState::setModifierKeys): Added. Used by init*Event functions in subclasses. Note that
these functions preseve the states of alt-graph and caps lock keys to match the existing behaviors in this
cleanup patch but they don't match behaviors of Chrome or Firefox.
(WebCore::UIEventWithKeyState::modifiersFromInitializer): Added.
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent): Simulated::No corresponds to the last boolean being false.
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::handleTouchEvent):
* platform/PlatformEvent.h:
(WebCore::PlatformEvent::Modifier): Added AltGraphKey.
* platform/mac/PlatformEventFactoryMac.h:
(WebCore::modifiersForEvent): Exported to be used in [WebPDFView PDFViewWillClickOnLink:withURL:].
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::modifiersForEvent):
* testing/Internals.cpp:
(WebCore::Internals::accessKeyModifiers const):

Source/WebKit:

Added two FIXMEs.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):

Source/WebKitLegacy/ios:

Create MouseEvent::create with IsSimulated set to Yes; correspoding to the last argument
being "true" before the code change.

* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):

Source/WebKitLegacy/mac:

Create MouseEvent::create with IsSimulated set to Yes; correspoding to the last argument
being "true" before the code change.

Use modifiersForEvent to convert [nsEvent modifierFlags] to OptionSet<Modifier>.

* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-08-24 08:10:32 UTC (rev 235306)
@@ -1,3 +1,70 @@
+2018-08-21  Ryosuke Niwa  <rn...@webkit.org>
+
+        Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
+        https://bugs.webkit.org/show_bug.cgi?id=188777
+
+        Reviewed by Simon Fraser.
+
+        Replaced boolean arguments and instance variables for modifier keys (ctrl, alt, shift, and meta keys) in
+        UIEventWithKeyState with OptionSet<Modifier> and isSimulated boolean in MouseRelatedEvent with IsSimulated
+        enum class.
+
+        Also made movementDelta always compiled instead of only when ENABLE(POINTER_LOCK) to simplify the code.
+
+        No new tests since there should be no observable behavioral change.
+
+        * dom/Element.cpp:
+        (WebCore::Element::dispatchMouseEvent):
+        * dom/KeyboardEvent.cpp:
+        (WebCore::KeyboardEvent::KeyboardEvent):
+        (WebCore::KeyboardEvent::initKeyboardEvent): Call setModifierKeys.
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::create):
+        (WebCore::MouseEvent::MouseEvent):
+        (WebCore::MouseEvent::initMouseEvent): Ditto.
+        * dom/MouseEvent.h:
+        * dom/MouseRelatedEvent.cpp:
+        (WebCore::MouseRelatedEvent::MouseRelatedEvent): Added a new variant which takes the minimum arguments
+        for gesture & touch events. In those events, detail is always set to 0, movementDelta is always set to 0,0,
+        and they are never simulated.
+        * dom/MouseRelatedEvent.h:
+        (WebCore::MouseRelatedEvent::IsSimulated): Added.
+        * dom/SimulatedClick.cpp:
+        (WebCore::SimulatedMouseEvent::SimulatedMouseEvent): Get OptionSet<Modifier> out of the underlying event
+        instead of manually setting each key state. This code now preserves the state of caps lock and alt-graph
+        keys but this is not observable because we have yet to implement getModifierState on MouseEvent.
+        (WebCore::SimulatedMouseEvent::modifiersFromUnderlyingEvent): Added.
+        * dom/TouchEvent.cpp:
+        (WebCore::TouchEvent::TouchEvent):
+        * dom/TouchEvent.h:
+        * dom/UIEventWithKeyState.h:
+        (WebCore::UIEventWithKeyState::Modifier): Alias to PlatformEvent::Modifier.
+        (WebCore::UIEventWithKeyState::ctrlKey const): Updated to use m_modifiers.
+        (WebCore::UIEventWithKeyState::shiftKey const): Ditto.
+        (WebCore::UIEventWithKeyState::altKey const): Ditto.
+        (WebCore::UIEventWithKeyState::metaKey const): Ditto.
+        (WebCore::UIEventWithKeyState::altGraphKey const): Ditto.
+        (WebCore::UIEventWithKeyState::capsLockKey const): Ditto.
+        (WebCore::UIEventWithKeyState::modifierKeys): Added.
+        (WebCore::UIEventWithKeyState::UIEventWithKeyState): Now takes OptionSet<Modifier>.
+        (WebCore::UIEventWithKeyState::setModifierKeys): Added. Used by init*Event functions in subclasses. Note that
+        these functions preseve the states of alt-graph and caps lock keys to match the existing behaviors in this
+        cleanup patch but they don't match behaviors of Chrome or Firefox.
+        (WebCore::UIEventWithKeyState::modifiersFromInitializer): Added.
+        * dom/WheelEvent.cpp:
+        (WebCore::WheelEvent::WheelEvent): Simulated::No corresponds to the last boolean being false.
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dispatchDragEvent):
+        (WebCore::EventHandler::handleTouchEvent):
+        * platform/PlatformEvent.h:
+        (WebCore::PlatformEvent::Modifier): Added AltGraphKey.
+        * platform/mac/PlatformEventFactoryMac.h:
+        (WebCore::modifiersForEvent): Exported to be used in [WebPDFView PDFViewWillClickOnLink:withURL:].
+        * platform/mac/PlatformEventFactoryMac.mm:
+        (WebCore::modifiersForEvent):
+        * testing/Internals.cpp:
+        (WebCore::Internals::accessKeyModifiers const):
+
 2018-08-21  Daniel Bates  <daba...@apple.com>
 
         Disallow navigations when page cache updates the current document of the frame

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/Element.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/Element.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/Element.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -290,12 +290,12 @@
         // Special case: If it's a double click event, we also send the dblclick event. This is not part
         // of the DOM specs, but is used for compatibility with the _ondblclick_="" attribute. This is treated
         // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
+        // FIXME: Is it okay that mouseEvent may have been mutated by scripts via initMouseEvent in dispatchEvent above?
         Ref<MouseEvent> doubleClickEvent = MouseEvent::create(eventNames().dblclickEvent,
             mouseEvent->bubbles() ? Event::CanBubble::Yes : Event::CanBubble::No, mouseEvent->cancelable() ? Event::IsCancelable::Yes : Event::IsCancelable::No,
             mouseEvent->view(), mouseEvent->detail(),
             mouseEvent->screenX(), mouseEvent->screenY(), mouseEvent->clientX(), mouseEvent->clientY(),
-            mouseEvent->ctrlKey(), mouseEvent->altKey(), mouseEvent->shiftKey(), mouseEvent->metaKey(),
-            mouseEvent->button(), mouseEvent->buttons(), mouseEvent->syntheticClickType(), relatedTarget);
+            mouseEvent->modifierKeys(), mouseEvent->button(), mouseEvent->buttons(), mouseEvent->syntheticClickType(), relatedTarget);
 
         if (mouseEvent->defaultHandled())
             doubleClickEvent->setDefaultHandled();

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/KeyboardEvent.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/KeyboardEvent.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/KeyboardEvent.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -95,8 +95,7 @@
 
 inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<WindowProxy>&& view)
     : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), CanBubble::Yes, IsCancelable::Yes,
-        key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey(),
-        false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))
+        key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.modifiers())
     , m_underlyingPlatformEvent(std::make_unique<PlatformKeyboardEvent>(key))
 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     , m_key(key.key())
@@ -160,12 +159,9 @@
 
     m_keyIdentifier = keyIdentifier;
     m_location = location;
-    m_ctrlKey = ctrlKey;
-    m_shiftKey = shiftKey;
-    m_altKey = altKey;
-    m_metaKey = metaKey;
-    m_altGraphKey = altGraphKey;
 
+    setModifierKeys(ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
+
     m_charCode = std::nullopt;
     m_isComposing = false;
     m_keyCode = std::nullopt;

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseEvent.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseEvent.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseEvent.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -50,46 +50,37 @@
     auto isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave ? IsCancelable::Yes : IsCancelable::No;
     auto canBubble = !isMouseEnterOrLeave ? CanBubble::Yes : CanBubble::No;
 
-    return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), WTFMove(view),
-        detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
+    return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), WTFMove(view), detail,
+        event.globalPosition(), event.position(),
 #if ENABLE(POINTER_LOCK)
-        event.movementDelta().x(), event.movementDelta().y(),
+        event.movementDelta(),
+#else
+        { },
 #endif
-        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), event.buttons(),
-        relatedTarget, event.force(), event.syntheticClickType());
+        event.modifiers(), event.button(), event.buttons(), relatedTarget, event.force(), event.syntheticClickType());
 }
 
-Ref<MouseEvent> MouseEvent::create(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int pageX, int pageY,
-#if ENABLE(POINTER_LOCK)
-    int movementX, int movementY,
-#endif
-    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
+Ref<MouseEvent> MouseEvent::create(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, 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)
 {
-    return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, WTFMove(view),
-        detail, { screenX, screenY }, { pageX, pageY },
-#if ENABLE(POINTER_LOCK)
-        { movementX, movementY },
-#endif
-        ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
+    return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, WTFMove(view), detail,
+        screenLocation, windowLocation, movementDelta, modifiers, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
 }
 
-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, RefPtr<WindowProxy>&& view, int detail,
+    int screenX, int screenY, int clientX, int clientY, OptionSet<Modifier> modifiers, unsigned short button, unsigned short buttons,
+    unsigned short syntheticClickType, EventTarget* relatedTarget)
 {
-    return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget));
+    return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, modifiers, button, buttons, syntheticClickType, relatedTarget));
 }
 
 MouseEvent::MouseEvent() = default;
 
-MouseEvent::MouseEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
-#if ENABLE(POINTER_LOCK)
-        const IntPoint& movementDelta,
-#endif
-        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
-    : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, WTFMove(view), detail, screenLocation, windowLocation,
-#if ENABLE(POINTER_LOCK)
-        movementDelta,
-#endif
-        ctrlKey, altKey, shiftKey, metaKey, isSimulated)
+MouseEvent::MouseEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, 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, cancelable, timestamp, WTFMove(view), detail, screenLocation, windowLocation, movementDelta, modifiers, isSimulated)
     , m_button(button == (unsigned short)-1 ? 0 : button)
     , m_buttons(buttons)
     , m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
@@ -100,12 +91,9 @@
 {
 }
 
-MouseEvent::MouseEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
-    : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { },
-#if ENABLE(POINTER_LOCK)
-        { },
-#endif
-        ctrlKey, altKey, shiftKey, metaKey, false)
+MouseEvent::MouseEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, RefPtr<WindowProxy>&& view, int detail,
+    const IntPoint& screenLocation, const IntPoint& clientLocation, OptionSet<Modifier> modifiers, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
+    : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { }, { }, modifiers, IsSimulated::No)
     , m_button(button == (unsigned short)-1 ? 0 : button)
     , m_buttons(buttons)
     , m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
@@ -127,7 +115,8 @@
 
 MouseEvent::~MouseEvent() = default;
 
-void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget)
+void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail,
+    int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget)
 {
     if (isBeingDispatched())
         return;
@@ -135,10 +124,7 @@
     initUIEvent(type, canBubble, cancelable, WTFMove(view), detail);
 
     m_screenLocation = IntPoint(screenX, screenY);
-    m_ctrlKey = ctrlKey;
-    m_altKey = altKey;
-    m_shiftKey = shiftKey;
-    m_metaKey = metaKey;
+    setModifierKeys(ctrlKey, altKey, shiftKey, metaKey);
     m_button = button == (unsigned short)-1 ? 0 : button;
     m_syntheticClickType = 0;
     m_buttonDown = button != (unsigned short)-1;

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseEvent.h (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseEvent.h	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseEvent.h	2018-08-24 08:10:32 UTC (rev 235306)
@@ -34,18 +34,14 @@
 
 class MouseEvent : public MouseRelatedEvent {
 public:
-    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, CanBubble, IsCancelable, MonotonicTime timestamp,
-        RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int pageX, int pageY,
-#if ENABLE(POINTER_LOCK)
-        int movementX, int movementY,
-#endif
-        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
-        EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, bool isSimulated = false);
+    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, CanBubble, IsCancelable, 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);
 
     WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, RefPtr<WindowProxy>&&, const PlatformMouseEvent&, int detail, Node* relatedTarget);
 
     static Ref<MouseEvent> create(const AtomicString& eventType, CanBubble, IsCancelable, RefPtr<WindowProxy>&&,
-        int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+        int detail, int screenX, int screenY, int clientX, int clientY, OptionSet<Modifier>,
         unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
 
     static Ref<MouseEvent> createForBindings() { return adoptRef(*new MouseEvent); }
@@ -80,18 +76,13 @@
     int which() const final;
 
 protected:
-    MouseEvent(const AtomicString& type, CanBubble, IsCancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&,
-        int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
-#if ENABLE(POINTER_LOCK)
-        const IntPoint& movementDelta,
-#endif
-        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
-        EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, bool isSimulated);
+    MouseEvent(const AtomicString& type, CanBubble, IsCancelable, 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);
 
     MouseEvent(const AtomicString& type, CanBubble, IsCancelable, RefPtr<WindowProxy>&&,
         int detail, const IntPoint& screenLocation, const IntPoint& clientLocation,
-        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
-        unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
+        OptionSet<Modifier>, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
 
     MouseEvent(const AtomicString& type, const MouseEventInit&, IsTrusted);
 

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseRelatedEvent.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseRelatedEvent.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseRelatedEvent.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -33,22 +33,26 @@
 
 namespace WebCore {
 
-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view,
-                                     int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
-#if ENABLE(POINTER_LOCK)
-                                     const IntPoint& movementDelta,
-#endif
-                                     bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
-    : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, WTFMove(view), detail, ctrlKey, altKey, shiftKey, metaKey, false, false)
+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, CanBubble canBubble, IsCancelable isCancelable, 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, timestamp, WTFMove(view), detail, modifiers)
     , m_screenLocation(screenLocation)
 #if ENABLE(POINTER_LOCK)
     , m_movementDelta(movementDelta)
 #endif
-    , m_isSimulated(isSimulated)
+    , m_isSimulated(isSimulated == IsSimulated::Yes)
 {
-    init(isSimulated, windowLocation);
+#if !ENABLE(POINTER_LOCK)
+    UNUSED_PARAM(movementDelta);
+#endif
+    init(m_isSimulated, windowLocation);
 }
 
+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& type, IsCancelable isCancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, const IntPoint& globalLocation, OptionSet<Modifier> modifiers)
+    : MouseRelatedEvent(type, CanBubble::Yes, isCancelable, timestamp, WTFMove(view), 0, globalLocation, globalLocation /* Converted in init */, { }, modifiers, IsSimulated::No)
+{
+}
+
 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, const MouseRelatedEventInit& initializer, IsTrusted isTrusted)
     : UIEventWithKeyState(eventType, initializer, isTrusted)
     , m_screenLocation(IntPoint(initializer.screenX, initializer.screenY))

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseRelatedEvent.h (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseRelatedEvent.h	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/MouseRelatedEvent.h	2018-08-24 08:10:32 UTC (rev 235306)
@@ -38,6 +38,8 @@
 // Internal only: Helper class for what's common between mouse and wheel events.
 class MouseRelatedEvent : public UIEventWithKeyState {
 public:
+    enum class IsSimulated : uint8_t { Yes, No };
+
     // Note that these values are adjusted to counter the effects of zoom, so that values
     // exposed via DOM APIs are invariant under zooming.
     int screenX() const { return m_screenLocation.x(); }
@@ -74,12 +76,9 @@
 
 protected:
     MouseRelatedEvent() = default;
-    MouseRelatedEvent(const AtomicString& type, CanBubble, IsCancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&,
-        int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
-#if ENABLE(POINTER_LOCK)
-        const IntPoint& movementDelta,
-#endif
-        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
+    MouseRelatedEvent(const AtomicString& type, CanBubble, IsCancelable, MonotonicTime, RefPtr<WindowProxy>&&, int detail,
+        const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, IsSimulated = IsSimulated::No);
+    MouseRelatedEvent(const AtomicString& type, IsCancelable, MonotonicTime, RefPtr<WindowProxy>&&, const IntPoint& globalLocation, OptionSet<Modifier>);
     MouseRelatedEvent(const AtomicString& type, const MouseRelatedEventInit&, IsTrusted = IsTrusted::No);
 
     void initCoordinates();

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/SimulatedClick.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/SimulatedClick.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/SimulatedClick.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -44,21 +44,12 @@
 
 private:
     SimulatedMouseEvent(const AtomicString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source)
-        : MouseEvent(eventType, CanBubble::Yes, IsCancelable::Yes, underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), WTFMove(view), 0, { }, { },
-#if ENABLE(POINTER_LOCK)
-            { },
-#endif
-            false, false, false, false, 0, 0, nullptr, 0, 0, nullptr, true)
+        : MouseEvent(eventType, CanBubble::Yes, IsCancelable::Yes, underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), WTFMove(view), /* detail */ 0,
+            { }, { }, { }, modifiersFromUnderlyingEvent(underlyingEvent), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::Yes)
     {
         if (source == SimulatedClickSource::Bindings)
             setUntrusted();
 
-        if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
-            m_ctrlKey = keyStateEvent->ctrlKey();
-            m_altKey = keyStateEvent->altKey();
-            m_shiftKey = keyStateEvent->shiftKey();
-            m_metaKey = keyStateEvent->metaKey();
-        }
         setUnderlyingEvent(underlyingEvent.get());
 
         if (is<MouseEvent>(this->underlyingEvent())) {
@@ -75,6 +66,13 @@
         }
     }
 
+    static OptionSet<Modifier> modifiersFromUnderlyingEvent(const RefPtr<Event>& underlyingEvent)
+    {
+        UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get());
+        if (!keyStateEvent)
+            return { };
+        return keyStateEvent->modifierKeys();
+    }
 };
 
 static void simulateMouseEvent(const AtomicString& eventType, Element& element, Event* underlyingEvent, SimulatedClickSource source)

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/TouchEvent.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/TouchEvent.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/TouchEvent.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -37,13 +37,8 @@
 TouchEvent::TouchEvent() = default;
 
 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches, const AtomicString& type,
-    RefPtr<WindowProxy>&& view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
-    : MouseRelatedEvent(type, CanBubble::Yes, IsCancelable::Yes, MonotonicTime::now(), WTFMove(view), 0, IntPoint(screenX, screenY),
-        IntPoint(pageX, pageY),
-#if ENABLE(POINTER_LOCK)
-        IntPoint(0, 0),
-#endif
-        ctrlKey, altKey, shiftKey, metaKey)
+    RefPtr<WindowProxy>&& view, const IntPoint& globalLocation, OptionSet<Modifier> modifiers)
+    : MouseRelatedEvent(type, IsCancelable::Yes, MonotonicTime::now(), WTFMove(view), globalLocation, modifiers)
     , m_touches(touches)
     , m_targetTouches(targetTouches)
     , m_changedTouches(changedTouches)
@@ -74,10 +69,7 @@
     m_targetTouches = targetTouches;
     m_changedTouches = changedTouches;
     m_screenLocation = IntPoint(screenX, screenY);
-    m_ctrlKey = ctrlKey;
-    m_altKey = altKey;
-    m_shiftKey = shiftKey;
-    m_metaKey = metaKey;
+    setModifierKeys(ctrlKey, altKey, shiftKey, metaKey);
     initCoordinates(IntPoint(clientX, clientY));
 }
 

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/TouchEvent.h (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/TouchEvent.h	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/TouchEvent.h	2018-08-24 08:10:32 UTC (rev 235306)
@@ -39,15 +39,10 @@
 public:
     virtual ~TouchEvent();
 
-    static Ref<TouchEvent> create(TouchList* touches, 
-            TouchList* targetTouches, TouchList* changedTouches, 
-            const AtomicString& type, RefPtr<WindowProxy>&& view,
-            int screenX, int screenY, int pageX, int pageY,
-            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+    static Ref<TouchEvent> create(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
+        const AtomicString& type, RefPtr<WindowProxy>&& view, const IntPoint& globalLocation, OptionSet<Modifier> modifiers)
     {
-        return adoptRef(*new TouchEvent(touches, targetTouches, changedTouches,
-                type, WTFMove(view), screenX, screenY, pageX, pageY,
-                ctrlKey, altKey, shiftKey, metaKey));
+        return adoptRef(*new TouchEvent(touches, targetTouches, changedTouches, type, WTFMove(view), globalLocation, modifiers));
     }
     static Ref<TouchEvent> createForBindings()
     {
@@ -65,11 +60,8 @@
         return adoptRef(*new TouchEvent(type, initializer, isTrusted));
     }
 
-    void initTouchEvent(TouchList* touches, TouchList* targetTouches,
-            TouchList* changedTouches, const AtomicString& type, 
-            RefPtr<WindowProxy>&&, int screenX, int screenY,
-            int clientX, int clientY,
-            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+    void initTouchEvent(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches, const AtomicString& type,
+        RefPtr<WindowProxy>&&, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
     TouchList* touches() const { return m_touches.get(); }
     TouchList* targetTouches() const { return m_targetTouches.get(); }
@@ -85,11 +77,8 @@
 
 private:
     TouchEvent();
-    TouchEvent(TouchList* touches, TouchList* targetTouches,
-            TouchList* changedTouches, const AtomicString& type,
-            RefPtr<WindowProxy>&&, int screenX, int screenY, int pageX,
-            int pageY,
-            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+    TouchEvent(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches, const AtomicString& type,
+        RefPtr<WindowProxy>&&, const IntPoint& globalLocation, OptionSet<Modifier>);
     TouchEvent(const AtomicString&, const Init&, IsTrusted);
 
     RefPtr<TouchList> m_touches;

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/UIEventWithKeyState.h (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/UIEventWithKeyState.h	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/UIEventWithKeyState.h	2018-08-24 08:10:32 UTC (rev 235306)
@@ -24,6 +24,7 @@
 #pragma once
 
 #include "EventModifierInit.h"
+#include "PlatformEvent.h"
 #include "UIEvent.h"
 
 namespace WebCore {
@@ -30,55 +31,97 @@
 
 class UIEventWithKeyState : public UIEvent {
 public:
-    bool ctrlKey() const { return m_ctrlKey; }
-    bool shiftKey() const { return m_shiftKey; }
-    bool altKey() const { return m_altKey; }
-    bool metaKey() const { return m_metaKey; }
-    bool altGraphKey() const { return m_altGraphKey; }
-    bool capsLockKey() const { return m_capsLockKey; }
+    using Modifier = PlatformEvent::Modifier;
 
+    bool ctrlKey() const { return m_modifiers.contains(Modifier::CtrlKey); }
+    bool shiftKey() const { return m_modifiers.contains(Modifier::ShiftKey); }
+    bool altKey() const { return m_modifiers.contains(Modifier::AltKey); }
+    bool metaKey() const { return m_modifiers.contains(Modifier::MetaKey); }
+    bool altGraphKey() const { return m_modifiers.contains(Modifier::AltGraphKey); }
+    bool capsLockKey() const { return m_modifiers.contains(Modifier::CapsLockKey); }
+
+    OptionSet<Modifier> modifierKeys() { return m_modifiers; }
+
 protected:
     UIEventWithKeyState() = default;
 
-    UIEventWithKeyState(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, RefPtr<WindowProxy>&& view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+    UIEventWithKeyState(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, RefPtr<WindowProxy>&& view, int detail, OptionSet<Modifier> modifiers)
         : UIEvent(type, canBubble, cancelable, WTFMove(view), detail)
-        , m_ctrlKey(ctrlKey)
-        , m_altKey(altKey)
-        , m_shiftKey(shiftKey)
-        , m_metaKey(metaKey)
+        , m_modifiers(modifiers)
     {
     }
 
-    UIEventWithKeyState(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view,
-        int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey, bool capsLockKey)
-            : UIEvent(type, canBubble, cancelable, timestamp, WTFMove(view), detail)
-            , m_ctrlKey(ctrlKey)
-            , m_altKey(altKey)
-            , m_shiftKey(shiftKey)
-            , m_metaKey(metaKey)
-            , m_altGraphKey(altGraphKey)
-            , m_capsLockKey(capsLockKey)
+    UIEventWithKeyState(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, OptionSet<Modifier> modifiers)
+        : UIEvent(type, canBubble, cancelable, timestamp, WTFMove(view), detail)
+        , m_modifiers(modifiers)
     {
     }
 
     UIEventWithKeyState(const AtomicString& type, const EventModifierInit& initializer, IsTrusted isTrusted)
         : UIEvent(type, initializer, isTrusted)
-        , m_ctrlKey(initializer.ctrlKey)
-        , m_altKey(initializer.altKey)
-        , m_shiftKey(initializer.shiftKey)
-        , m_metaKey(initializer.metaKey)
-        , m_altGraphKey(initializer.modifierAltGraph)
-        , m_capsLockKey(initializer.modifierCapsLock)
+        , m_modifiers(modifiersFromInitializer(initializer))
     {
     }
 
-    // Expose these so init functions can set them.
-    bool m_ctrlKey { false };
-    bool m_altKey { false };
-    bool m_shiftKey { false };
-    bool m_metaKey { false };
-    bool m_altGraphKey { false };
-    bool m_capsLockKey { false };
+    void setModifierKeys(bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
+    {
+        OptionSet<Modifier> result;
+        if (ctrlKey)
+            result |= Modifier::CtrlKey;
+        if (altKey)
+            result |= Modifier::AltKey;
+        if (shiftKey)
+            result |= Modifier::ShiftKey;
+        if (metaKey)
+            result |= Modifier::MetaKey;
+        if (altGraphKey)
+            result |= Modifier::AltGraphKey;
+        //  FIXME: Chrome or Firefox don't preserve this state.
+        if (m_modifiers & Modifier::CapsLockKey)
+            result |= Modifier::CapsLockKey;
+        m_modifiers = result;
+    }
+
+    void setModifierKeys(bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+    {
+        OptionSet<Modifier> result;
+        if (ctrlKey)
+            result |= Modifier::CtrlKey;
+        if (altKey)
+            result |= Modifier::AltKey;
+        if (shiftKey)
+            result |= Modifier::ShiftKey;
+        if (metaKey)
+            result |= Modifier::MetaKey;
+        //  FIXME: Chrome or Firefox don't preserve these states.
+        if (m_modifiers & Modifier::AltGraphKey)
+            result |= Modifier::AltGraphKey;
+        if (m_modifiers & Modifier::CapsLockKey)
+            result |= Modifier::CapsLockKey;
+        m_modifiers = result;
+    }
+
+private:
+    OptionSet<Modifier> m_modifiers;
+
+    OptionSet<Modifier> modifiersFromInitializer(const EventModifierInit& initializer)
+    {
+        OptionSet<Modifier> result;
+        if (initializer.ctrlKey)
+            result |= Modifier::CtrlKey;
+        if (initializer.altKey)
+            result |= Modifier::AltKey;
+        if (initializer.shiftKey)
+            result |= Modifier::ShiftKey;
+        if (initializer.metaKey)
+            result |= Modifier::MetaKey;
+        if (initializer.modifierAltGraph)
+            result |= Modifier::AltGraphKey;
+        if (initializer.modifierCapsLock)
+            result |= Modifier::CapsLockKey;
+        return result;
+    }
+    
 };
 
 UIEventWithKeyState* findEventWithKeyState(Event*);

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/WheelEvent.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/WheelEvent.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/dom/WheelEvent.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -48,11 +48,8 @@
 }
 
 inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view)
-    : MouseEvent(eventNames().wheelEvent, CanBubble::Yes, IsCancelable::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.globalPosition(), event.position()
-#if ENABLE(POINTER_LOCK)
-        , { }
-#endif
-        , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, nullptr, 0, 0, nullptr, false)
+    : MouseEvent(eventNames().wheelEvent, CanBubble::Yes, IsCancelable::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.globalPosition(), event.position() , { }
+        , event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No)
     , m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier)
     , m_deltaX(-event.deltaX())
     , m_deltaY(-event.deltaY())

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/page/EventHandler.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/page/EventHandler.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/page/EventHandler.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -2212,14 +2212,15 @@
         return false;
 
     view->disableLayerFlushThrottlingTemporarilyForInteraction();
-    Ref<MouseEvent> me = MouseEvent::create(eventType,
-        Event::CanBubble::Yes, Event::IsCancelable::Yes, event.timestamp().approximateMonotonicTime(), &m_frame.windowProxy(),
-        0, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
+    // FIXME: Use MouseEvent::create which takes PlatformMouseEvent.
+    Ref<MouseEvent> me = MouseEvent::create(eventType, Event::CanBubble::Yes, Event::IsCancelable::Yes, event.timestamp().approximateMonotonicTime(), &m_frame.windowProxy(), 0,
+        event.globalPosition(), event.position(),
 #if ENABLE(POINTER_LOCK)
-        event.movementDelta().x(), event.movementDelta().y(),
+        event.movementDelta(),
+#else
+        { },
 #endif
-        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
-        0, 0, nullptr, event.force(), NoTap, &dataTransfer);
+        event.modifiers(), 0, 0, nullptr, event.force(), NoTap, &dataTransfer);
 
     dragTarget.dispatchEvent(me);
     return me->defaultPrevented();
@@ -4224,10 +4225,8 @@
             RefPtr<TouchList> targetTouches(isTouchCancelEvent ? emptyList : touchesByTarget.get(target.get()));
             ASSERT(targetTouches);
 
-            Ref<TouchEvent> touchEvent =
-                TouchEvent::create(effectiveTouches.get(), targetTouches.get(), changedTouches[state].m_touches.get(),
-                    stateName, downcast<Node>(*target).document().windowProxy(),
-                    0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey());
+            Ref<TouchEvent> touchEvent = TouchEvent::create(effectiveTouches.get(), targetTouches.get(), changedTouches[state].m_touches.get(),
+                stateName, downcast<Node>(*target).document().windowProxy(), { }, event.modifiers());
             target->dispatchEvent(touchEvent);
             swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() || touchEvent->defaultHandled();
         }

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/PlatformEvent.h (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/PlatformEvent.h	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/PlatformEvent.h	2018-08-24 08:10:32 UTC (rev 235306)
@@ -70,12 +70,15 @@
 #endif
     };
 
-    enum class Modifier {
+    enum class Modifier : uint8_t {
         AltKey      = 1 << 0,
         CtrlKey     = 1 << 1,
         MetaKey     = 1 << 2,
         ShiftKey    = 1 << 3,
         CapsLockKey = 1 << 4,
+
+        // Never used in native platforms but added for initEvent
+        AltGraphKey = 1 << 5,
     };
 
     Type type() const { return static_cast<Type>(m_type); }

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/mac/PlatformEventFactoryMac.h (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/mac/PlatformEventFactoryMac.h	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/mac/PlatformEventFactoryMac.h	2018-08-24 08:10:32 UTC (rev 235306)
@@ -51,7 +51,8 @@
 WEBCORE_EXPORT String keyForKeyEvent(NSEvent *);
 WEBCORE_EXPORT String codeForKeyEvent(NSEvent *);
 WEBCORE_EXPORT WallTime eventTimeStampSince1970(NSEvent *);
-    
+
+WEBCORE_EXPORT OptionSet<PlatformEvent::Modifier> modifiersForEvent(NSEvent *);
 WEBCORE_EXPORT void getWheelEventDeltas(NSEvent *, float& deltaX, float& deltaY, BOOL& continuous);
 WEBCORE_EXPORT UInt8 keyCharForEvent(NSEvent *);
 

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm	2018-08-24 08:10:32 UTC (rev 235306)
@@ -661,7 +661,7 @@
     return false;
 }
 
-static inline OptionSet<PlatformEvent::Modifier> modifiersForEvent(NSEvent *event)
+OptionSet<PlatformEvent::Modifier> modifiersForEvent(NSEvent *event)
 {
     OptionSet<PlatformEvent::Modifier> modifiers;
 

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/testing/Internals.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/testing/Internals.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/testing/Internals.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -4294,6 +4294,9 @@
         case PlatformEvent::Modifier::CapsLockKey:
             accessKeyModifierStrings.append("capsLockKey"_s);
             break;
+        case PlatformEvent::Modifier::AltGraphKey:
+            ASSERT_NOT_REACHED(); // AltGraph is only for DOM API.
+            break;
         }
     }
 

Modified: releases/WebKitGTK/webkit-2.22/Source/WebKit/ChangeLog (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebKit/ChangeLog	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebKit/ChangeLog	2018-08-24 08:10:32 UTC (rev 235306)
@@ -1,3 +1,15 @@
+2018-08-21  Ryosuke Niwa  <rn...@webkit.org>
+
+        Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
+        https://bugs.webkit.org/show_bug.cgi?id=188777
+
+        Reviewed by Simon Fraser.
+
+        Added two FIXMEs.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
+
 2018-08-21  Alex Christensen  <achristen...@webkit.org>
 
         Transition ResizeReversePaginatedWebView API test from WKPageLoaderClient to WKPageNavigationClient

Modified: releases/WebKitGTK/webkit-2.22/Source/WebKit/WebProcess/WebPage/WebPage.cpp (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-08-24 08:10:32 UTC (rev 235306)
@@ -1333,12 +1333,10 @@
         return;
 
     const int singleClick = 1;
+    // FIXME: Set modifier keys.
+    // FIXME: This should probably set IsSimulated::Yes.
     RefPtr<MouseEvent> mouseEvent = MouseEvent::create(eventNames().clickEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes,
-        MonotonicTime::now(), nullptr, singleClick, screenPoint.x(), screenPoint.y(), documentPoint.x(), documentPoint.y(),
-#if ENABLE(POINTER_LOCK)
-        0, 0,
-#endif
-        false, false, false, false, 0, 0, nullptr, 0, WebCore::NoTap, nullptr);
+        MonotonicTime::now(), nullptr, singleClick, screenPoint, documentPoint, { }, { }, 0, 0, nullptr, 0, WebCore::NoTap, nullptr);
 
     mainFrame->loader().urlSelected(mainFrameDocument->completeURL(url), emptyString(), mouseEvent.get(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
 }

Modified: releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/ios/ChangeLog (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/ios/ChangeLog	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/ios/ChangeLog	2018-08-24 08:10:32 UTC (rev 235306)
@@ -1,3 +1,16 @@
+2018-08-21  Ryosuke Niwa  <rn...@webkit.org>
+
+        Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
+        https://bugs.webkit.org/show_bug.cgi?id=188777
+
+        Reviewed by Simon Fraser.
+
+        Create MouseEvent::create with IsSimulated set to Yes; correspoding to the last argument
+        being "true" before the code change.
+
+        * WebView/WebPDFViewPlaceholder.mm:
+        (-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):
+
 2018-08-16  Ryosuke Niwa  <rn...@webkit.org>
 
         Replace canBubble and cancelable booleans in Event by enum classes

Modified: releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm	2018-08-24 08:10:32 UTC (rev 235306)
@@ -479,11 +479,8 @@
         return;
 
     // Construct an event to simulate a click.
-    RefPtr<Event> event = MouseEvent::create(eventNames().clickEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes, MonotonicTime::now(), 0, 1, 0, 0, 0, 0,
-#if ENABLE(POINTER_LOCK)
-        0, 0,
-#endif
-        false, false, false, false, 0, 0, nullptr, 0, 0, nullptr, true);
+    RefPtr<Event> event = MouseEvent::create(eventNames().clickEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes, MonotonicTime::now(), nullptr, 1,
+        { }, { }, { }, { }, 0, 0, nullptr, 0, 0, nullptr, MouseEvent::IsSimulated::Yes);
 
     // Call to the frame loader because this is where our security checks are made.
     Frame* frame = core([_dataSource webFrame]);

Modified: releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/mac/ChangeLog (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/mac/ChangeLog	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/mac/ChangeLog	2018-08-24 08:10:32 UTC (rev 235306)
@@ -1,3 +1,18 @@
+2018-08-21  Ryosuke Niwa  <rn...@webkit.org>
+
+        Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
+        https://bugs.webkit.org/show_bug.cgi?id=188777
+
+        Reviewed by Simon Fraser.
+
+        Create MouseEvent::create with IsSimulated set to Yes; correspoding to the last argument
+        being "true" before the code change.
+
+        Use modifiersForEvent to convert [nsEvent modifierFlags] to OptionSet<Modifier>.
+
+        * WebView/WebPDFView.mm:
+        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
+
 2018-08-21  Daniel Bates  <daba...@apple.com>
 
         Replace TextCheckingTypeMask with OptionSet

Modified: releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/mac/WebView/WebPDFView.mm (235305 => 235306)


--- releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/mac/WebView/WebPDFView.mm	2018-08-24 08:10:13 UTC (rev 235305)
+++ releases/WebKitGTK/webkit-2.22/Source/WebKitLegacy/mac/WebView/WebPDFView.mm	2018-08-24 08:10:32 UTC (rev 235306)
@@ -1030,15 +1030,9 @@
         break;
     }
     if (button != noButton) {
-        event = MouseEvent::create(eventNames().clickEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes, MonotonicTime::now(), 0, [nsEvent clickCount], 0, 0, 0, 0,
-#if ENABLE(POINTER_LOCK)
-            0, 0,
-#endif
-            [nsEvent modifierFlags] & NSEventModifierFlagControl,
-            [nsEvent modifierFlags] & NSEventModifierFlagOption,
-            [nsEvent modifierFlags] & NSEventModifierFlagShift,
-            [nsEvent modifierFlags] & NSEventModifierFlagCommand,
-            button, [NSEvent pressedMouseButtons], nullptr, WebCore::ForceAtClick, 0, nullptr, true);
+        // FIXME: Use createPlatformMouseEvent instead.
+        event = MouseEvent::create(eventNames().clickEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes, MonotonicTime::now(), nullptr, [nsEvent clickCount], { }, { }, { },
+            modifiersForEvent(nsEvent), button, [NSEvent pressedMouseButtons], nullptr, WebCore::ForceAtClick, 0, nullptr, MouseEvent::IsSimulated::Yes);
     }
 
     // Call to the frame loader because this is where our security checks are made.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to