Changeset 249237 in webkit
- Timestamp:
- Aug 28, 2019, 8:14:24 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/tabindex-defaults-expected.txt (modified) (4 diffs)
-
LayoutTests/fast/dom/tabindex-defaults.html (modified) (7 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt (modified) (1 diff)
-
LayoutTests/plugins/focus-expected.txt (modified) (1 diff)
-
LayoutTests/plugins/focus.html (modified) (2 diffs)
-
LayoutTests/svg/custom/tabindex-order-expected.txt (modified) (2 diffs)
-
LayoutTests/svg/custom/tabindex-order.html (modified) (3 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Element.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLFrameElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLFrameElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLIFrameElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLIFrameElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLObjectElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLObjectElement.h (modified) (2 diffs)
-
Source/WebCore/html/HTMLSummaryElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLSummaryElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249220 r249237 1 2019-08-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 Make tabIndex IDL attribute reflect its content attribute 4 https://bugs.webkit.org/show_bug.cgi?id=199606 5 <rdar://problem/52811448> 6 7 Reviewed by Chris Dumez. 8 9 Added test cases and assertions. 10 11 * fast/dom/tabindex-defaults-expected.txt: 12 * fast/dom/tabindex-defaults.html: Added test cases for iframe, frame, object, video, summary, and SVG elements. 13 Also blur the active element to avoid any race conditions. 14 * plugins/focus-expected.txt: 15 * plugins/focus.html: 16 * svg/custom/tabindex-order-expected.txt: 17 * svg/custom/tabindex-order.html: Made the sequential navigation code not rely on tabIndex IDL attribute. 18 1 19 2019-08-28 Devin Rousso <drousso@apple.com> 2 20 -
trunk/LayoutTests/fast/dom/tabindex-defaults-expected.txt
r248914 r249237 5 5 6 6 PASS anchor.tabIndex is 0 7 PASS iframe.tabIndex is 0 8 PASS frame.tabIndex is 0 9 PASS object.tabIndex is 0 7 10 PASS button.tabIndex is 0 8 11 PASS input.tabIndex is 0 … … 10 13 PASS textarea.tabIndex is 0 11 14 PASS keygen.tabIndex is 0 12 PASS editableDiv.tabIndex is 0 15 PASS activeSummary.tabIndex is 0 16 PASS editableDiv.tabIndex is -1 13 17 PASS normalDiv.tabIndex is -1 14 18 PASS output.tabIndex is -1 15 19 PASS fieldset.tabIndex is -1 20 PASS video.tabIndex is -1 21 PASS videoWithControls.tabIndex is -1 22 PASS summary.tabIndex is -1 23 PASS bodyInDesignMode.tabIndex is -1 24 PASS g.tabIndex is -1 16 25 PASS anchor.setAttribute("tabindex", "invalid"); anchor.tabIndex is 0 26 PASS iframe.setAttribute("tabindex", "invalid"); iframe.tabIndex is 0 27 PASS frame.setAttribute("tabindex", "invalid"); frame.tabIndex is 0 28 PASS object.setAttribute("tabindex", "invalid"); object.tabIndex is 0 17 29 PASS button.setAttribute("tabindex", "invalid"); button.tabIndex is 0 18 30 PASS input.setAttribute("tabindex", "invalid"); input.tabIndex is 0 … … 20 32 PASS textarea.setAttribute("tabindex", "invalid"); textarea.tabIndex is 0 21 33 PASS keygen.setAttribute("tabindex", "invalid"); keygen.tabIndex is 0 22 PASS editableDiv.setAttribute("tabindex", "invalid"); editableDiv.tabIndex is 0 34 PASS activeSummary.setAttribute("tabindex", "invalid"); activeSummary.tabIndex is 0 35 PASS editableDiv.setAttribute("tabindex", "invalid"); editableDiv.tabIndex is -1 23 36 PASS normalDiv.setAttribute("tabindex", "invalid"); normalDiv.tabIndex is -1 24 37 PASS output.setAttribute("tabindex", "invalid"); output.tabIndex is -1 25 38 PASS fieldset.setAttribute("tabindex", "invalid"); fieldset.tabIndex is -1 39 PASS video.setAttribute("tabindex", "invalid"); video.tabIndex is -1 40 PASS videoWithControls.setAttribute("tabindex", "invalid"); videoWithControls.tabIndex is -1 41 PASS summary.setAttribute("tabindex", "invalid"); summary.tabIndex is -1 42 PASS bodyInDesignMode.setAttribute("tabindex", "invalid"); bodyInDesignMode.tabIndex is -1 43 PASS g.setAttribute("tabindex", "invalid"); g.tabIndex is -1 26 44 PASS anchor.setAttribute("tabindex", "9999999999"); anchor.tabIndex is 0 45 PASS iframe.setAttribute("tabindex", "9999999999"); iframe.tabIndex is 0 46 PASS frame.setAttribute("tabindex", "9999999999"); frame.tabIndex is 0 47 PASS object.setAttribute("tabindex", "invalid"); object.tabIndex is 0 27 48 PASS button.setAttribute("tabindex", "9999999999"); button.tabIndex is 0 28 49 PASS input.setAttribute("tabindex", "9999999999"); input.tabIndex is 0 … … 30 51 PASS textarea.setAttribute("tabindex", "9999999999"); textarea.tabIndex is 0 31 52 PASS keygen.setAttribute("tabindex", "9999999999"); keygen.tabIndex is 0 32 PASS editableDiv.setAttribute("tabindex", "9999999999"); editableDiv.tabIndex is 0 53 PASS activeSummary.setAttribute("tabindex", "9999999999"); activeSummary.tabIndex is 0 54 PASS editableDiv.setAttribute("tabindex", "9999999999"); editableDiv.tabIndex is -1 33 55 PASS normalDiv.setAttribute("tabindex", "9999999999"); normalDiv.tabIndex is -1 34 56 PASS output.setAttribute("tabindex", "9999999999"); output.tabIndex is -1 35 57 PASS fieldset.setAttribute("tabindex", "9999999999"); fieldset.tabIndex is -1 58 PASS video.setAttribute("tabindex", "9999999999"); video.tabIndex is -1 59 PASS videoWithControls.setAttribute("tabindex", "9999999999"); videoWithControls.tabIndex is -1 60 PASS summary.setAttribute("tabindex", "9999999999"); summary.tabIndex is -1 61 PASS bodyInDesignMode.setAttribute("tabindex", "9999999999"); bodyInDesignMode.tabIndex is -1 62 PASS g.setAttribute("tabindex", "9999999999"); g.tabIndex is -1 36 63 PASS successfullyParsed is true 37 64 -
trunk/LayoutTests/fast/dom/tabindex-defaults.html
r248960 r249237 8 8 <!-- Focusable elements --> 9 9 <a id="anchor" href="tabindex-defaults.html">anchor</a> 10 <iframe id="iframe"></iframe> 11 <object id="object"></object> 10 12 <button id="button">button</button> 11 13 <input id="input"> … … 14 16 <keygen id="keygen"></keygen> 15 17 <div id="editableDiv" contenteditable="true"></div> 18 <details><summary id="activeSummary"></summary></details> 16 19 17 20 <!-- Unfocusable element --> … … 19 22 <output id="output"></output> 20 23 <fieldset id="fieldset"></fieldset> 24 <video id="video"></video> 25 <video id="videoWithControls" controls></video> 26 <details><summary></summary><summary id="summary"></summary></details> 27 <iframe id="iframeForDesignMode"></iframe> 28 <svg><g id="g" onfocus="alert('fail')"></g></svg> 21 29 </div> 22 30 … … 25 33 26 34 var anchor = document.getElementById('anchor'); 35 var iframe = document.getElementById('iframe'); 36 iframe.contentDocument.open(); 37 iframe.contentDocument.write('<!DOCTYPE><html><frameset cols="50%,50%"><frame></frame></frameset>'); 38 var frame = iframe.contentDocument.querySelector('frame'); 39 var object = document.getElementById('object'); 27 40 var button = document.getElementById('button'); 28 41 var input = document.getElementById('input'); 29 42 var select = document.getElementById('select'); 30 43 var textarea = document.getElementById('textarea'); 44 var keygen = document.getElementById('keygen'); 31 45 var editableDiv = document.getElementById('editableDiv'); 46 var normalDiv = document.getElementById('normalDiv'); 32 47 var output = document.getElementById('output'); 33 48 var fieldset = document.getElementById('fieldset'); 34 var keygen = document.getElementById('keygen'); 35 var normalDiv = document.getElementById('normalDiv'); 49 var video = document.getElementById('video'); 50 var videoWithControls = document.getElementById('videoWithControls'); 51 var summary = document.getElementById('summary'); 52 var activeSummary = document.getElementById('activeSummary'); 53 var iframeForDesignMode = document.getElementById('iframeForDesignMode'); 54 iframeForDesignMode.contentDocument.designMode = 'on'; 55 var bodyInDesignMode = iframeForDesignMode.contentDocument.body; 56 var g = document.getElementById('g'); 36 57 37 58 shouldBe('anchor.tabIndex', '0'); 59 shouldBe('iframe.tabIndex', '0'); 60 shouldBe('frame.tabIndex', '0'); 61 shouldBe('object.tabIndex', '0'); 38 62 shouldBe('button.tabIndex', '0'); 39 63 shouldBe('input.tabIndex', '0'); … … 41 65 shouldBe('textarea.tabIndex', '0'); 42 66 shouldBe('keygen.tabIndex', '0'); 43 shouldBe('editableDiv.tabIndex', '0'); 67 shouldBe('activeSummary.tabIndex', '0'); 68 shouldBe('editableDiv.tabIndex', '-1'); 44 69 shouldBe('normalDiv.tabIndex', '-1'); 45 70 shouldBe('output.tabIndex', '-1'); 46 71 shouldBe('fieldset.tabIndex', '-1'); 72 shouldBe('video.tabIndex', '-1'); 73 shouldBe('videoWithControls.tabIndex', '-1'); 74 shouldBe('summary.tabIndex', '-1'); 75 shouldBe('bodyInDesignMode.tabIndex', '-1'); 76 shouldBe('g.tabIndex', '-1'); 47 77 48 78 shouldBe('anchor.setAttribute("tabindex", "invalid"); anchor.tabIndex', '0'); 79 shouldBe('iframe.setAttribute("tabindex", "invalid"); iframe.tabIndex', '0'); 80 shouldBe('frame.setAttribute("tabindex", "invalid"); frame.tabIndex', '0'); 81 shouldBe('object.setAttribute("tabindex", "invalid"); object.tabIndex', '0'); 49 82 shouldBe('button.setAttribute("tabindex", "invalid"); button.tabIndex', '0'); 50 83 shouldBe('input.setAttribute("tabindex", "invalid"); input.tabIndex', '0'); … … 52 85 shouldBe('textarea.setAttribute("tabindex", "invalid"); textarea.tabIndex', '0'); 53 86 shouldBe('keygen.setAttribute("tabindex", "invalid"); keygen.tabIndex', '0'); 54 shouldBe('editableDiv.setAttribute("tabindex", "invalid"); editableDiv.tabIndex', '0'); 87 shouldBe('activeSummary.setAttribute("tabindex", "invalid"); activeSummary.tabIndex', '0'); 88 shouldBe('editableDiv.setAttribute("tabindex", "invalid"); editableDiv.tabIndex', '-1'); 55 89 shouldBe('normalDiv.setAttribute("tabindex", "invalid"); normalDiv.tabIndex', '-1'); 56 90 shouldBe('output.setAttribute("tabindex", "invalid"); output.tabIndex', '-1'); 57 91 shouldBe('fieldset.setAttribute("tabindex", "invalid"); fieldset.tabIndex', '-1'); 92 shouldBe('video.setAttribute("tabindex", "invalid"); video.tabIndex', '-1'); 93 shouldBe('videoWithControls.setAttribute("tabindex", "invalid"); videoWithControls.tabIndex', '-1'); 94 shouldBe('summary.setAttribute("tabindex", "invalid"); summary.tabIndex', '-1'); 95 shouldBe('bodyInDesignMode.setAttribute("tabindex", "invalid"); bodyInDesignMode.tabIndex', '-1'); 96 shouldBe('g.setAttribute("tabindex", "invalid"); g.tabIndex', '-1'); 58 97 59 98 shouldBe('anchor.setAttribute("tabindex", "9999999999"); anchor.tabIndex', '0'); 99 shouldBe('iframe.setAttribute("tabindex", "9999999999"); iframe.tabIndex', '0'); 100 shouldBe('frame.setAttribute("tabindex", "9999999999"); frame.tabIndex', '0'); 101 shouldBe('object.setAttribute("tabindex", "invalid"); object.tabIndex', '0'); 60 102 shouldBe('button.setAttribute("tabindex", "9999999999"); button.tabIndex', '0'); 61 103 shouldBe('input.setAttribute("tabindex", "9999999999"); input.tabIndex', '0'); … … 63 105 shouldBe('textarea.setAttribute("tabindex", "9999999999"); textarea.tabIndex', '0'); 64 106 shouldBe('keygen.setAttribute("tabindex", "9999999999"); keygen.tabIndex', '0'); 65 shouldBe('editableDiv.setAttribute("tabindex", "9999999999"); editableDiv.tabIndex', '0'); 107 shouldBe('activeSummary.setAttribute("tabindex", "9999999999"); activeSummary.tabIndex', '0'); 108 shouldBe('editableDiv.setAttribute("tabindex", "9999999999"); editableDiv.tabIndex', '-1'); 66 109 shouldBe('normalDiv.setAttribute("tabindex", "9999999999"); normalDiv.tabIndex', '-1'); 67 110 shouldBe('output.setAttribute("tabindex", "9999999999"); output.tabIndex', '-1'); 68 111 shouldBe('fieldset.setAttribute("tabindex", "9999999999"); fieldset.tabIndex', '-1'); 112 shouldBe('video.setAttribute("tabindex", "9999999999"); video.tabIndex', '-1'); 113 shouldBe('videoWithControls.setAttribute("tabindex", "9999999999"); videoWithControls.tabIndex', '-1'); 114 shouldBe('summary.setAttribute("tabindex", "9999999999"); summary.tabIndex', '-1'); 115 shouldBe('bodyInDesignMode.setAttribute("tabindex", "9999999999"); bodyInDesignMode.tabIndex', '-1'); 116 shouldBe('g.setAttribute("tabindex", "9999999999"); g.tabIndex', '-1'); 69 117 70 118 document.getElementById('container').innerHTML = ''; -
trunk/LayoutTests/imported/w3c/ChangeLog
r249205 r249237 1 2019-08-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 Make tabIndex IDL attribute reflect its content attribute 4 https://bugs.webkit.org/show_bug.cgi?id=199606 5 <rdar://problem/52811448> 6 7 Reviewed by Chris Dumez. 8 9 * web-platform-tests/html/dom/reflection-misc-expected.txt: Rebaselined now that test cases for summary are passing. 10 1 11 2019-08-28 Alicia Boya García <aboya@igalia.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
r247527 r249237 2787 2787 PASS summary.accessKey: IDL set to object "test-valueOf" 2788 2788 PASS summary.tabIndex: typeof IDL attribute 2789 FAIL summary.tabIndex: setAttribute() to -36 assert_equals: IDL get expected -36 but got -1 2789 PASS summary.tabIndex: setAttribute() to -36 2790 2790 PASS summary.tabIndex: setAttribute() to -1 2791 FAIL summary.tabIndex: setAttribute() to 0 assert_equals: IDL get expected 0 but got -1 2792 FAIL summary.tabIndex: setAttribute() to 1 assert_equals: IDL get expected 1 but got -1 2793 FAIL summary.tabIndex: setAttribute() to 2147483647 assert_equals: IDL get expected 2147483647 but got -1 2794 FAIL summary.tabIndex: setAttribute() to -2147483648 assert_equals: IDL get expected -2147483648 but got -1 2791 PASS summary.tabIndex: setAttribute() to 0 2792 PASS summary.tabIndex: setAttribute() to 1 2793 PASS summary.tabIndex: setAttribute() to 2147483647 2794 PASS summary.tabIndex: setAttribute() to -2147483648 2795 2795 PASS summary.tabIndex: setAttribute() to "-1" 2796 FAIL summary.tabIndex: setAttribute() to "-0" assert_equals: IDL get expected 0 but got -1 2797 FAIL summary.tabIndex: setAttribute() to "0" assert_equals: IDL get expected 0 but got -1 2798 FAIL summary.tabIndex: setAttribute() to "1" assert_equals: IDL get expected 1 but got -1 2799 FAIL summary.tabIndex: setAttribute() to "\t7" assert_equals: IDL get expected 7 but got -1 2800 FAIL summary.tabIndex: setAttribute() to "\f7" assert_equals: IDL get expected 7 but got -1 2801 FAIL summary.tabIndex: setAttribute() to " 7" assert_equals: IDL get expected 7 but got -1 2802 FAIL summary.tabIndex: setAttribute() to "\n7" assert_equals: IDL get expected 7 but got -1 2803 FAIL summary.tabIndex: setAttribute() to "\r7" assert_equals: IDL get expected 7 but got -1 2804 FAIL summary.tabIndex: setAttribute() to 1.5 assert_equals: IDL get expected 1 but got -1 2805 FAIL summary.tabIndex: setAttribute() to object "2" assert_equals: IDL get expected 2 but got -1 2806 FAIL summary.tabIndex: IDL set to -36 assert_equals: IDL get expected -36 but got -1 2796 PASS summary.tabIndex: setAttribute() to "-0" 2797 PASS summary.tabIndex: setAttribute() to "0" 2798 PASS summary.tabIndex: setAttribute() to "1" 2799 PASS summary.tabIndex: setAttribute() to "\t7" 2800 PASS summary.tabIndex: setAttribute() to "\f7" 2801 PASS summary.tabIndex: setAttribute() to " 7" 2802 PASS summary.tabIndex: setAttribute() to "\n7" 2803 PASS summary.tabIndex: setAttribute() to "\r7" 2804 PASS summary.tabIndex: setAttribute() to 1.5 2805 PASS summary.tabIndex: setAttribute() to object "2" 2806 PASS summary.tabIndex: IDL set to -36 2807 2807 PASS summary.tabIndex: IDL set to -1 2808 FAIL summary.tabIndex: IDL set to 0 assert_equals: IDL get expected 0 but got -1 2809 FAIL summary.tabIndex: IDL set to 1 assert_equals: IDL get expected 1 but got -1 2810 FAIL summary.tabIndex: IDL set to 2147483647 assert_equals: IDL get expected 2147483647 but got -1 2811 FAIL summary.tabIndex: IDL set to -2147483648 assert_equals: IDL get expected -2147483648 but got -1 2808 PASS summary.tabIndex: IDL set to 0 2809 PASS summary.tabIndex: IDL set to 1 2810 PASS summary.tabIndex: IDL set to 2147483647 2811 PASS summary.tabIndex: IDL set to -2147483648 2812 2812 PASS menu.title: typeof IDL attribute 2813 2813 PASS menu.title: IDL get with DOM attribute unset -
trunk/LayoutTests/plugins/focus-expected.txt
r199054 r249237 8 8 TEST COMPLETE 9 9 PASS "embedElem"; document.activeElement === pluginElement is true 10 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 10 11 PASS "objectElem"; document.activeElement === pluginElement is true 12 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 11 13 PASS "embedElemWithFallbackContents"; document.activeElement === pluginElement is true 14 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 12 15 PASS "objectElemWithFallbackContents"; document.activeElement === pluginElement is true 16 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 13 17 PASS "noPluginEmbedElem"; document.activeElement === pluginElement is false 18 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 14 19 PASS "noPluginObjectElem"; document.activeElement === pluginElement is false 20 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 15 21 PASS "noPluginEmbedElemWithFallbackContents"; document.activeElement === pluginElement is false 22 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 16 23 PASS "noPluginObjectElemWithFallbackContents"; document.activeElement === pluginElement is false 24 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 17 25 PASS "noPluginEmbedElemWithTabindex"; document.activeElement === pluginElement is true 26 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 18 27 PASS "noPluginObjectElemWithTabindex"; document.activeElement === pluginElement is true 28 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 19 29 PASS "noPluginEmbedElemWithContenteditable"; document.activeElement === pluginElement is true 30 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 20 31 PASS "noPluginObjectElemWithContenteditable"; document.activeElement === pluginElement is true 32 PASS pluginElement.tabIndex is parseInt(pluginElement.getAttribute("data-expected-tabindex")) 21 33 fast/events/tabindex-focus-blur-all.html 22 34 Test for bug 32292: "Unable to focus on embedded plugins such as Flash via javascript focus()" -
trunk/LayoutTests/plugins/focus.html
r155282 r249237 10 10 <p>This tests focusing Embeds and Objects. See LayoutTests/java for Applet elements.</p> 11 11 <div id=embedOwner> 12 <embed id="embedElem" type="application/x-webkit-test-netscape" width=100 height=100 shouldFocus=true ></embed>13 <object id="objectElem" type="application/x-webkit-test-netscape" windowedPlugin="false" width=100 height=100 shouldFocus=true ></object>12 <embed id="embedElem" type="application/x-webkit-test-netscape" width=100 height=100 shouldFocus=true data-expected-tabindex=-1></embed> 13 <object id="objectElem" type="application/x-webkit-test-netscape" windowedPlugin="false" width=100 height=100 shouldFocus=true data-expected-tabindex=0></object> 14 14 15 <embed id="embedElemWithFallbackContents" type="application/x-webkit-test-netscape" width=100 height=100 shouldFocus=true >Fallback contents.</embed>16 <object id="objectElemWithFallbackContents" type="application/x-webkit-test-netscape" windowedPlugin="false" width=100 height=100 shouldFocus=true >Fallback contents.</object>15 <embed id="embedElemWithFallbackContents" type="application/x-webkit-test-netscape" width=100 height=100 shouldFocus=true data-expected-tabindex=-1>Fallback contents.</embed> 16 <object id="objectElemWithFallbackContents" type="application/x-webkit-test-netscape" windowedPlugin="false" width=100 height=100 shouldFocus=true data-expected-tabindex=0>Fallback contents.</object> 17 17 18 <embed id="noPluginEmbedElem" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false ></embed>19 <object id="noPluginObjectElem" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false ></object>18 <embed id="noPluginEmbedElem" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false data-expected-tabindex=-1></embed> 19 <object id="noPluginObjectElem" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false data-expected-tabindex=0></object> 20 20 21 <embed id="noPluginEmbedElemWithFallbackContents" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false >Fallback contents.</embed>22 <object id="noPluginObjectElemWithFallbackContents" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false >Fallback contents.</object>21 <embed id="noPluginEmbedElemWithFallbackContents" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false data-expected-tabindex=-1>Fallback contents.</embed> 22 <object id="noPluginObjectElemWithFallbackContents" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 shouldFocus=false data-expected-tabindex=0>Fallback contents.</object> 23 23 24 <embed id="noPluginEmbedElemWithTabindex" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 tabindex=-1 shouldFocus=true ></embed>25 <object id="noPluginObjectElemWithTabindex" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 tabindex=-1 shouldFocus=true ></object>24 <embed id="noPluginEmbedElemWithTabindex" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 tabindex=-1 shouldFocus=true data-expected-tabindex=-1></embed> 25 <object id="noPluginObjectElemWithTabindex" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 tabindex=-1 shouldFocus=true data-expected-tabindex=-1></object> 26 26 27 <embed id="noPluginEmbedElemWithContenteditable" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 contenteditable=true shouldFocus=true ></embed>28 <object id="noPluginObjectElemWithContenteditable" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 contenteditable=true shouldFocus=true ></object>27 <embed id="noPluginEmbedElemWithContenteditable" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 contenteditable=true shouldFocus=true data-expected-tabindex=-1></embed> 28 <object id="noPluginObjectElemWithContenteditable" type="application/x-no-such-plugin" windowedPlugin="false" width=100 height=100 contenteditable=true shouldFocus=true data-expected-tabindex=0></object> 29 29 </div> 30 30 <script> … … 40 40 shouldBe('"' + pluginElement.id + '"; document.activeElement === pluginElement', 41 41 pluginElement.getAttribute("shouldFocus").toString()); 42 shouldBe('pluginElement.tabIndex', 'parseInt(pluginElement.getAttribute("data-expected-tabindex"))'); 42 43 pluginElement.blur(); 43 44 } -
trunk/LayoutTests/svg/custom/tabindex-order-expected.txt
r248983 r249237 17 17 id: j tabindex: 0 [object SVGLineElement] is focused. 18 18 id: k tabindex: 0 [object SVGPolygonElement] is focused. 19 id: a tabindex: 1 [object SVGCircleElement] is focused. 19 20 20 21 Tabbing backward.... … … 32 33 id: b tabindex: 1 [object SVGGElement] is focused. 33 34 id: a tabindex: 1 [object SVGCircleElement] is focused. 35 id: k tabindex: 0 [object SVGPolygonElement] is focused. 34 36 35 37 Test finished -
trunk/LayoutTests/svg/custom/tabindex-order.html
r248983 r249237 35 35 } 36 36 37 document.activeElement.blur(); 38 37 39 var rects = document.getElementsByClassName('tab'); 38 40 … … 44 46 45 47 log('Tabbing forward....\n'); 48 let tabCount = 0; 46 49 for (var i = 0; i < rects.length; ++i) { 47 if (rects[i].tabIndex >= 0) 48 dispatchTabPress(document, false); 50 if (i > 1 && document.activeElement.id == 'a') 51 break; 52 dispatchTabPress(document, false); 53 tabCount++; 49 54 } 50 55 … … 52 57 53 58 log('\nTabbing backward....\n'); 54 for (var i = 0; i < rects.length; ++i) { 55 if (rects[i].tabIndex >= 0) 56 dispatchTabPress(document, true); 57 } 59 previousActiveElement = null; 60 for (var i = 0; i < tabCount; ++i) 61 dispatchTabPress(document, true); 58 62 59 63 log('\nTest finished\n'); -
trunk/Source/WebCore/ChangeLog
r249236 r249237 1 2019-08-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 Make tabIndex IDL attribute reflect its content attribute 4 https://bugs.webkit.org/show_bug.cgi?id=199606 5 <rdar://problem/52811448> 6 7 Reviewed by Chris Dumez. 8 9 This patch makes tabIndex IDL attribute no longer return 0 when the element is focusable 10 to match the latest HTML5 specification. Instead, the IDL attribute simply reflect the tabindex 11 content attribute with some elements having 0 as the default tab index (see r248784): 12 https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute 13 14 The practical implication is that tabIndex IDL attribute on a root editable element (a.k.a. 15 editing host in HTML5 spec term), body element in design mode, and media elements with 16 media controls would start returning -1 instead of 0. 17 18 Mechanically, this is accomplished by removing the special case in Element::tabIndexForBindings 19 when supportsFocus returned true. The effect, if any, this patch has on each element which 20 overrides Element::supportsFocus is summarized as follows (indentation simplies inheritance): 21 22 HTMLAnchorElement -> No effect since defaultTabIndex returns 0. 23 HTMLAreaElement -> Ditto. 24 HTMLBodyElement -> Changes to return -1 in design mode. 25 HTMLElement -> Changes to return -1 on a root editable element. 26 HTMLFormControlElement 27 HTMLButtonElement -> No effect since defaultTabIndex returns 0. 28 HTMLFieldSetElement -> No effect since this is an override to use HTMLElement's supportsFocus. 29 HTMLFormControlElementWithState 30 HTMLKeygenElement -> No effect since defaultTabIndex returns 0. 31 HTMLSelectElement -> Ditto. 32 HTMLTextFormControlElement -> Ditto. 33 HTMLInputElement -> Ditto. 34 HTMLTextAreaElement -> Ditto. 35 HTMLOutputElement -> No effect since this is an override to use HTMLElement's supportsFocus. 36 HTMLFrameElementBase - No change. Added defaultTabIndex on HTMLIFrameElement and HTMLFrameElement 37 to returns 0. 38 HTMLImageElement - No impact since it only affects when an image is set to be editable via SPI. 39 HTMLMediaElement - Changes to return -1 when media controls is present. 40 HTMLPlugInElement - applet and embed elements change to return -1 when the plugin is available. 41 HTMLSummaryElement - No change. Added defaultTabIndex to return 0 when it's active to match 42 supportsFocus as well as the HTML5 specification. 43 MathMLElement - No effect since tabIndex IDL attribute does not exist in MathML. 44 SVGAElement - No effect since defaultTabIndex returns 0. 45 SVGClipPathElement - No effect since it always returns false. 46 SVGDefsElement - No effect since it always returns false. 47 48 Tests: fast/dom/tabindex-defaults.html 49 plugins/focus.html 50 51 * dom/Element.cpp: 52 (WebCore::Element::tabIndexForBindings const): Made the change. 53 * html/HTMLFrameElement.cpp: 54 (WebCore::HTMLFrameElement::defaultTabIndex const): Added to preserve the existing behavior. 55 * html/HTMLFrameElement.h: 56 * html/HTMLIFrameElement.cpp: 57 (WebCore::HTMLIFrameElement::defaultTabIndex const): Ditto. 58 * html/HTMLIFrameElement.h: 59 * html/HTMLObjectElement.cpp: 60 (WebCore::HTMLObjectElement::defaultTabIndex const): Added. Always return 0 to match the spec. 61 * html/HTMLObjectElement.h: 62 * html/HTMLSummaryElement.cpp: 63 (WebCore::HTMLSummaryElement::defaultTabIndex const): Added. Return 0 when the this summary 64 is the active summary element of the details element. 65 * html/HTMLSummaryElement.h: 66 1 67 2019-08-28 Simon Fraser <simon.fraser@apple.com> 2 68 -
trunk/Source/WebCore/dom/Element.cpp
r248846 r249237 268 268 int Element::tabIndexForBindings() const 269 269 { 270 auto defaultIndex = defaultTabIndex(); 271 ASSERT(!defaultIndex || defaultIndex == -1); 272 // FIXME: supportsFocus() check shouldn't be here. 273 if (!defaultIndex || supportsFocus()) 274 return tabIndexSetExplicitly().valueOr(0); 275 return defaultIndex; 270 return valueOrCompute(tabIndexSetExplicitly(), [&] { return defaultTabIndex(); }); 276 271 } 277 272 -
trunk/Source/WebCore/html/HTMLFrameElement.cpp
r247529 r249237 75 75 } 76 76 77 int HTMLFrameElement::defaultTabIndex() const 78 { 79 return 0; 80 } 81 77 82 void HTMLFrameElement::parseAttribute(const QualifiedName& name, const AtomString& value) 78 83 { -
trunk/Source/WebCore/html/HTMLFrameElement.h
r246490 r249237 46 46 bool rendererIsNeeded(const RenderStyle&) final; 47 47 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 48 int defaultTabIndex() const final; 48 49 void parseAttribute(const QualifiedName&, const AtomString&) final; 49 50 -
trunk/Source/WebCore/html/HTMLIFrameElement.cpp
r248846 r249237 50 50 { 51 51 return adoptRef(*new HTMLIFrameElement(tagName, document)); 52 } 53 54 int HTMLIFrameElement::defaultTabIndex() const 55 { 56 return 0; 52 57 } 53 58 -
trunk/Source/WebCore/html/HTMLIFrameElement.h
r249194 r249237 50 50 HTMLIFrameElement(const QualifiedName&, Document&); 51 51 52 int defaultTabIndex() const final; 52 53 void parseAttribute(const QualifiedName&, const AtomString&) final; 53 54 bool isPresentationAttribute(const QualifiedName&) const final; -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r249194 r249237 87 87 } 88 88 89 int HTMLObjectElement::defaultTabIndex() const 90 { 91 return 0; 92 } 93 89 94 bool HTMLObjectElement::isPresentationAttribute(const QualifiedName& name) const 90 95 { -
trunk/Source/WebCore/html/HTMLObjectElement.h
r249194 r249237 60 60 HTMLObjectElement(const QualifiedName&, Document&, HTMLFormElement*); 61 61 62 RenderWidget* renderWidgetLoadingPlugin() const final; 63 64 int defaultTabIndex() const final; 65 62 66 void parseAttribute(const QualifiedName&, const AtomString&) final; 63 67 bool isPresentationAttribute(const QualifiedName&) const final; … … 74 78 bool isURLAttribute(const Attribute&) const final; 75 79 const AtomString& imageSourceURL() const final; 76 77 RenderWidget* renderWidgetLoadingPlugin() const final;78 80 79 81 void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; -
trunk/Source/WebCore/html/HTMLSummaryElement.cpp
r248846 r249237 103 103 } 104 104 105 int HTMLSummaryElement::defaultTabIndex() const 106 { 107 return isActiveSummary() ? 0 : -1; 108 } 109 105 110 bool HTMLSummaryElement::supportsFocus() const 106 111 { -
trunk/Source/WebCore/html/HTMLSummaryElement.h
r229694 r249237 47 47 RefPtr<HTMLDetailsElement> detailsElement() const; 48 48 49 int defaultTabIndex() const final; 49 50 bool supportsFocus() const final; 50 51 };
Note:
See TracChangeset
for help on using the changeset viewer.