Skip to content

Commit

Permalink
Remove ENABLE_MOUSE_FORCE_EVENTS directive
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268079

Reviewed by Ryosuke Niwa and Darin Adler.

This has the benefit of allowing us to add test coverage which reveals
we are inconsistent between the body and frameset elements. This PR
does not address that however. It's a pure cleanup.

* LayoutTests/fast/dom/event-handler-attributes-expected.txt:
* LayoutTests/fast/dom/event-handler-attributes.html:
* Source/WTF/wtf/PlatformEnable.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::dispatchMouseForceWillBegin):
* Source/WebCore/dom/GlobalEventHandlers.idl:
* Source/WebCore/dom/MouseEvent.idl:
* Source/WebCore/html/HTMLBodyElement.idl:
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseForceEvent):

Canonical link: https://commits.webkit.org/273603@main
  • Loading branch information
annevk committed Jan 27, 2024
1 parent b96b33e commit 5256dc7
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 43 deletions.
40 changes: 40 additions & 0 deletions LayoutTests/fast/dom/event-handler-attributes-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ PASS testScriptAttribute(window, "waiting") is "window"
PASS testScriptAttribute(window, "webkitanimationend") is "window"
PASS testScriptAttribute(window, "webkitanimationiteration") is "window"
PASS testScriptAttribute(window, "webkitanimationstart") is "window"
PASS testScriptAttribute(window, "webkitmouseforcechanged") is "window"
PASS testScriptAttribute(window, "webkitmouseforcedown") is "window"
PASS testScriptAttribute(window, "webkitmouseforceup") is "window"
PASS testScriptAttribute(window, "webkitmouseforcewillbegin") is "window"
PASS testScriptAttribute(window, "webkittransitionend") is "window"
PASS testScriptAttribute(window, "wheel") is "window"

Expand Down Expand Up @@ -167,6 +171,10 @@ PASS testScriptAttribute(document, "waiting") is "document"
PASS testScriptAttribute(document, "webkitanimationend") is "document"
PASS testScriptAttribute(document, "webkitanimationiteration") is "document"
PASS testScriptAttribute(document, "webkitanimationstart") is "document"
PASS testScriptAttribute(document, "webkitmouseforcechanged") is "document"
PASS testScriptAttribute(document, "webkitmouseforcedown") is "document"
PASS testScriptAttribute(document, "webkitmouseforceup") is "document"
PASS testScriptAttribute(document, "webkitmouseforcewillbegin") is "document"
PASS testScriptAttribute(document, "webkittransitionend") is "document"
PASS testScriptAttribute(document, "wheel") is "document"

Expand Down Expand Up @@ -261,6 +269,10 @@ PASS testElementAttribute(element, "waiting") is "target"
PASS testElementAttribute(element, "webkitanimationend") is "target"
PASS testElementAttribute(element, "webkitanimationiteration") is "target"
PASS testElementAttribute(element, "webkitanimationstart") is "target"
PASS testElementAttribute(element, "webkitmouseforcechanged") is "target"
PASS testElementAttribute(element, "webkitmouseforcedown") is "target"
PASS testElementAttribute(element, "webkitmouseforceup") is "target"
PASS testElementAttribute(element, "webkitmouseforcewillbegin") is "target"
PASS testElementAttribute(element, "webkittransitionend") is "target"
PASS testElementAttribute(element, "wheel") is "target"

Expand Down Expand Up @@ -353,6 +365,10 @@ PASS testElementAttribute(inputElement, "waiting") is "target"
PASS testElementAttribute(inputElement, "webkitanimationend") is "target"
PASS testElementAttribute(inputElement, "webkitanimationiteration") is "target"
PASS testElementAttribute(inputElement, "webkitanimationstart") is "target"
PASS testElementAttribute(inputElement, "webkitmouseforcechanged") is "target"
PASS testElementAttribute(inputElement, "webkitmouseforcedown") is "target"
PASS testElementAttribute(inputElement, "webkitmouseforceup") is "target"
PASS testElementAttribute(inputElement, "webkitmouseforcewillbegin") is "target"
PASS testElementAttribute(inputElement, "webkittransitionend") is "target"
PASS testElementAttribute(inputElement, "wheel") is "target"

