[webkit-changes] [WebKit/WebKit] 53fc7c: [popover] Implement toggle event task

Tim Nguyen noreply at github.com
Wed Feb 22 22:41:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 53fc7cf368d2b375ec52fe5c8b33492b785340a8
      https://github.com/WebKit/WebKit/commit/53fc7cf368d2b375ec52fe5c8b33492b785340a8
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-02-22 (Wed, 22 Feb 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-attribute-basic-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-document-open-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-events-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-events.html
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-removal-2-expected.txt
    M Source/WebCore/dom/GlobalEventHandlers.idl
    M Source/WebCore/dom/PopoverData.h
    M Source/WebCore/html/HTMLAttributeNames.in
    M Source/WebCore/html/HTMLElement.cpp
    M Source/WebCore/html/HTMLElement.h

  Log Message:
  -----------
  [popover] Implement toggle event task
https://bugs.webkit.org/show_bug.cgi?id=252215
rdar://105703645

Reviewed by Darin Adler.

https://html.spec.whatwg.org/multipage/popover.html#queue-a-popover-toggle-event-task

Called in hidePopover/showPopover. In order to ensure only one event is emitted, we store the last queued oldState/newState,
then the queued task checks if the newState up to date and that there is still a queued task. The oldest "oldState" is always
preserved since we're collapsing multiple toggle events in one.

Also do other fixes to make html/semantics/popovers/popover-events.html pass:
- Make onbeforetoggle attribute actually work by adding it to IDL and attribute names
- Hide popover without firing events if element is removed from tree

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-attribute-basic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-document-open-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-removal-2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-events-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-events.html:
* Source/WebCore/dom/GlobalEventHandlers.idl:
* Source/WebCore/dom/PopoverData.h:
(WebCore::PopoverData::queuedToggleEventData):
(WebCore::PopoverData::setQueuedToggleEventData):
(WebCore::PopoverData::clearQueuedToggleEventData):
* Source/WebCore/html/HTMLAttributeNames.in:
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::HTMLElement::removedFromAncestor):
(WebCore::HTMLElement::queuePopoverToggleEventTask):
(WebCore::HTMLElement::showPopover):
(WebCore::HTMLElement::hidePopoverInternal):
* Source/WebCore/html/HTMLElement.h:

Canonical link: https://commits.webkit.org/260728@main




More information about the webkit-changes mailing list