Title: [280049] trunk/Source/WebCore
Revision
280049
Author
[email protected]
Date
2021-07-19 15:01:03 -0700 (Mon, 19 Jul 2021)

Log Message

Port <dialog> close event to modern event handling code
https://bugs.webkit.org/show_bug.cgi?id=227915

Reviewed by Chris Dumez.

* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::close):
(WebCore::dialogCloseEventSender): Deleted.
(WebCore::HTMLDialogElement::~HTMLDialogElement): Deleted.
(WebCore::HTMLDialogElement::dispatchPendingEvent): Deleted.
* html/HTMLDialogElement.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280048 => 280049)


--- trunk/Source/WebCore/ChangeLog	2021-07-19 21:54:15 UTC (rev 280048)
+++ trunk/Source/WebCore/ChangeLog	2021-07-19 22:01:03 UTC (rev 280049)
@@ -1,3 +1,17 @@
+2021-07-19  Tim Nguyen  <[email protected]>
+
+        Port <dialog> close event to modern event handling code
+        https://bugs.webkit.org/show_bug.cgi?id=227915
+
+        Reviewed by Chris Dumez.
+
+        * html/HTMLDialogElement.cpp:
+        (WebCore::HTMLDialogElement::close):
+        (WebCore::dialogCloseEventSender): Deleted.
+        (WebCore::HTMLDialogElement::~HTMLDialogElement): Deleted.
+        (WebCore::HTMLDialogElement::dispatchPendingEvent): Deleted.
+        * html/HTMLDialogElement.h:
+
 2021-07-19  Chris Dumez  <[email protected]>
 
         HTMLImageElement.decoding should reflect the decoding content attribute, limited to only known values

Modified: trunk/Source/WebCore/html/HTMLDialogElement.cpp (280048 => 280049)


--- trunk/Source/WebCore/html/HTMLDialogElement.cpp	2021-07-19 21:54:15 UTC (rev 280048)
+++ trunk/Source/WebCore/html/HTMLDialogElement.cpp	2021-07-19 22:01:03 UTC (rev 280049)
@@ -25,8 +25,8 @@
 
 #include "config.h"
 #include "HTMLDialogElement.h"
+#include "EventLoop.h"
 #include "EventNames.h"
-#include "EventSender.h"
 
 #include "HTMLNames.h"
 #include <wtf/IsoMallocInlines.h>
@@ -37,22 +37,11 @@
 
 using namespace HTMLNames;
 
-static DialogEventSender& dialogCloseEventSender()
-{
-    static NeverDestroyed<DialogEventSender> sharedCloseEventSender(eventNames().closeEvent);
-    return sharedCloseEventSender;
-}
-
 HTMLDialogElement::HTMLDialogElement(const QualifiedName& tagName, Document& document)
     : HTMLElement(tagName, document)
 {
 }
 
-HTMLDialogElement::~HTMLDialogElement()
-{
-    dialogCloseEventSender().cancelEvent(*this);
-}
-
 void HTMLDialogElement::show()
 {
     // If the element already has an open attribute, then return.
@@ -101,14 +90,9 @@
 
     // FIXME: Add step 6 from spec. (webkit.org/b/227537)
 
-    dialogCloseEventSender().cancelEvent(*this);
-    dialogCloseEventSender().dispatchEventSoon(*this);
+    document().eventLoop().queueTask(TaskSource::UserInteraction, [protectedThis = GCReachableRef { *this }] {
+        protectedThis->dispatchEvent(Event::create(eventNames().closeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+    });
 }
 
-void HTMLDialogElement::dispatchPendingEvent(DialogEventSender* eventSender)
-{
-    ASSERT_UNUSED(eventSender, eventSender == &dialogCloseEventSender());
-    dispatchEvent(Event::create(eventNames().closeEvent, Event::CanBubble::No, Event::IsCancelable::No));
 }
-
-}

Modified: trunk/Source/WebCore/html/HTMLDialogElement.h (280048 => 280049)


--- trunk/Source/WebCore/html/HTMLDialogElement.h	2021-07-19 21:54:15 UTC (rev 280048)
+++ trunk/Source/WebCore/html/HTMLDialogElement.h	2021-07-19 22:01:03 UTC (rev 280049)
@@ -29,14 +29,10 @@
 
 namespace WebCore {
 
-template<typename T> class EventSender;
-using DialogEventSender = EventSender<HTMLDialogElement>;
-
 class HTMLDialogElement final : public HTMLElement {
     WTF_MAKE_ISO_ALLOCATED(HTMLDialogElement);
 public:
     template<typename... Args> static Ref<HTMLDialogElement> create(Args&&... args) { return adoptRef(*new HTMLDialogElement(std::forward<Args>(args)...)); }
-    ~HTMLDialogElement();
 
     bool isOpen() const { return hasAttribute(HTMLNames::openAttr); }
 
@@ -47,8 +43,6 @@
     ExceptionOr<void> showModal();
     void close(const String&);
 
-    void dispatchPendingEvent(DialogEventSender*);
-
     bool isModal() const { return m_isModal; };
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to