Expand Down Expand Up @@ -445,6 +461,10 @@ PASS testElementAttribute(audioElement, "waiting") is "target"
PASS testElementAttribute(audioElement, "webkitanimationend") is "target"
PASS testElementAttribute(audioElement, "webkitanimationiteration") is "target"
PASS testElementAttribute(audioElement, "webkitanimationstart") is "target"
PASS testElementAttribute(audioElement, "webkitmouseforcechanged") is "target"
PASS testElementAttribute(audioElement, "webkitmouseforcedown") is "target"
PASS testElementAttribute(audioElement, "webkitmouseforceup") is "target"
PASS testElementAttribute(audioElement, "webkitmouseforcewillbegin") is "target"
PASS testElementAttribute(audioElement, "webkittransitionend") is "target"
PASS testElementAttribute(audioElement, "wheel") is "target"

Expand Down Expand Up @@ -537,6 +557,10 @@ PASS testElementAttribute(videoElement, "waiting") is "target"
PASS testElementAttribute(videoElement, "webkitanimationend") is "target"
PASS testElementAttribute(videoElement, "webkitanimationiteration") is "target"
PASS testElementAttribute(videoElement, "webkitanimationstart") is "target"
PASS testElementAttribute(videoElement, "webkitmouseforcechanged") is "target"
PASS testElementAttribute(videoElement, "webkitmouseforcedown") is "target"
PASS testElementAttribute(videoElement, "webkitmouseforceup") is "target"
PASS testElementAttribute(videoElement, "webkitmouseforcewillbegin") is "target"
PASS testElementAttribute(videoElement, "webkittransitionend") is "target"
PASS testElementAttribute(videoElement, "wheel") is "target"

Expand Down Expand Up @@ -574,6 +598,10 @@ PASS testElementAttribute(bodyElement, "popstate") is "window"
PASS testElementAttribute(bodyElement, "resize") is "window"
PASS testElementAttribute(bodyElement, "storage") is "window"
PASS testElementAttribute(bodyElement, "unload") is "window"
PASS testElementAttribute(bodyElement, "webkitmouseforcechanged") is "window"
PASS testElementAttribute(bodyElement, "webkitmouseforcedown") is "window"
PASS testElementAttribute(bodyElement, "webkitmouseforcewillbegin") is "window"
PASS testElementAttribute(bodyElement, "webkitmouseforceup") is "window"

Non-forwarded event names on <body> element

Expand Down Expand Up @@ -669,6 +697,10 @@ PASS testElementAttribute(framesetElement, "popstate") is "window"
PASS testElementAttribute(framesetElement, "resize") is "window"
PASS testElementAttribute(framesetElement, "storage") is "window"
PASS testElementAttribute(framesetElement, "unload") is "window"
FAIL testElementAttribute(framesetElement, "webkitmouseforcechanged") should be window. Was script: target; content: window.
FAIL testElementAttribute(framesetElement, "webkitmouseforcedown") should be window. Was script: target; content: window.
FAIL testElementAttribute(framesetElement, "webkitmouseforcewillbegin") should be window. Was script: target; content: window.
FAIL testElementAttribute(framesetElement, "webkitmouseforceup") should be window. Was script: target; content: window.

Non-forwarded event names on <frameset> element

Expand Down Expand Up @@ -819,6 +851,10 @@ PASS testElementAttribute(rectElement, "waiting") is "target"
PASS testElementAttribute(rectElement, "webkitanimationend") is "target"
PASS testElementAttribute(rectElement, "webkitanimationiteration") is "target"
PASS testElementAttribute(rectElement, "webkitanimationstart") is "target"
PASS testElementAttribute(rectElement, "webkitmouseforcechanged") is "target"
PASS testElementAttribute(rectElement, "webkitmouseforcedown") is "target"
PASS testElementAttribute(rectElement, "webkitmouseforceup") is "target"
PASS testElementAttribute(rectElement, "webkitmouseforcewillbegin") is "target"
PASS testElementAttribute(rectElement, "webkittransitionend") is "target"
PASS testElementAttribute(rectElement, "wheel") is "target"

