Title: [287095] trunk/Source/WebCore
Revision
287095
Author
[email protected]
Date
2021-12-15 12:14:08 -0800 (Wed, 15 Dec 2021)

Log Message

[WebIDL] Remove the now-unused [DocumentEventHandler] extended attribute
https://bugs.webkit.org/show_bug.cgi?id=234047

Reviewed by Darin Adler.

[DocumentEventHandler] was originally introduced just to accommodate onselectionchange
IDL attribute, which became unnecessary as of r287089. Also, HTML spec has no concept
of reflecting event handlers to Document, only to Window [1].

[1] https://html.spec.whatwg.org/multipage/webappapis.html#window-reflecting-body-element-event-handler-set

No new tests, no behavior change.

* bindings/js/JSEventListener.cpp:
(WebCore::documentEventHandlerAttribute): Deleted.
(WebCore::setDocumentEventHandlerAttribute): Deleted.
* bindings/js/JSEventListener.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeGetterBodyDefinition):
(GenerateAttributeSetterBodyDefinition):
* bindings/scripts/IDLAttributes.json:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287094 => 287095)


--- trunk/Source/WebCore/ChangeLog	2021-12-15 20:09:13 UTC (rev 287094)
+++ trunk/Source/WebCore/ChangeLog	2021-12-15 20:14:08 UTC (rev 287095)
@@ -1,3 +1,27 @@
+2021-12-15  Alexey Shvayka  <[email protected]>
+
+        [WebIDL] Remove the now-unused [DocumentEventHandler] extended attribute
+        https://bugs.webkit.org/show_bug.cgi?id=234047
+
+        Reviewed by Darin Adler.
+
+        [DocumentEventHandler] was originally introduced just to accommodate onselectionchange
+        IDL attribute, which became unnecessary as of r287089. Also, HTML spec has no concept
+        of reflecting event handlers to Document, only to Window [1].
+
+        [1] https://html.spec.whatwg.org/multipage/webappapis.html#window-reflecting-body-element-event-handler-set
+
+        No new tests, no behavior change.
+
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::documentEventHandlerAttribute): Deleted.
+        (WebCore::setDocumentEventHandlerAttribute): Deleted.
+        * bindings/js/JSEventListener.h:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateAttributeGetterBodyDefinition):
+        (GenerateAttributeSetterBodyDefinition):
+        * bindings/scripts/IDLAttributes.json:
+
 2021-12-15  Jer Noble  <[email protected]>
 
         [Mac] Adopt -[NSScreen safeAreaInsets]

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (287094 => 287095)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2021-12-15 20:09:13 UTC (rev 287094)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2021-12-15 20:14:08 UTC (rev 287095)
@@ -316,29 +316,4 @@
     setEventHandlerAttribute(lexicalGlobalObject, wrapper, window, eventType, value);
 }
 
