[webkit-changes] [WebKit/WebKit] 25998f: [popover] Implement popovertarget & popovertargeta...

Tim Nguyen noreply at github.com
Tue Mar 7 15:43:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 25998fb94754e1acb8d93fa0f51d0c1e1e694ba4
      https://github.com/WebKit/WebKit/commit/25998fb94754e1acb8d93fa0f51d0c1e1e694ba4
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-2-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-invoking-attribute-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-stacking-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-target-element-disabled-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-top-layer-combinations-expected.txt
    M LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-2-expected.txt
    M LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-expected.txt
    M LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt
    M LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AccessibilityObject.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/PopoverData.h
    M Source/WebCore/html/HTMLAttributeNames.in
    M Source/WebCore/html/HTMLButtonElement.cpp
    M Source/WebCore/html/HTMLButtonElement.idl
    M Source/WebCore/html/HTMLElement.cpp
    M Source/WebCore/html/HTMLFormControlElement.cpp
    M Source/WebCore/html/HTMLFormControlElement.h
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLInputElement.idl
    A Source/WebCore/html/PopoverInvokerElement.idl

  Log Message:
  -----------
  [popover] Implement popovertarget & popovertargetaction attributes
https://bugs.webkit.org/show_bug.cgi?id=252078
rdar://105612966

Reviewed by Chris Dumez.

This adds support for the popoverTargetElement & popoverTargetAction IDL attributes, which map to popovertarget & popovertargetaction HTML attributes.

Spec change is at https://github.com/whatwg/html/pull/8962 , WPT have already been updated by a Chromium commit to match.

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-invoking-attribute-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-stacking-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-target-element-disabled-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-top-layer-combinations-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/popovers/popover-focus-2-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt:
* LayoutTests/platform/ios/TestExpectations:
Rebaseline tests with progressions. Remaining failures are either due to these unimplemented parts:
- invoker relationship removal handling (not standardized?)
- popover focusing steps (https://bugs.webkit.org/show_bug.cgi?id=253231)
- anchor attribute (not standardized)

* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
Update list of built files.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::handlePopoverLightDismiss):
Check for invokers as described in algorithm in: https://html.spec.whatwg.org/#topmost-clicked-popover

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::addRelations):
* Source/WebCore/accessibility/AccessibilityObject.cpp:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isElementReflectionAttribute):
(WebCore::Element::isElementsArrayReflectionAttribute):
(WebCore::Element::attributeChanged):
(WebCore::Element::getElementAttribute const):
(WebCore::Element::setElementAttribute):
(WebCore::Element::getElementsArrayAttribute const):
(WebCore::Element::setElementsArrayAttribute):
* Source/WebCore/dom/Element.h:
Add IDL element reflection support for popovertarget attribute. Simplified settings checks.

* Source/WebCore/dom/PopoverData.h:
(WebCore::PopoverData::invoker const):
(WebCore::PopoverData::setInvoker):
Store invoker in popover data.

* Source/WebCore/html/HTMLAttributeNames.in: Define popovertargetAttr & popovertargetActionAttr.
* Source/WebCore/html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::defaultEventHandler): Invoke popover activation behavior.
* Source/WebCore/html/HTMLButtonElement.idl: Use PopoverInvokerElement mixin.
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::topmostPopoverAncestor): Check for invokers as defined in the spec: https://html.spec.whatwg.org/#topmost-popover-ancestor
(WebCore::HTMLElement::hidePopoverInternal): Clear invoker as defined in the spec.
* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::toggleAtom):
(WebCore::showAtom):
(WebCore::hideAtom):
(WebCore::HTMLFormControlElement::popoverTargetElement const): Implement https://html.spec.whatwg.org/#popover-target-element
(WebCore::HTMLFormControlElement::popoverTargetAction const): Implement attribute reflection.
(WebCore::HTMLFormControlElement::handlePopoverTargetAction const): Implement activation behavior: https://html.spec.whatwg.org/#popover-target-attribute-activation-behavior
* Source/WebCore/html/HTMLFormControlElement.h:
(WebCore::HTMLFormControlElement::setPopoverTargetAction): Implement attribute reflection.
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler): Invoke popover activation behavior.
* Source/WebCore/html/HTMLInputElement.idl: Use PopoverInvokerElement mixin.
* Source/WebCore/html/PopoverInvokerElement.idl: Added.

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




More information about the webkit-changes mailing list