Changeset 244392 in webkit


Ignore:
Timestamp:
Apr 17, 2019 11:57:51 AM (5 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
https://bugs.webkit.org/show_bug.cgi?id=196988
<rdar://problem/49955328>

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/events/touch/ios/content-observation/tap-on-input-looking-div-with-role.html

  • accessibility/AccessibilityObject.h:

Source/WebKit:

Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements.

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::isAriaRoleForImmediateClick):
(WebKit::nodeAlwaysRequiresClick):
(WebKit::WebPage::handleSyntheticClick):

LayoutTests:

  • fast/events/touch/ios/content-observation/tap-on-input-looking-div-with-role-expected.txt: Added.
  • fast/events/touch/ios/content-observation/tap-on-input-looking-div-with-role.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244388 r244392  
     12019-04-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
     4        https://bugs.webkit.org/show_bug.cgi?id=196988
     5        <rdar://problem/49955328>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/events/touch/ios/content-observation/tap-on-input-looking-div-with-role-expected.txt: Added.
     10        * fast/events/touch/ios/content-observation/tap-on-input-looking-div-with-role.html: Added.
     11
    1122019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r244391 r244392  
     12019-04-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
     4        https://bugs.webkit.org/show_bug.cgi?id=196988
     5        <rdar://problem/49955328>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Test: fast/events/touch/ios/content-observation/tap-on-input-looking-div-with-role.html
     10
     11        * accessibility/AccessibilityObject.h:
     12
    1132019-04-17  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r244115 r244392  
    25152515AccessibilityRole AccessibilityObject::ariaRoleToWebCoreRole(const String& value)
    25162516{
    2517     ASSERT(!value.isEmpty());
     2517    if (value.isNull() || value.isEmpty())
     2518        return AccessibilityRole::Unknown;
     2519
    25182520    for (auto roleName : StringView(value).split(' ')) {
    25192521        AccessibilityRole role = ariaRoleMap().get<ASCIICaseInsensitiveStringViewHashTranslator>(roleName);
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r244059 r244392  
    526526    virtual int layoutCount() const { return 0; }
    527527    virtual double estimatedLoadingProgress() const { return 0; }
    528     static bool isARIAControl(AccessibilityRole);
    529     static bool isARIAInput(AccessibilityRole);
     528    WEBCORE_EXPORT static bool isARIAControl(AccessibilityRole);
     529    WEBCORE_EXPORT static bool isARIAInput(AccessibilityRole);
    530530
    531531    virtual bool supportsARIAOwns() const { return false; }
     
    756756    AccessibilityObject* firstAnonymousBlockChild() const;
    757757
    758     static AccessibilityRole ariaRoleToWebCoreRole(const String&);
     758    WEBCORE_EXPORT static AccessibilityRole ariaRoleToWebCoreRole(const String&);
    759759    bool hasAttribute(const QualifiedName&) const;
    760760    const AtomicString& getAttribute(const QualifiedName&) const;
  • trunk/Source/WebKit/ChangeLog

    r244390 r244392  
     12019-04-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
     4        https://bugs.webkit.org/show_bug.cgi?id=196988
     5        <rdar://problem/49955328>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements.
     10
     11        * WebProcess/WebPage/ios/WebPageIOS.mm:
     12        (WebKit::isAriaRoleForImmediateClick):
     13        (WebKit::nodeAlwaysRequiresClick):
     14        (WebKit::WebPage::handleSyntheticClick):
     15
    1162019-04-17  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r244356 r244392  
    567567}
    568568
     569static bool nodeAlwaysTriggersClick(const Node& targetNode)
     570{
     571    if (!is<Element>(targetNode))
     572        return false;
     573
     574    if (is<HTMLFormControlElement>(targetNode))
     575        return true;
     576
     577    auto ariaRole = AccessibilityObject::ariaRoleToWebCoreRole(downcast<Element>(targetNode).getAttribute(HTMLNames::roleAttr));
     578    return AccessibilityObject::isARIAControl(ariaRole) || AccessibilityObject::isARIAInput(ariaRole);
     579}
     580
    569581void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers)
    570582{
     
    588600    auto& contentChangeObserver = respondingDocument.contentChangeObserver();
    589601    auto observedContentChange = contentChangeObserver.observedContentChange();
    590 
    591     auto continueContentObservation = !(observedContentChange == WKContentVisibilityChange || is<HTMLFormControlElement>(nodeRespondingToClick));
     602    auto targetNodeTriggersClick = nodeAlwaysTriggersClick(nodeRespondingToClick);
     603
     604    auto continueContentObservation = !(observedContentChange == WKContentVisibilityChange || targetNodeTriggersClick);
    592605    if (continueContentObservation) {
    593606        // Wait for callback to completePendingSyntheticClickForContentChangeObserver() to decide whether to send the click event.
     
    601614    }
    602615
    603     callOnMainThread([protectedThis = makeRefPtr(this), targetNode = Ref<Node>(nodeRespondingToClick), location, modifiers, observedContentChange] {
     616    callOnMainThread([protectedThis = makeRefPtr(this), targetNode = Ref<Node>(nodeRespondingToClick), location, modifiers, observedContentChange, targetNodeTriggersClick] {
    604617        if (protectedThis->m_isClosed || !protectedThis->corePage())
    605618            return;
    606619
    607         auto shouldStayAtHoverState = observedContentChange == WKContentVisibilityChange && !is<HTMLFormControlElement>(targetNode);
     620        auto shouldStayAtHoverState = observedContentChange == WKContentVisibilityChange && !targetNodeTriggersClick;
    608621        if (shouldStayAtHoverState) {
    609622            // The move event caused new contents to appear. Don't send synthetic click event, but just ensure that the mouse is on the most recent content.
Note: See TracChangeset for help on using the changeset viewer.