-JSC::JSValue documentEventHandlerAttribute(HTMLElement& element, const AtomString& eventType, DOMWrapperWorld& isolatedWorld)
-{
-    auto& document = element.document();
-    return eventHandlerAttribute(document.attributeEventListener(eventType, isolatedWorld), document);
-}
-
-void setDocumentEventHandlerAttribute(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject& wrapper, HTMLElement& element, const AtomString& eventType, JSC::JSValue value)
-{
-    ASSERT(wrapper.globalObject());
-    auto& document = element.document();
-    auto* documentWrapper = JSC::jsCast<JSDocument*>(toJS(&lexicalGlobalObject, JSC::jsCast<JSDOMGlobalObject*>(wrapper.globalObject()), document));
-    ASSERT(documentWrapper);
-    document.setAttributeEventListener(eventType, createEventListenerForEventHandlerAttribute(lexicalGlobalObject, value, *documentWrapper), currentWorld(lexicalGlobalObject));
-}
-
-JSC::JSValue documentEventHandlerAttribute(Document& document, const AtomString& eventType, DOMWrapperWorld& isolatedWorld)
-{
-    return eventHandlerAttribute(document, eventType, isolatedWorld);
-}
-
-void setDocumentEventHandlerAttribute(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject& wrapper, Document& document, const AtomString& eventType, JSC::JSValue value)
-{
-    setEventHandlerAttribute(lexicalGlobalObject, wrapper, document, eventType, value);
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.h (287094 => 287095)


--- trunk/Source/WebCore/bindings/js/JSEventListener.h	2021-12-15 20:09:13 UTC (rev 287094)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.h	2021-12-15 20:14:08 UTC (rev 287095)
@@ -92,12 +92,6 @@
 JSC::JSValue windowEventHandlerAttribute(DOMWindow&, const AtomString& eventType, DOMWrapperWorld&);
 void setWindowEventHandlerAttribute(JSC::JSGlobalObject&, JSC::JSObject&, DOMWindow&, const AtomString& eventType, JSC::JSValue);
 
-// Like the functions above, but for attributes that forward event handlers to the document rather than setting them on the target.
-JSC::JSValue documentEventHandlerAttribute(HTMLElement&, const AtomString& eventType, DOMWrapperWorld&);
-void setDocumentEventHandlerAttribute(JSC::JSGlobalObject&, JSC::JSObject&, HTMLElement&, const AtomString& eventType, JSC::JSValue);
-JSC::JSValue documentEventHandlerAttribute(Document&, const AtomString& eventType, DOMWrapperWorld&);
-void setDocumentEventHandlerAttribute(JSC::JSGlobalObject&, JSC::JSObject&, Document&, const AtomString& eventType, JSC::JSValue);
-
 inline JSC::JSObject* JSEventListener::ensureJSFunction(ScriptExecutionContext& scriptExecutionContext) const
 {
     // initializeJSFunction can trigger code that deletes this event listener

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (287094 => 287095)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-12-15 20:09:13 UTC (rev 287094)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-12-15 20:14:08 UTC (rev 287095)
@@ -5269,9 +5269,7 @@
         push(@$outputArray, "    return thisObject.${implGetterFunctionName}(lexicalGlobalObject);\n");
     } elsif ($isEventHandler) {
         $implIncludes{"EventNames.h"} = 1;
-        my $getter = $attribute->extendedAttributes->{WindowEventHandler} ? "windowEventHandlerAttribute"
-            : $attribute->extendedAttributes->{DocumentEventHandler} ? "documentEventHandlerAttribute"
-            : "eventHandlerAttribute";
+        my $getter = $attribute->extendedAttributes->{WindowEventHandler} ? "windowEventHandlerAttribute" : "eventHandlerAttribute";
         my $eventName = EventHandlerAttributeEventName($attribute);
         push(@$outputArray, "    return $getter(thisObject.wrapped(), $eventName, worldForDOMObject(thisObject));\n");
     } elsif ($isConstructor) {
@@ -5443,9 +5441,7 @@
             push(@$outputArray, "    thisObject.wrapped().setAttributeEventListener($eventName, createJSErrorHandler(lexicalGlobalObject, value, thisObject), worldForDOMObject(thisObject));\n");
         } else {
             AddToImplIncludes("JSEventListener.h", $conditional);
-            my $setter = $attribute->extendedAttributes->{WindowEventHandler} ? "setWindowEventHandlerAttribute"
-                : $attribute->extendedAttributes->{DocumentEventHandler} ? "setDocumentEventHandlerAttribute"
-                : "setEventHandlerAttribute";
+            my $setter = $attribute->extendedAttributes->{WindowEventHandler} ? "setWindowEventHandlerAttribute" : "setEventHandlerAttribute";
             push(@$outputArray, "    $setter(lexicalGlobalObject, thisObject, thisObject.wrapped(), ${eventName}, value);\n");
         }
         push(@$outputArray, "    vm.writeBarrier(&thisObject, value);\n");

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (287094 => 287095)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-12-15 20:09:13 UTC (rev 287094)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-12-15 20:14:08 UTC (rev 287095)
@@ -175,9 +175,6 @@
         "DoNotCheckSecurityOnSetter": {
             "contextsAllowed": ["attribute"]
         },
-        "DocumentEventHandler": {
-            "contextsAllowed": ["attribute"]
-        },
         "EnabledByQuirk": {
             "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant", "dictionary-member", "includes"],
             "values": ["*"],
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to