Changeset 262235 in webkit


Ignore:
Timestamp:
May 27, 2020 10:32:50 PM (4 years ago)
Author:
Noam Rosenthal
Message:

Implement AccessKeyLabel attribute.
https://bugs.webkit.org/show_bug.cgi?id=72715

LayoutTests/imported/w3c:

Reviewed by Darin Adler.

  • web-platform-tests/html/dom/idlharness.https-expected.txt:

Source/WebCore:

Spec: https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel

As per spec, return the modifiers+accessKey when requesting the element accessKeyLabel.

Equivalent to the existing Firefox implementation and (pending) Chrome implementation.

Alt is the hardcoded modifier for any non-cocoa platform, so hardcode it also for the label.
Use modifier text for Mac/iOS as it can change (e.g. for voice-over).

Reviewed by Darin Adler.

Test: fast/forms/access-key-label.html

  • html/HTMLElement.cpp:

(WebCore::HTMLElement::accessKeyLabel const):

  • html/HTMLElement.h:
  • html/HTMLElement.idl:

Source/WTF:

Reviewed by Darin Adler.

Added character names for upArrow/option, as they're needed for accessKeyLabel.

  • wtf/unicode/CharacterNames.h:

LayoutTests:

Reviewed by Darin Adler.

  • fast/forms/access-key-label-expected.txt: Added.
  • fast/forms/access-key-label.html: Added.

Added a test to cover accessKeyLabel scenarios.

  • js/dom/dom-static-property-for-in-iteration-expected.txt:
  • platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt:
  • platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/ios-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
  • platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
  • platform/win/js/dom/dom-static-property-for-in-iteration-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/wpe/js/dom/dom-static-property-for-in-iteration-expected.txt:

HTML elements now have an accessKeyLabel property, fix expected results.

