Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (223263 => 223264)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1,3 +1,14 @@
+2017-10-12 Chris Dumez <[email protected]>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline test now that more checks are passing.
+
+ * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:
+
2017-10-11 Chris Dumez <[email protected]>
XMLHttpRequest: do not sniff text/html, and do not sniff XML when responseType is set to "text"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt (223263 => 223264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt 2017-10-13 00:24:21 UTC (rev 223264)
@@ -17,18 +17,18 @@
PASS FocusEvent constructor (empty argument)
PASS FocusEvent constructor (argument with default values)
PASS FocusEvent constructor (argument with non-default values)
-FAIL MouseEvent constructor (no argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (undefined argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (null argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (empty argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with non-default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (no argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (undefined argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (null argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (empty argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with non-default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
+PASS MouseEvent constructor (no argument)
+PASS MouseEvent constructor (undefined argument)
+PASS MouseEvent constructor (null argument)
+PASS MouseEvent constructor (empty argument)
+PASS MouseEvent constructor (argument with default values)
+PASS MouseEvent constructor (argument with non-default values)
+PASS WheelEvent constructor (no argument)
+PASS WheelEvent constructor (undefined argument)
+PASS WheelEvent constructor (null argument)
+PASS WheelEvent constructor (empty argument)
+PASS WheelEvent constructor (argument with default values)
+PASS WheelEvent constructor (argument with non-default values)
PASS KeyboardEvent constructor (no argument)
PASS KeyboardEvent constructor (undefined argument)
PASS KeyboardEvent constructor (null argument)
Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt (223263 => 223264)
--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt 2017-10-13 00:24:21 UTC (rev 223264)
@@ -17,18 +17,18 @@
PASS FocusEvent constructor (empty argument)
PASS FocusEvent constructor (argument with default values)
PASS FocusEvent constructor (argument with non-default values)
-FAIL MouseEvent constructor (no argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (undefined argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (null argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (empty argument) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL MouseEvent constructor (argument with non-default values) assert_true: Event object "[object MouseEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (no argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (undefined argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (null argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (empty argument) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
-FAIL WheelEvent constructor (argument with non-default values) assert_true: Event object "[object WheelEvent]" should have a buttons property expected true got false
+PASS MouseEvent constructor (no argument)
+PASS MouseEvent constructor (undefined argument)
+PASS MouseEvent constructor (null argument)
+PASS MouseEvent constructor (empty argument)
+PASS MouseEvent constructor (argument with default values)
+PASS MouseEvent constructor (argument with non-default values)
+PASS WheelEvent constructor (no argument)
+PASS WheelEvent constructor (undefined argument)
+PASS WheelEvent constructor (null argument)
+PASS WheelEvent constructor (empty argument)
+PASS WheelEvent constructor (argument with default values)
+PASS WheelEvent constructor (argument with non-default values)
PASS KeyboardEvent constructor (no argument)
PASS KeyboardEvent constructor (undefined argument)
PASS KeyboardEvent constructor (null argument)
Modified: trunk/Source/WebCore/ChangeLog (223263 => 223264)
--- trunk/Source/WebCore/ChangeLog 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1,3 +1,37 @@
+2017-10-12 Chris Dumez <[email protected]>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support for MouseEvent.buttons on Mac as per:
+ - https://www.w3.org/TR/uievents/#ref-for-dom-mouseevent-buttons-1
+
+ This is supported by Firefox and Chrome already.
+
+ No new tests, rebaselined existing test.
+
+ * dom/Element.cpp:
+ (WebCore::Element::dispatchMouseEvent):
+ * dom/MouseEvent.cpp:
+ (WebCore::MouseEvent::create):
+ (WebCore::MouseEvent::MouseEvent):
+ * dom/MouseEvent.h:
+ (WebCore::MouseEvent::buttons const):
+ * dom/MouseEvent.idl:
+ * dom/MouseEventInit.h:
+ * dom/MouseEventInit.idl:
+ * dom/SimulatedClick.cpp:
+ * dom/WheelEvent.cpp:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::dispatchDragEvent):
+ * platform/PlatformMouseEvent.h:
+ (WebCore::PlatformMouseEvent::buttons const):
+ * platform/mac/PlatformEventFactoryMac.mm:
+ (WebCore::currentlyPressedMouseButtons):
+ (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+
2017-10-12 David Kilzer <[email protected]>
[iOS] Fix -Wunused-lambda-capture warnings in WebCore/WebKit with new clang compiler
Modified: trunk/Source/WebCore/dom/Element.cpp (223263 => 223264)
--- trunk/Source/WebCore/dom/Element.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/Element.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -285,7 +285,7 @@
mouseEvent->bubbles(), mouseEvent->cancelable(), mouseEvent->view(), mouseEvent->detail(),
mouseEvent->screenX(), mouseEvent->screenY(), mouseEvent->clientX(), mouseEvent->clientY(),
mouseEvent->ctrlKey(), mouseEvent->altKey(), mouseEvent->shiftKey(), mouseEvent->metaKey(),
- mouseEvent->button(), mouseEvent->syntheticClickType(), relatedTarget);
+ mouseEvent->button(), mouseEvent->buttons(), mouseEvent->syntheticClickType(), relatedTarget);
if (mouseEvent->defaultHandled())
doubleClickEvent->setDefaultHandled();
Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (223263 => 223264)
--- trunk/Source/WebCore/dom/MouseEvent.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -55,7 +55,7 @@
#if ENABLE(POINTER_LOCK)
event.movementDelta().x(), event.movementDelta().y(),
#endif
- event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), event.buttons(),
relatedTarget, event.force(), event.syntheticClickType());
}
@@ -63,7 +63,7 @@
#if ENABLE(POINTER_LOCK)
int movementX, int movementY,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
+ 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)
{
return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, view,
detail, { screenX, screenY }, { pageX, pageY },
@@ -70,12 +70,12 @@
#if ENABLE(POINTER_LOCK)
{ movementX, movementY },
#endif
- ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
+ ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
}
-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget)
+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* 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)
{
- return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, syntheticClickType, relatedTarget));
+ return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget));
}
MouseEvent::MouseEvent()
@@ -86,7 +86,7 @@
#if ENABLE(POINTER_LOCK)
const IntPoint& movementDelta,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
+ 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, view, detail, screenLocation, windowLocation,
#if ENABLE(POINTER_LOCK)
movementDelta,
@@ -93,6 +93,7 @@
#endif
ctrlKey, altKey, shiftKey, metaKey, isSimulated)
, m_button(button == (unsigned short)-1 ? 0 : button)
+ , m_buttons(buttons)
, m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
, m_buttonDown(button != (unsigned short)-1)
, m_relatedTarget(relatedTarget)
@@ -101,7 +102,7 @@
{
}
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget)
+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* 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(), view, detail, screenLocation, { },
#if ENABLE(POINTER_LOCK)
{ },
@@ -108,6 +109,7 @@
#endif
ctrlKey, altKey, shiftKey, metaKey, false)
, m_button(button == (unsigned short)-1 ? 0 : button)
+ , m_buttons(buttons)
, m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
, m_buttonDown(button != (unsigned short)-1)
, m_relatedTarget(relatedTarget)
@@ -118,6 +120,7 @@
MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& initializer, IsTrusted isTrusted)
: MouseRelatedEvent(eventType, initializer, isTrusted)
, m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button)
+ , m_buttons(initializer.buttons)
, m_buttonDown(initializer.button != (unsigned short)-1)
, m_relatedTarget(initializer.relatedTarget)
{
Modified: trunk/Source/WebCore/dom/MouseEvent.h (223263 => 223264)
--- trunk/Source/WebCore/dom/MouseEvent.h 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/MouseEvent.h 2017-10-13 00:24:21 UTC (rev 223264)
@@ -37,11 +37,11 @@
#if ENABLE(POINTER_LOCK)
int movementX, int movementY,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, bool isSimulated = false);
+ 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& eventType, DOMWindow*, const PlatformMouseEvent&, int detail, Node* relatedTarget);
- static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget);
+ static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow*, 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);
static Ref<MouseEvent> createForBindings() { return adoptRef(*new MouseEvent); }
@@ -54,6 +54,7 @@
// WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
// but we will match the standard DOM.
unsigned short button() const { return m_button; }
+ unsigned short buttons() const { return m_buttons; }
unsigned short syntheticClickType() const { return m_syntheticClickType; }
bool buttonDown() const { return m_buttonDown; }
EventTarget* relatedTarget() const final { return m_relatedTarget.get(); }
@@ -75,13 +76,13 @@
#if ENABLE(POINTER_LOCK)
const IntPoint& movementDelta,
#endif
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+ 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, bool canBubble, bool cancelable, DOMWindow*,
int detail, const IntPoint& screenLocation, const IntPoint& clientLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget);
+ unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
MouseEvent(const AtomicString& type, const MouseEventInit&, IsTrusted);
@@ -96,6 +97,7 @@
void setRelatedTarget(EventTarget& relatedTarget) final { m_relatedTarget = &relatedTarget; }
unsigned short m_button { 0 };
+ unsigned short m_buttons { 0 };
unsigned short m_syntheticClickType { 0 };
bool m_buttonDown { false };
RefPtr<EventTarget> m_relatedTarget;
Modified: trunk/Source/WebCore/dom/MouseEvent.idl (223263 => 223264)
--- trunk/Source/WebCore/dom/MouseEvent.idl 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/MouseEvent.idl 2017-10-13 00:24:21 UTC (rev 223264)
@@ -33,6 +33,7 @@
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
+ readonly attribute unsigned short buttons;
readonly attribute EventTarget? relatedTarget;
[Conditional=POINTER_LOCK] readonly attribute long movementX;
[Conditional=POINTER_LOCK] readonly attribute long movementY;
Modified: trunk/Source/WebCore/dom/MouseEventInit.h (223263 => 223264)
--- trunk/Source/WebCore/dom/MouseEventInit.h 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/MouseEventInit.h 2017-10-13 00:24:21 UTC (rev 223264)
@@ -33,6 +33,7 @@
int clientX { 0 };
int clientY { 0 };
unsigned short button { 0 };
+ unsigned short buttons { 0 };
RefPtr<EventTarget> relatedTarget;
};
Modified: trunk/Source/WebCore/dom/MouseEventInit.idl (223263 => 223264)
--- trunk/Source/WebCore/dom/MouseEventInit.idl 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/MouseEventInit.idl 2017-10-13 00:24:21 UTC (rev 223264)
@@ -29,6 +29,7 @@
long clientX = 0;
long clientY = 0;
unsigned short button = 0;
+ unsigned short buttons = 0;
// FIXME: We need to support the following member.
// unsigned short buttons = 0;
Modified: trunk/Source/WebCore/dom/SimulatedClick.cpp (223263 => 223264)
--- trunk/Source/WebCore/dom/SimulatedClick.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/SimulatedClick.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -50,7 +50,7 @@
#if ENABLE(POINTER_LOCK)
{ },
#endif
- false, false, false, false, 0, 0, 0, 0, 0, true)
+ false, false, false, false, 0, 0, nullptr, 0, 0, nullptr, true)
{
if (source == SimulatedClickSource::Bindings)
setUntrusted();
Modified: trunk/Source/WebCore/dom/WheelEvent.cpp (223263 => 223264)
--- trunk/Source/WebCore/dom/WheelEvent.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/dom/WheelEvent.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -54,7 +54,7 @@
#if ENABLE(POINTER_LOCK)
, { }
#endif
- , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, 0, 0, 0, false)
+ , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, nullptr, 0, 0, nullptr, false)
, m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier)
, m_deltaX(-event.deltaX())
, m_deltaY(-event.deltaY())
Modified: trunk/Source/WebCore/page/EventHandler.cpp (223263 => 223264)
--- trunk/Source/WebCore/page/EventHandler.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -2197,7 +2197,7 @@
event.movementDelta().x(), event.movementDelta().y(),
#endif
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
- 0, 0, event.force(), NoTap, &dataTransfer);
+ 0, 0, nullptr, event.force(), NoTap, &dataTransfer);
dragTarget.dispatchEvent(me);
return me->defaultPrevented();
Modified: trunk/Source/WebCore/platform/PlatformMouseEvent.h (223263 => 223264)
--- trunk/Source/WebCore/platform/PlatformMouseEvent.h 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/platform/PlatformMouseEvent.h 2017-10-13 00:24:21 UTC (rev 223264)
@@ -86,6 +86,7 @@
#endif
MouseButton button() const { return m_button; }
+ unsigned short buttons() const { return m_buttons; }
int clickCount() const { return m_clickCount; }
unsigned modifierFlags() const { return m_modifierFlags; }
double force() const { return m_force; }
@@ -115,6 +116,7 @@
IntPoint m_movementDelta;
#endif
MouseButton m_button;
+ unsigned short m_buttons { 0 };
int m_clickCount;
unsigned m_modifierFlags;
double m_force { 0 };
Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (223263 => 223264)
--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2017-10-13 00:24:21 UTC (rev 223264)
@@ -129,6 +129,11 @@
}
}
+static unsigned short currentlyPressedMouseButtons()
+{
+ return static_cast<unsigned short>([NSEvent pressedMouseButtons]);
+}
+
static PlatformEvent::Type mouseEventTypeForEvent(NSEvent* event)
{
switch ([event type]) {
@@ -740,6 +745,7 @@
m_position = pointForEvent(event, windowView);
m_globalPosition = IntPoint(globalPointForEvent(event));
m_button = mouseButtonForEvent(event);
+ m_buttons = currentlyPressedMouseButtons();
m_clickCount = clickCountForEvent(event);
#if ENABLE(POINTER_LOCK)
m_movementDelta = IntPoint(event.deltaX, event.deltaY);
Modified: trunk/Source/WebKit/ChangeLog (223263 => 223264)
--- trunk/Source/WebKit/ChangeLog 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1,3 +1,31 @@
+2017-10-12 Chris Dumez <[email protected]>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ * Shared/WebEvent.h:
+ (WebKit::WebMouseEvent::buttons const):
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
+ * Shared/WebMouseEvent.cpp:
+ (WebKit::WebMouseEvent::WebMouseEvent):
+ (WebKit::WebMouseEvent::encode const):
+ (WebKit::WebMouseEvent::decode):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::currentlyPressedMouseButtons):
+ (WebKit::WebEventFactory::createWebMouseEvent):
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::showContextMenuAtPoint):
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::createWebEvent const):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
+ (WebKit::WebPage::simulateMouseDown):
+ (WebKit::WebPage::simulateMouseUp):
+ (WebKit::WebPage::simulateMouseMotion):
+
2017-10-12 Youenn Fablet <[email protected]>
Add API to clean CacheStorage data
Modified: trunk/Source/WebKit/Shared/WebEvent.h (223263 => 223264)
--- trunk/Source/WebKit/Shared/WebEvent.h 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/Shared/WebEvent.h 2017-10-13 00:24:21 UTC (rev 223264)
@@ -136,12 +136,13 @@
WebMouseEvent();
#if PLATFORM(MAC)
- WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
+ WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
#else
- WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
+ WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
#endif
Button button() const { return static_cast<Button>(m_button); }
+ unsigned short buttons() const { return m_buttons; }
const WebCore::IntPoint& position() const { return m_position; }
const WebCore::IntPoint& globalPosition() const { return m_globalPosition; }
float deltaX() const { return m_deltaX; }
@@ -162,6 +163,7 @@
static bool isMouseEventType(Type);
uint32_t m_button;
+ unsigned short m_buttons { 0 };
WebCore::IntPoint m_position;
WebCore::IntPoint m_globalPosition;
float m_deltaX;
Modified: trunk/Source/WebKit/Shared/WebEventConversion.cpp (223263 => 223264)
--- trunk/Source/WebKit/Shared/WebEventConversion.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/Shared/WebEventConversion.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -99,6 +99,8 @@
ASSERT_NOT_REACHED();
}
+ m_buttons = webEvent.buttons();
+
m_position = webEvent.position();
#if ENABLE(POINTER_LOCK)
m_movementDelta = WebCore::IntPoint(webEvent.deltaX(), webEvent.deltaY());
Modified: trunk/Source/WebKit/Shared/WebMouseEvent.cpp (223263 => 223264)
--- trunk/Source/WebKit/Shared/WebMouseEvent.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/Shared/WebMouseEvent.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -47,12 +47,13 @@
}
#if PLATFORM(MAC)
-WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
#else
-WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
#endif
: WebEvent(type, modifiers, timestamp)
, m_button(button)
+ , m_buttons(buttons)
, m_position(position)
, m_globalPosition(globalPosition)
, m_deltaX(deltaX)
@@ -74,6 +75,7 @@
WebEvent::encode(encoder);
encoder << m_button;
+ encoder << m_buttons;
encoder << m_position;
encoder << m_globalPosition;
encoder << m_deltaX;
@@ -95,6 +97,8 @@
if (!decoder.decode(result.m_button))
return false;
+ if (!decoder.decode(result.m_buttons))
+ return false;
if (!decoder.decode(result.m_position))
return false;
if (!decoder.decode(result.m_globalPosition))
Modified: trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp (223263 => 223264)
--- trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -134,6 +134,7 @@
return WebMouseEvent(type,
buttonForEvent(event),
+ 0,
IntPoint(x, y),
IntPoint(xRoot, yRoot),
0 /* deltaX */,
Modified: trunk/Source/WebKit/Shared/mac/WebEventFactory.mm (223263 => 223264)
--- trunk/Source/WebKit/Shared/mac/WebEventFactory.mm 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/Shared/mac/WebEventFactory.mm 2017-10-13 00:24:21 UTC (rev 223264)
@@ -85,6 +85,11 @@
}
}
+static unsigned short currentlyPressedMouseButtons()
+{
+ return static_cast<unsigned short>([NSEvent pressedMouseButtons]);
+}
+
static WebEvent::Type mouseEventTypeForEvent(NSEvent* event)
{
switch ([event type]) {
@@ -354,6 +359,7 @@
#endif
WebMouseEvent::Button button = mouseButtonForEvent(event);
+ unsigned short buttons = currentlyPressedMouseButtons();
float deltaX = [event deltaX];
float deltaY = [event deltaY];
float deltaZ = [event deltaZ];
@@ -370,7 +376,7 @@
force = pressure + stage;
#endif
- return WebMouseEvent(type, button, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, WebMouseEvent::SyntheticClickType::NoTap, eventNumber, menuTypeForEvent);
+ return WebMouseEvent(type, button, buttons, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, WebMouseEvent::SyntheticClickType::NoTap, eventNumber, menuTypeForEvent);
}
WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windowView)
Modified: trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp (223263 => 223264)
--- trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -128,7 +128,7 @@
// FIXME: Proper button support. Modifiers. deltaX/Y/Z. Click count.
WebCore::IntPoint position(event->x, event->y);
position.scale(1 / deviceScaleFactor);
- return WebMouseEvent(type, button, position, position,
+ return WebMouseEvent(type, button, 0, position, position,
0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), wallTimeForEventTime(event->time));
}
Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (223263 => 223264)
--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1582,7 +1582,7 @@
{
FrameView* frameView = webFrame()->coreFrame()->view();
IntPoint contentsPoint = frameView->contentsToRootView(point);
- WebMouseEvent event(WebEvent::MouseDown, WebMouseEvent::RightButton, contentsPoint, contentsPoint, 0, 0, 0, 1, static_cast<WebEvent::Modifiers>(0), WallTime::now(), WebCore::ForceAtClick);
+ WebMouseEvent event(WebEvent::MouseDown, WebMouseEvent::RightButton, 0, contentsPoint, contentsPoint, 0, 0, 0, 1, static_cast<WebEvent::Modifiers>(0), WallTime::now(), WebCore::ForceAtClick);
return handleContextMenuEvent(event);
}
Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (223263 => 223264)
--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -897,7 +897,7 @@
if (event.metaKey())
modifiers |= WebEvent::MetaKey;
- return std::make_unique<WebMouseEvent>(type, button, m_plugin->convertToRootView(IntPoint(event.offsetX(), event.offsetY())), event.screenLocation(), 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(modifiers), WallTime { }, 0);
+ return std::make_unique<WebMouseEvent>(type, button, event.buttons(), m_plugin->convertToRootView(IntPoint(event.offsetX(), event.offsetY())), event.screenLocation(), 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(modifiers), WallTime { }, 0);
}
void PluginView::handleEvent(Event& event)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (223263 => 223264)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1285,7 +1285,7 @@
#if ENABLE(POINTER_LOCK)
0, 0,
#endif
- false, false, false, false, 0, nullptr, 0, WebCore::NoTap, nullptr);
+ false, false, false, false, 0, 0, nullptr, 0, WebCore::NoTap, nullptr);
mainFrame->loader().urlSelected(mainFrameDocument->completeURL(url), emptyString(), mouseEvent.get(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
}
@@ -4683,17 +4683,17 @@
void WebPage::simulateMouseDown(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, WallTime time)
{
- mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
+ mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), 0, position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
}
void WebPage::simulateMouseUp(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, WallTime time)
{
- mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
+ mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), 0, position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
}
void WebPage::simulateMouseMotion(WebCore::IntPoint position, WallTime time)
{
- mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
+ mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, 0, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
}
void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)
Modified: trunk/Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm (223263 => 223264)
--- trunk/Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm 2017-10-13 00:24:21 UTC (rev 223264)
@@ -483,7 +483,7 @@
#if ENABLE(POINTER_LOCK)
0, 0,
#endif
- false, false, false, false, 0, 0, 0, 0, 0, true);
+ false, false, false, false, 0, 0, nullptr, 0, 0, nullptr, true);
// Call to the frame loader because this is where our security checks are made.
Frame* frame = core([_dataSource webFrame]);
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (223263 => 223264)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1,3 +1,13 @@
+2017-10-12 Chris Dumez <[email protected]>
+
+ [Mac] Add support for MouseEvent.buttons
+ https://bugs.webkit.org/show_bug.cgi?id=178214
+
+ Reviewed by Ryosuke Niwa.
+
+ * WebView/WebPDFView.mm:
+ (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
+
2017-10-11 Sam Weinig <[email protected]>
Remove out-parameter variants of copyToVector
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPDFView.mm (223263 => 223264)
--- trunk/Source/WebKitLegacy/mac/WebView/WebPDFView.mm 2017-10-13 00:19:48 UTC (rev 223263)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPDFView.mm 2017-10-13 00:24:21 UTC (rev 223264)
@@ -1033,7 +1033,7 @@
[nsEvent modifierFlags] & NSEventModifierFlagOption,
[nsEvent modifierFlags] & NSEventModifierFlagShift,
[nsEvent modifierFlags] & NSEventModifierFlagCommand,
- button, 0, WebCore::ForceAtClick, 0, 0, true);
+ button, [NSEvent pressedMouseButtons], nullptr, WebCore::ForceAtClick, 0, nullptr, true);
}
// Call to the frame loader because this is where our security checks are made.