Expand Down Expand Up @@ -923,6 +959,10 @@ PASS testElementAttribute(nonHTMLElement, "waiting") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitanimationend") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitanimationiteration") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitanimationstart") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitmouseforcechanged") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitmouseforcedown") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitmouseforceup") is "none"
PASS testElementAttribute(nonHTMLElement, "webkitmouseforcewillbegin") is "none"
PASS testElementAttribute(nonHTMLElement, "webkittransitionend") is "none"
PASS testElementAttribute(nonHTMLElement, "wheel") is "none"

Expand Down
28 changes: 9 additions & 19 deletions LayoutTests/fast/dom/event-handler-attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@
"webkitanimationend",
"webkitanimationiteration",
"webkitanimationstart",
"webkittransitionend"
"webkittransitionend",
"webkitmouseforcechanged",
"webkitmouseforcedown",
"webkitmouseforcewillbegin",
"webkitmouseforceup",
];

const eventsInWindowEventHandlers = [
Expand Down Expand Up @@ -140,6 +144,10 @@
"resize",
"storage",
"unload",
"webkitmouseforcechanged",
"webkitmouseforcedown",
"webkitmouseforcewillbegin",
"webkitmouseforceup",
];

const nonEventNames = [
Expand Down Expand Up @@ -453,23 +461,11 @@
page/DOMWindow.idl: [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturestart;
page/DOMWindow.idl: [NotEnumerable, Conditional=ORIENTATION_EVENTS] attribute EventHandler onorientationchange;
page/DOMWindow.idl: [NotEnumerable, Conditional=PROXIMITY_EVENTS] attribute EventHandler onwebkitdeviceproximity;
page/DOMWindow.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcecancelled;
page/DOMWindow.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcechanged;
page/DOMWindow.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceclick;
page/DOMWindow.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcedown;
page/DOMWindow.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceup;
page/DOMWindow.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcewillbegin;
dom/Document.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchcancel;
dom/Document.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchend;
dom/Document.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchmove;
dom/Document.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchstart;
dom/Document.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcecancelled;
dom/Document.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcechanged;
dom/Document.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceclick;
dom/Document.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcedown;
dom/Document.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceup;
dom/Document.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcewillbegin;
dom/Document.idl: [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenchange;
dom/Document.idl: [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenerror;
dom/Document.idl: [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockchange;
Expand All @@ -479,12 +475,6 @@
dom/Element.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchend;
dom/Element.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchmove;
dom/Element.idl: [NotEnumerable, Conditional=TOUCH_EVENTS] attribute EventHandler ontouchstart;
dom/Element.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcecancelled;
dom/Element.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcechanged;
dom/Element.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceclick;
dom/Element.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcedown;
dom/Element.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcewillbegin;
dom/Element.idl: [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceup;
dom/Element.idl: [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeyadded;
dom/Element.idl: [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeyerror;
dom/Element.idl: [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeymessage;
Expand Down
4 changes: 0 additions & 4 deletions Source/WTF/wtf/PlatformEnable.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,6 @@
#define ENABLE_MOUSE_CURSOR_SCALE 0
#endif

#if !defined(ENABLE_MOUSE_FORCE_EVENTS)
#define ENABLE_MOUSE_FORCE_EVENTS 1
#endif

#if !defined(ENABLE_NOTIFICATION_EVENT)
#define ENABLE_NOTIFICATION_EVENT 0
#endif
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/dom/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3721,7 +3721,6 @@ void Element::dispatchWebKitImageReadyEventForTesting()

bool Element::dispatchMouseForceWillBegin()
{
#if ENABLE(MOUSE_FORCE_EVENTS)
if (!document().hasListenerType(Document::ListenerType::ForceWillBegin))
return false;

Expand All @@ -3736,7 +3735,6 @@ bool Element::dispatchMouseForceWillBegin()

if (mouseForceWillBeginEvent->defaultHandled() || mouseForceWillBeginEvent->defaultPrevented())
return true;
#endif

return false;
}
Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/dom/GlobalEventHandlers.idl
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ interface mixin GlobalEventHandlers {
[NotEnumerable, Conditional=TOUCH_EVENTS, EnabledBySetting=TouchEventsEnabled] attribute EventHandler ontouchmove;
[NotEnumerable, Conditional=TOUCH_EVENTS, EnabledBySetting=TouchEventsEnabled] attribute EventHandler ontouchstart;
[NotEnumerable, Conditional=TOUCH_EVENTS, EnabledBySetting=TouchEventsEnabled] attribute EventHandler ontouchforcechange;
[NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcechanged;
[NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcedown;
[NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcewillbegin;
[NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceup;
[NotEnumerable] attribute EventHandler onwebkitmouseforcechanged;
[NotEnumerable] attribute EventHandler onwebkitmouseforcedown;
[NotEnumerable] attribute EventHandler onwebkitmouseforcewillbegin;
[NotEnumerable] attribute EventHandler onwebkitmouseforceup;
};
6 changes: 3 additions & 3 deletions Source/WebCore/dom/MouseEvent.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
] interface MouseEvent : UIEvent {
constructor([AtomString] DOMString type, optional MouseEventInit eventInitDict);

[Conditional=MOUSE_FORCE_EVENTS] const double WEBKIT_FORCE_AT_MOUSE_DOWN = 1;
[Conditional=MOUSE_FORCE_EVENTS] const double WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN = 2;
const double WEBKIT_FORCE_AT_MOUSE_DOWN = 1;
const double WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN = 2;

readonly attribute long screenX;
readonly attribute long screenY;
Expand All @@ -42,7 +42,7 @@

readonly attribute double movementX;
readonly attribute double movementY;
[Conditional=MOUSE_FORCE_EVENTS, ImplementedAs=force]readonly attribute double webkitForce;
[ImplementedAs=force] readonly attribute double webkitForce;

// FIXME: relatedTarget should be of type EventTarget? but we need to use any to support a quirk for iAd Producer (rdar://problem/30640101).
[CallWith=CurrentGlobalObject&CurrentScriptExecutionContext, ImplementedAs=initMouseEventQuirk] undefined initMouseEvent([AtomString] DOMString type,
Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/html/HTMLBodyElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
[WindowEventHandler] attribute EventHandler onfocusout;

// Non-standard
[NotEnumerable, WindowEventHandler, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcechanged;
[NotEnumerable, WindowEventHandler, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcedown;
[NotEnumerable, WindowEventHandler, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcewillbegin;
[NotEnumerable, WindowEventHandler, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforceup;
[NotEnumerable, WindowEventHandler] attribute EventHandler onwebkitmouseforcechanged;
[NotEnumerable, WindowEventHandler] attribute EventHandler onwebkitmouseforcedown;
[NotEnumerable, WindowEventHandler] attribute EventHandler onwebkitmouseforcewillbegin;
[NotEnumerable, WindowEventHandler] attribute EventHandler onwebkitmouseforceup;
};

HTMLBodyElement includes WindowEventHandlers;
7 changes: 0 additions & 7 deletions Source/WebCore/page/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,6 @@ HandleUserInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformM
return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent;
}

#if ENABLE(MOUSE_FORCE_EVENTS)
bool EventHandler::handleMouseForceEvent(const PlatformMouseEvent& event)
{
Ref frame = m_frame.get();
Expand Down Expand Up @@ -2365,12 +2364,6 @@ bool EventHandler::handleMouseForceEvent(const PlatformMouseEvent& event)

return swallowedEvent;
}
#else
bool EventHandler::handleMouseForceEvent(const PlatformMouseEvent& )
{
return false;
}
#endif // #if ENABLE(MOUSE_FORCE_EVENTS)

bool EventHandler::handlePasteGlobalSelection(const PlatformMouseEvent& platformMouseEvent)
{
Expand Down

0 comments on commit 5256dc7

Please sign in to comment.