Location:
trunk
Files:
2 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r262234 r262235  
     12020-05-27  Noam Rosenthal  <noam@webkit.org>
     2
     3        Implement AccessKeyLabel attribute.
     4        https://bugs.webkit.org/show_bug.cgi?id=72715
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/forms/access-key-label-expected.txt: Added.
     9        * fast/forms/access-key-label.html: Added.
     10                Added a test to cover accessKeyLabel scenarios.
     11
     12        * js/dom/dom-static-property-for-in-iteration-expected.txt:
     13        * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     14        * platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt:
     15        * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     16        * platform/ios-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
     17        * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     18        * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     19        * platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
     20        * platform/win/js/dom/dom-static-property-for-in-iteration-expected.txt:
     21        * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     22        * platform/wpe/js/dom/dom-static-property-for-in-iteration-expected.txt:
     23                HTML elements now have an accessKeyLabel property, fix expected results.
     24
    1252020-05-27  Lauro Moura  <lmoura@igalia.com>
    226
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r262188 r262235  
     12020-05-27  Noam Rosenthal  <noam@webkit.org>
     2
     3        Implement AccessKeyLabel attribute.
     4        https://bugs.webkit.org/show_bug.cgi?id=72715
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/html/dom/idlharness.https-expected.txt:
     9
     102020-05-27  Noam Rosenthal  <noam@webkit.org>
     11
     12        Implement AccessKeyLabel attribute.
     13        https://bugs.webkit.org/show_bug.cgi?id=72715
     14
     15        Reviewed by Darin Adler.
     16
     17        Mark previously failing test as passing.
     18
     19        * web-platform-tests/html/dom/idlharness.https-expected.txt:
     20
    1212020-05-19  Sergio Villar Senin  <svillar@igalia.com>
    222
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r257707 r262235  
    121121PASS HTMLElement interface: operation click()
    122122PASS HTMLElement interface: attribute accessKey
    123 FAIL HTMLElement interface: attribute accessKeyLabel assert_true: The prototype object must have a property "accessKeyLabel" expected true got false
     123PASS HTMLElement interface: attribute accessKeyLabel
    124124PASS HTMLElement interface: attribute draggable
    125125PASS HTMLElement interface: attribute spellcheck
  • trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt

    r257707 r262235  
    3939PASS a["hidden"] is false
    4040PASS a["accessKey"] is
     41PASS a["accessKeyLabel"] is
    4142PASS a["draggable"] is true
    4243PASS a["spellcheck"] is true
     
    4546PASS a["isContentEditable"] is false
    4647PASS a["offsetParent"] is [object HTMLBodyElement]
    47 PASS a["offsetTop"] is 699
     48PASS a["offsetTop"] is 714
    4849PASS a["offsetLeft"] is 8
    4950PASS a["offsetWidth"] is 40
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r257707 r262235  
    251251PASS HTMLElement interface: operation click()
    252252PASS HTMLElement interface: attribute accessKey
    253 FAIL HTMLElement interface: attribute accessKeyLabel assert_true: The prototype object must have a property "accessKeyLabel" expected true got false
     253PASS HTMLElement interface: attribute accessKeyLabel
    254254PASS HTMLElement interface: attribute draggable
    255255PASS HTMLElement interface: attribute spellcheck
     
    342342PASS HTMLElement interface: document.createElement("noscript") must inherit property "click()" with the proper type
    343343PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKey" with the proper type
    344 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type assert_inherits: property "accessKeyLabel" not found in prototype chain
     344PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type
    345345PASS HTMLElement interface: document.createElement("noscript") must inherit property "draggable" with the proper type
    346346PASS HTMLElement interface: document.createElement("noscript") must inherit property "spellcheck" with the proper type
  • trunk/LayoutTests/platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt

    r257707 r262235  
    4141PASS a["hidden"] is false
    4242PASS a["accessKey"] is
     43PASS a["accessKeyLabel"] is
    4344PASS a["draggable"] is true
    4445PASS a["spellcheck"] is true
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r257707 r262235  
    251251PASS HTMLElement interface: operation click()
    252252PASS HTMLElement interface: attribute accessKey
    253 FAIL HTMLElement interface: attribute accessKeyLabel assert_true: The prototype object must have a property "accessKeyLabel" expected true got false
     253PASS HTMLElement interface: attribute accessKeyLabel
    254254PASS HTMLElement interface: attribute draggable
    255255PASS HTMLElement interface: attribute spellcheck
     
    342342PASS HTMLElement interface: document.createElement("noscript") must inherit property "click()" with the proper type
    343343PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKey" with the proper type
    344 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type assert_inherits: property "accessKeyLabel" not found in prototype chain
     344PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type
    345345PASS HTMLElement interface: document.createElement("noscript") must inherit property "draggable" with the proper type
    346346PASS HTMLElement interface: document.createElement("noscript") must inherit property "spellcheck" with the proper type
  • trunk/LayoutTests/platform/ios-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt

    r257707 r262235  
    4141PASS a["tabIndex"] is 0
    4242PASS a["accessKey"] is
     43PASS a["accessKeyLabel"] is
    4344PASS a["draggable"] is true
    4445PASS a["spellcheck"] is true
     
    4748PASS a["isContentEditable"] is false
    4849PASS a["offsetParent"] is [object HTMLBodyElement]
    49 PASS a["offsetTop"] is 729
     50PASS a["offsetTop"] is 744
    5051PASS a["offsetLeft"] is 8
    5152PASS a["offsetWidth"] is 40
  • trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r257707 r262235  
    251251PASS HTMLElement interface: operation click()
    252252PASS HTMLElement interface: attribute accessKey
    253 FAIL HTMLElement interface: attribute accessKeyLabel assert_true: The prototype object must have a property "accessKeyLabel" expected true got false
     253PASS HTMLElement interface: attribute accessKeyLabel
    254254PASS HTMLElement interface: attribute draggable
    255255PASS HTMLElement interface: attribute spellcheck
     
    342342PASS HTMLElement interface: document.createElement("noscript") must inherit property "click()" with the proper type
    343343PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKey" with the proper type
    344 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type assert_inherits: property "accessKeyLabel" not found in prototype chain
     344PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type
    345345PASS HTMLElement interface: document.createElement("noscript") must inherit property "draggable" with the proper type
    346346PASS HTMLElement interface: document.createElement("noscript") must inherit property "spellcheck" with the proper type
  • trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r257707 r262235  
    251251PASS HTMLElement interface: operation click()
    252252PASS HTMLElement interface: attribute accessKey
    253 FAIL HTMLElement interface: attribute accessKeyLabel assert_true: The prototype object must have a property "accessKeyLabel" expected true got false
     253PASS HTMLElement interface: attribute accessKeyLabel
    254254PASS HTMLElement interface: attribute draggable
    255255PASS HTMLElement interface: attribute spellcheck
     
    342342PASS HTMLElement interface: document.createElement("noscript") must inherit property "click()" with the proper type
    343343PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKey" with the proper type
    344 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type assert_inherits: property "accessKeyLabel" not found in prototype chain
     344PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type
    345345PASS HTMLElement interface: document.createElement("noscript") must inherit property "draggable" with the proper type
    346346PASS HTMLElement interface: document.createElement("noscript") must inherit property "spellcheck" with the proper type
  • trunk/LayoutTests/platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt

    r257707 r262235  
    4141PASS a["hidden"] is false
    4242PASS a["accessKey"] is
     43PASS a["accessKeyLabel"] is
    4344PASS a["draggable"] is true
    4445PASS a["spellcheck"] is true
     
    4748PASS a["isContentEditable"] is false
    4849PASS a["offsetParent"] is [object HTMLBodyElement]
    49 PASS a["offsetTop"] is 729
     50PASS a["offsetTop"] is 744
    5051PASS a["offsetLeft"] is 8
    5152PASS a["offsetWidth"] is 40
  • trunk/LayoutTests/platform/win/js/dom/dom-static-property-for-in-iteration-expected.txt

    r220870 r262235  
    4343PASS a["outerText"] is nerget
    4444PASS a["accessKey"] is
     45PASS a["accessKeyLabel"] is
    4546PASS a["children"] is [object HTMLCollection]
    4647PASS a["isContentEditable"] is false
     
    6869PASS a["offsetHeight"] is 18
    6970PASS a["clientHeight"] is 0
    70 PASS a["offsetTop"] is 1059
     71PASS a["offsetTop"] is 1074
    7172PASS a["scrollTop"] is 0
    7273PASS a["scrollHeight"] is 0
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r257707 r262235  
    251251PASS HTMLElement interface: operation click()
    252252PASS HTMLElement interface: attribute accessKey
    253 FAIL HTMLElement interface: attribute accessKeyLabel assert_true: The prototype object must have a property "accessKeyLabel" expected true got false
     253PASS HTMLElement interface: attribute accessKeyLabel
    254254PASS HTMLElement interface: attribute draggable
    255255PASS HTMLElement interface: attribute spellcheck
     
    342342PASS HTMLElement interface: document.createElement("noscript") must inherit property "click()" with the proper type
    343343PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKey" with the proper type
    344 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type assert_inherits: property "accessKeyLabel" not found in prototype chain
     344PASS HTMLElement interface: document.createElement("noscript") must inherit property "accessKeyLabel" with the proper type
    345345PASS HTMLElement interface: document.createElement("noscript") must inherit property "draggable" with the proper type
    346346PASS HTMLElement interface: document.createElement("noscript") must inherit property "spellcheck" with the proper type
  • trunk/LayoutTests/platform/wpe/js/dom/dom-static-property-for-in-iteration-expected.txt

    r257707 r262235  
    4040PASS a["hidden"] is false
    4141PASS a["accessKey"] is
     42PASS a["accessKeyLabel"] is
    4243PASS a["draggable"] is true
    4344PASS a["spellcheck"] is true
     
    4647PASS a["isContentEditable"] is false
    4748PASS a["offsetParent"] is [object HTMLBodyElement]
    48 PASS a["offsetTop"] is 714
     49PASS a["offsetTop"] is 729
    4950PASS a["offsetLeft"] is 8
    5051PASS a["offsetWidth"] is 39
  • trunk/Source/WTF/ChangeLog

    r262223 r262235  
     12020-05-27  Noam Rosenthal  <noam@webkit.org>
     2
     3        Implement AccessKeyLabel attribute.
     4        https://bugs.webkit.org/show_bug.cgi?id=72715
     5
     6        Reviewed by Darin Adler.
     7
     8        Added character names for upArrow/option, as they're needed for accessKeyLabel.
     9
     10        * wtf/unicode/CharacterNames.h:
     11
    1122020-05-27  Saam Barati  <sbarati@apple.com>
    213
  • trunk/Source/WTF/wtf/unicode/CharacterNames.h

    r239822 r262235  
    7474const UChar noBreakSpace = 0x00A0;
    7575const UChar objectReplacementCharacter = 0xFFFC;
     76const UChar optionKey = 0x2325;
    7677const UChar popDirectionalFormatting = 0x202C;
    7778const UChar popDirectionalIsolate = 0x2069;
     
    9293const UChar tibetanMarkIntersyllabicTsheg = 0x0F0B;
    9394const UChar32 ugariticWordDivider = 0x1039F;
     95const UChar upArrowhead = 0x2303;
    9496const UChar whiteBullet = 0x25E6;
    9597const UChar whiteCircle = 0x25CB;
     
    159161using WTF::Unicode::tibetanMarkIntersyllabicTsheg;
    160162using WTF::Unicode::ugariticWordDivider;
     163using WTF::Unicode::upArrowhead;
    161164using WTF::Unicode::whiteBullet;
    162165using WTF::Unicode::whiteCircle;
  • trunk/Source/WebCore/ChangeLog

    r262232 r262235  
     12020-05-27  Noam Rosenthal  <noam@webkit.org>
     2
     3        Implement AccessKeyLabel attribute.
     4        https://bugs.webkit.org/show_bug.cgi?id=72715
     5
     6        Spec: https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel
     7
     8        As per spec, return the modifiers+accessKey when requesting the element accessKeyLabel.
     9
     10        Equivalent to the existing Firefox implementation and (pending) Chrome implementation.
     11
     12        Alt is the hardcoded modifier for any non-cocoa platform, so hardcode it also for the label.
     13        Use modifier text for Mac/iOS as it can change (e.g. for voice-over).
     14
     15        Reviewed by Darin Adler.
     16
     17        Test: fast/forms/access-key-label.html
     18
     19        * html/HTMLElement.cpp:
     20        (WebCore::HTMLElement::accessKeyLabel const):
     21        * html/HTMLElement.h:
     22        * html/HTMLElement.idl:
     23
    1242020-05-27  Sam Weinig  <weinig@apple.com>
    225
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r262155 r262235  
    3737#include "EnterKeyHint.h"
    3838#include "Event.h"
     39#include "EventHandler.h"
    3940#include "EventListener.h"
    4041#include "EventNames.h"
     
    7172#include <wtf/StdLibExtras.h>
    7273#include <wtf/text/CString.h>
     74#include <wtf/text/StringBuilder.h>
    7375
    7476namespace WebCore {
     
    724726}
    725727
     728String HTMLElement::accessKeyLabel() const
     729{
     730    const auto& accessKey = attributeWithoutSynchronization(accesskeyAttr);
     731    if (accessKey.isEmpty())
     732        return String();
     733
     734    StringBuilder result;
     735
     736#if PLATFORM(COCOA)
     737    auto modifiers = EventHandler::accessKeyModifiers();
     738    if (modifiers.contains(PlatformEvent::Modifier::ControlKey))
     739        result.append(upArrowhead);
     740    if (modifiers.contains(PlatformEvent::Modifier::AltKey))
     741        result.append(WTF::Unicode::optionKey);
     742#else
     743    // Currently accessKeyModifier in non-cocoa platforms is hardcoded to Alt, so no reason to do extra work here.
     744    // If this ever becomes configurable, make this code use EventHandler::accessKeyModifiers().
     745    result.append("Alt+");
     746#endif
     747
     748    result.append(accessKey);
     749    return result.toString();
     750}
     751
    726752String HTMLElement::title() const
    727753{
  • trunk/Source/WebCore/html/HTMLElement.h

    r259687 r262235  
    6868
    6969    bool accessKeyAction(bool sendMouseEvents) override;
     70
     71    String accessKeyLabel() const;
    7072
    7173    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
  • trunk/Source/WebCore/html/HTMLElement.idl

    r254121 r262235  
    3535    void click();
    3636    [CEReactions, Reflect] attribute DOMString accessKey;
    37     // readonly attribute DOMString accessKeyLabel; // FIXME: Not supported.
     37    readonly attribute DOMString accessKeyLabel;
    3838    [CEReactions] attribute boolean draggable;
    3939    // [CEReactions] attribute HTMLMenuElement? contextMenu; // FIXME: Not supported.
Note: See TracChangeset for help on using the changeset viewer.