Changeset 271523 in webkit


Ignore:
Timestamp:
Jan 15, 2021 8:53:46 AM (18 months ago)
Author:
Tomoki Imai
Message:

When non-integer tabindex is set, the behavior of element should be same as the tabindex is omitted.
https://bugs.webkit.org/show_bug.cgi?id=220648

Reviewed by Antti Koivisto.

Source/WebCore:

When non-integer tabindex is specified, the element should behave the same way as the tabindex is omitted.
https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex

WebKit didn't overwrite the internal tabindex value when the new value is non-integer.

Test: LayoutTests\fast\html\tabindex-overwrite-with-non-integer.html

  • html/HTMLElement.cpp:

(WebCore::HTMLElement::parseAttribute): If the new value cannot be parsed as the integer, clear the existing tabindex.

LayoutTests:

Add LayoutTest case for tabindex which is overwritten by non-integers.
When non-integer tabindex is specified, the element should behave the same way as the tabindex is omitted.
https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex

  • fast/html/tabindex-overwrite-with-non-integer-expected.txt: Added.
  • fast/html/tabindex-overwrite-with-non-integer.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271516 r271523  
     12021-01-15  Tomoki Imai  <Tomoki.Imai@sony.com>
     2
     3        When non-integer tabindex is set, the behavior of element should be same as the tabindex is omitted.
     4        https://bugs.webkit.org/show_bug.cgi?id=220648
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Add LayoutTest case for tabindex which is overwritten by non-integers.
     9        When non-integer tabindex is specified, the element should behave the same way as the tabindex is omitted.
     10        https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex
     11
     12        * fast/html/tabindex-overwrite-with-non-integer-expected.txt: Added.
     13        * fast/html/tabindex-overwrite-with-non-integer.html: Added.
     14
    1152021-01-15  Zalan Bujtas  <zalan@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r271521 r271523  
     12021-01-15  Tomoki Imai  <Tomoki.Imai@sony.com>
     2
     3        When non-integer tabindex is set, the behavior of element should be same as the tabindex is omitted.
     4        https://bugs.webkit.org/show_bug.cgi?id=220648
     5
     6        Reviewed by Antti Koivisto.
     7
     8        When non-integer tabindex is specified, the element should behave the same way as the tabindex is omitted.
     9        https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex
     10
     11        WebKit didn't overwrite the internal tabindex value when the new value is non-integer.
     12
     13        Test: LayoutTests\fast\html\tabindex-overwrite-with-non-integer.html
     14
     15        * html/HTMLElement.cpp:
     16        (WebCore::HTMLElement::parseAttribute): If the new value cannot be parsed as the integer, clear the existing tabindex.
     17
    1182021-01-15  Rob Buis  <rbuis@igalia.com>
    219
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r271011 r271523  
    453453
    454454    if (name == tabindexAttr) {
    455         if (value.isEmpty())
     455        if (auto optionalTabIndex = parseHTMLInteger(value))
     456            setTabIndexExplicitly(optionalTabIndex.value());
     457        else
    456458            setTabIndexExplicitly(WTF::nullopt);
    457         else if (auto optionalTabIndex = parseHTMLInteger(value))
    458             setTabIndexExplicitly(optionalTabIndex.value());
    459459        return;
    460460    }
Note: See TracChangeset for help on using the changeset viewer.