WebCore:
authoralice.liu@apple.com <alice.liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2008 01:18:52 +0000 (01:18 +0000)
committeralice.liu@apple.com <alice.liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2008 01:18:52 +0000 (01:18 +0000)
2008-04-28  Alice Liu  <alice.liu@apple.com>

        Reviewed by Darin.

        Fix <rdar://problem/4911289> Add tabindex property to all children
        of HTMLElement (7138)
        http://bugs.webkit.org/show_bug.cgi?id=7138

        Test: fast/events/tabindex-focus-blur-all.html

        * WebCore.xcodeproj/project.pbxproj:
        * bindings/objc/DOMPrivate.h:
        -DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h are no
         longer needed

        * bindings/objc/PublicDOMInterfaces.h:
        -Moving focus, blur, tabindex to HTMLElement from its descendants.

        * dom/Node.cpp:
        (WebCore::Node::Node):
        (WebCore::Node::isFocusable):
        (WebCore::Node::isKeyboardFocusable):
        -The concept of being focusable now needs to account for tabindex
        attribute.

        * dom/Node.h:
        -Need to use a bit to keep track of whether tabindex was explicitly set
         to 0 or was just initialized to 0.
        (WebCore::Node::tabIndex):
        -Make this virtual so that Anchors and GenericFormElements can determine
         tabindex without accounting for focusability
        (WebCore::Node::setTabIndexExplicitly):
        -Renamed setTabIndex() to setTabIndexExplicitly() so as not to hide
         behind and/or be confused for HTMLElement::setTabIndex

        * html/HTMLAnchorElement.cpp:
        * html/HTMLAnchorElement.h:
        (WebCore::HTMLAnchorElement::tabIndex):
        * html/HTMLGenericFormElement.cpp:
        * html/HTMLGenericFormElement.h:
        (WebCore::HTMLGenericFormElement::tabIndex):
        -Anchors and form elements are normally focusable, and need to avert the
         check for focusability in HTMLElement::tabIndex
         because tabIndex could be queried before a first layout happens.

        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::parseMappedAttribute):
        -Function Node::setTabIndex changed to Node::setTabIndexExplicitly
        (WebCore::HTMLElement::isFocusable):
        -The concept of being focusable now needs to account for tabindex
         attribute.
        (WebCore::HTMLElement::tabIndex):
        -HTML5 specifies that querying tabindex for elements that aren't
         focusable shall return -1
        (WebCore::HTMLElement::setTabIndex):
        -New default implementation
        * html/HTMLElement.h:

        * html/HTMLLegendElement.cpp:
        (WebCore::HTMLLegendElement::focus):
        -Now with HTML5's enhanced specification of tabindex, legend elements
         themselves shall focus (if they should), and not the first form element
         they encapsulate.  This matches Firefox behavior.  HTMLLabelElements
         still forward focus to the encapsulated element.  This also matches
         other browsers.

        * html/HTMLAreaElement.cpp:
        (WebCore::HTMLAreaElement::isFocusable):
        * html/HTMLAreaElement.h:
        -HTMLAreaElement isn't subject to the same focusability requirements as
         its parent, HTMLAnchorElement. Default HTMLElement implementation is
         desired.

        * html/HTMLFieldSetElement.cpp:
        (WebCore::HTMLFieldSetElement::isFocusable):
        * html/HTMLLegendElement.cpp:
        (WebCore::HTMLLegendElement::isFocusable):
        * html/HTMLOptGroupElement.cpp:
        (WebCore::HTMLOptGroupElement::isFocusable):
        * html/HTMLOptionElement.cpp:
        (WebCore::HTMLOptionElement::isFocusable):
        -These elements aren't subject to the same focusability requirements as
         their parent, HTMLGenericFormElement. Default HTMLElement
         implementation is desired.

        * html/HTMLAnchorElement.idl:
        * html/HTMLAreaElement.idl:
        * html/HTMLButtonElement.idl:
        * html/HTMLElement.idl:
        * html/HTMLInputElement.idl:
        * html/HTMLLabelElement.idl:
        * html/HTMLLegendElement.idl:
        * html/HTMLObjectElement.idl:
        * html/HTMLSelectElement.idl:
        * html/HTMLTextAreaElement.idl:
        -Moving tabindex attribute, focus and blur methods from descendants of
         HTMLElement to HTMLElement

WebKit/mac:

2008-04-28  Alice Liu  <alice.liu@apple.com>

        Reviewed by Darin.

        Fix <rdar://problem/4911289> Add tabindex property to all children
        of HTMLElement (7138)
        http://bugs.webkit.org/show_bug.cgi?id=7138

        * MigrateHeaders.make:
        Removing DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h
        because now that focus() has been moved to DOMHTMLElement.h, these
        files are no longer needed.

LayoutTests:

2008-04-28  Alice Liu  <alice.liu@apple.com>

        Reviewed by Sam Weinig.

        Fix <rdar://problem/4911289> Add tabindex property to all children
        of HTMLElement (7138)
        http://bugs.webkit.org/show_bug.cgi?id=7138

        minor updates to these existing tests:
        * fast/dom/domListEnumeration-expected.txt:
        * fast/dom/plugin-attributes-enumeration-expected.txt:
        * fast/dom/resources/domListEnumeration.js:

        * fast/events/resources/abe.png: Added.
        * fast/events/resources/tabindex-focus-blur-all-frame1.html: Added.
        * fast/events/resources/tabindex-focus-blur-all-frame2.html: Added.
        * fast/events/resources/tabindex-focus-blur-all-iframe1.html: Added.
        * fast/events/resources/tabindex-focus-blur-all-iframe2.html: Added.
        * fast/events/resources/tabindex-focus-blur-all.js: Added.
        * fast/events/tabindex-focus-blur-all-expected.txt: Added.
        * fast/events/tabindex-focus-blur-all.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32664 268f45cc-cd09-0410-ab3c-d52691b4dbfc

42 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/domListEnumeration-expected.txt
LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt
LayoutTests/fast/dom/resources/domListEnumeration.js
LayoutTests/fast/events/resources/abe.png [new file with mode: 0644]
LayoutTests/fast/events/resources/tabindex-focus-blur-all-frame1.html [new file with mode: 0644]
LayoutTests/fast/events/resources/tabindex-focus-blur-all-frame2.html [new file with mode: 0644]
LayoutTests/fast/events/resources/tabindex-focus-blur-all-iframe1.html [new file with mode: 0644]
LayoutTests/fast/events/resources/tabindex-focus-blur-all-iframe2.html [new file with mode: 0644]
LayoutTests/fast/events/resources/tabindex-focus-blur-all.js [new file with mode: 0644]
LayoutTests/fast/events/tabindex-focus-blur-all-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/tabindex-focus-blur-all.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/objc/DOMPrivate.h
WebCore/bindings/objc/PublicDOMInterfaces.h
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/html/HTMLAnchorElement.cpp
WebCore/html/HTMLAnchorElement.h
WebCore/html/HTMLAnchorElement.idl
WebCore/html/HTMLAreaElement.cpp
WebCore/html/HTMLAreaElement.h
WebCore/html/HTMLAreaElement.idl
WebCore/html/HTMLButtonElement.idl
WebCore/html/HTMLElement.cpp
WebCore/html/HTMLElement.h
WebCore/html/HTMLElement.idl
WebCore/html/HTMLFieldSetElement.cpp
WebCore/html/HTMLGenericFormElement.cpp
WebCore/html/HTMLGenericFormElement.h
WebCore/html/HTMLInputElement.idl
WebCore/html/HTMLLabelElement.idl
WebCore/html/HTMLLegendElement.cpp
WebCore/html/HTMLLegendElement.idl
WebCore/html/HTMLObjectElement.idl
WebCore/html/HTMLOptGroupElement.cpp
WebCore/html/HTMLOptionElement.cpp
WebCore/html/HTMLSelectElement.idl
WebCore/html/HTMLTextAreaElement.idl
WebKit/mac/ChangeLog
WebKit/mac/MigrateHeaders.make

index 2a298aa..6ea1a55 100644 (file)
@@ -1,3 +1,25 @@
+2008-04-28  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Fix <rdar://problem/4911289> Add tabindex property to all children 
+        of HTMLElement (7138)
+        http://bugs.webkit.org/show_bug.cgi?id=7138
+
+        minor updates to these existing tests:
+        * fast/dom/domListEnumeration-expected.txt:
+        * fast/dom/plugin-attributes-enumeration-expected.txt:
+        * fast/dom/resources/domListEnumeration.js:
+
+        * fast/events/resources/abe.png: Added.
+        * fast/events/resources/tabindex-focus-blur-all-frame1.html: Added.
+        * fast/events/resources/tabindex-focus-blur-all-frame2.html: Added.
+        * fast/events/resources/tabindex-focus-blur-all-iframe1.html: Added.
+        * fast/events/resources/tabindex-focus-blur-all-iframe2.html: Added.
+        * fast/events/resources/tabindex-focus-blur-all.js: Added.
+        * fast/events/tabindex-focus-blur-all-expected.txt: Added.
+        * fast/events/tabindex-focus-blur-all.html: Added.
+
 2008-04-28  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Dave Hyatt.
index 682564e..76dc2fb 100644 (file)
@@ -32,7 +32,7 @@ PASS resultArray[2].i is '2'
 PASS resultArray[2].item is namedNodeMap.item(2)
 
 [object HTMLFormElement]
-PASS resultArray.length is 113
+PASS resultArray.length is 114
 PASS resultArray[0].i is '0'
 PASS resultArray[0].item is document.getElementsByTagName('select')[0]
 PASS resultArray[1].i is '1'
index 4f5cf6d..84ff410 100644 (file)
@@ -130,7 +130,7 @@ shouldBe("resultArray[2].item", "namedNodeMap.item(2)");
 // HTMLFormElement
 var htmlFormElement = document.getElementsByTagName('form')[0];
 resultArray = iterateList(htmlFormElement);
-shouldBe("resultArray.length", "113");
+shouldBe("resultArray.length", "114");
 shouldBe("resultArray[0].i", "'0'");
 shouldBe("resultArray[0].item", "document.getElementsByTagName('select')[0]");
 shouldBe("resultArray[1].i", "'1'");
diff --git a/LayoutTests/fast/events/resources/abe.png b/LayoutTests/fast/events/resources/abe.png
new file mode 100644 (file)
index 0000000..c932536
Binary files /dev/null and b/LayoutTests/fast/events/resources/abe.png differ
diff --git a/LayoutTests/fast/events/resources/tabindex-focus-blur-all-frame1.html b/LayoutTests/fast/events/resources/tabindex-focus-blur-all-frame1.html
new file mode 100644 (file)
index 0000000..f38f105
--- /dev/null
@@ -0,0 +1,174 @@
+<body id="frame1body" tabindex="0">
+
+<!--anchor types-->
+<a href="#" tabindex="-1" id="a1">anchor</a><br>
+<img src ="abe.png" width="76" height="103" alt="honest abe" usemap ="#theMapName" />
+<map name="theMapName" id="map1">
+  <area shape ="rect" coords ="0,0,76,50" href="#" target ="_blank" alt="rectArea1" tabindex="1" id="area1a"/>
+  <area shape ="rect" coords ="0,50,76,103" href="#" target ="_blank" alt="rectArea2" tabindex="0" id="area1b"/>
+</map><br>
+
+<!--media elements-->
+<div id="div1a" tabindex="-1">
+<audio controls src="../../../media/content/test.wav" id="audio1"></audio><br>
+<video controls tabindex="2" id="video1">
+    <source src="../../../media/content/test.mp4" type="video/mpeg" id="source1">
+</video><br>
+</div>
+
+<!--embedded elements-->
+applet:<br>
+<applet width="100" height="100" code="" tabindex="-1" id="applet1"></applet><br>
+object:<br>
+<object type="application/x-webkit-test-netscape" width="100" height="100" id="object1"></object><br>
+embed:<br>
+<embed type="application/x-webkit-test-netscape" width="100" height="100" tabindex="3" id="embed1"></embed><br>
+
+<!--presentation-related elements-->
+<div id="div1b" tabindex="0">
+<abbr title="the tooltip" tabindex="-1" id="abbr1">abbr makes a tooltip</abbr><br>
+<acronym title="the tooltip" id="acronym1">acronym makes a tooltip</acronym><br>
+<bdo dir="rtl" tabindex="3" id="bdo1">text going right-to-left</bdo><br>
+a blockquote:<blockquote tabindex="0" id="blockquote1">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis eu nisi. Fusce aliquet massa non felis. Sed consectetuer. In hac habitasse platea dictumst. Nunc vitae nulla. Quisque tristique sollicitudin libero.</blockquote>
+a short quote:<q tabindex="-1" id="q1">Veni, Vidi, Vici</q>
+<p id="p1">paragraph</p>
+line break:<br tabindex="2" id="br1">
+horizontal rule:<hr tabindex="0" id="hr1">
+<marquee tabindex="-1" id="marquee1">marquee text</marquee>
+<center id="center1">centered text</center>
+</div>
+
+<!--font style tags-->
+<b tabindex="1" id="b1">Bold text</b><br>
+<big tabindex="0" id="big1">Big text</big><br>
+<i tabindex="-1" id="i1">Italic text</i><br>
+<small id="small1">Small text</small><br>
+<tt tabindex="1" id="tt1">Teletype text</tt><br>
+
+<!--canvas element-->
+<div id="div1c" tabindex="0">
+canvas:<br>
+<canvas width='200' height='100' tabindex="-1" id="canvas1"></canvas><br>
+</div>
+
+<!--Phrase elements-->
+<em id="em1">em</em><br>
+<strong tabindex="2" id="strong1">strong</strong><br>
+<dfn tabindex="0" id="dfn1">dfn</dfn><br>
+<code tabindex="-1" id="code1">code</code><br>
+<samp id="samp1">samp</samp><br>
+<kbd tabindex="3" id="kbd1">kbd</kbd><br>
+<var tabindex="0" id="var1">var</var><br>
+<cite tabindex="-1" id="cite1">cite</cite><br>
+
+<!--heading tags-->
+<div id="div1d">
+<h1 tabindex="3" id="h1_1">Heading 1</h1>
+<h2 tabindex="0" id="h2_1">Heading 2</h2>
+<h3 tabindex="-1" id="h3_1">Heading 3</h3>
+<h4 id="h4_1">Heading 4</h4>
+<h5 tabindex="2" id="h5_1">Heading 5</h5>
+<h6 tabindex="0" id="h6_1">Heading 6</h6>
+</div>
+
+<!--other style-related tags-->
+<s tabindex="-1" id="s1">strikethrough (sTag)</s><br>
+<strike id="strike1">strikethrough (strikeTag)</strike><br>
+<sub tabindex="1" id="sub1">subscript</sub><br>
+<sup tabindex="0" id="sup1">superscript</sup><br>
+<u tabindex="-1" id="u1">underlined</u><br>
+<del id="del1">delete</del><br>
+<ins tabindex="1" id="ins1">insert</ins><br>
+<pre tabindex="0" id="pre1">preformatted</pre>
+basic usage of <font tabindex="-1" id="font1">font</font> tag<br>
+basic usage of <span id="span1">span</span> tag<br>
+
+<!--tables-->
+<div id="div1e" tabindex="2">
+<table border="1" tabindex="0" id="table1">
+<caption tabindex="-1" id="caption1">table caption</caption>
+<colgroup span="2" id="colgroup1">
+<col width="100" tabindex="3" id="col1a"></col>
+<col width="250" tabindex="0" id="col1b"></col>
+</colgroup>
+<thead tabindex="-1" id="thead1"><tr><th id="th1">
+table header
+</th></tr></thead><tbody tabindex="3" id="tbody1">
+<tr tabindex="0" id="tr1">
+<td tabindex="-1" id="td1a">table cell 1</td>
+<td id="td1b">table cell 2</td>
+<td tabindex="2" id="td1c">table cell 3</td>
+</tr></tbody>
+<tfoot tabindex="0" id="tfoot1"><tr><td>
+table footer
+</td></tr></tfoot>
+</table>
+</div>
+
+<!--definition list-->
+<dl tabindex="-1" id="dl1">definition list
+<dt id="dt1a">term1</dt>
+<dd tabindex="1" id="dd1a">definition1</dd>
+<dt tabindex="0" id="dt1b">term2</dt>
+<dd tabindex="-1" id="dd1b">definition2</dd>
+</dl>
+    
+<!--lists -->
+<div id="div1f">
+<ul tabindex="1" id="ul1">unordered list
+<li tabindex="0" id="li1a"> ul li
+</ul>
+<ol tabindex="-1" id="ol1">ordered list
+<li id="li1b"> ol li
+</ol>
+<menu tabindex="2" id="menu1">menu list
+<li tabindex="0" id="li1c"> menu li
+</menu>
+<dir tabindex="-1" id="dir1">directory list
+<li id="li1d"> dir li
+</dir>
+</div>
+
+<!--images-->
+<image src="abe.png" tabindex="3" id="image1"><br>
+<img src="abe.png" tabindex="0" id="img1"><br>
+
+<!--forms-->
+<div id="div1g" tabindex="-1">
+<form id="form1">
+<fieldset tabindex="3" id="fieldset1">
+    <legend id="legend1" tabindex="0">legend1</legend>
+</fieldset>
+<select id="select1">
+    <optgroup label="group1" tabindex="2" id="optgroup1">
+        <option tabindex="0" id="option1a">option1</option>
+        <option>option2</option>
+    </optgroup>
+    <optgroup label="group2">
+        <option>option3</option>
+        <option tabindex="-1" id="option1b">option4</option>
+    </optgroup>
+</select><br>
+<textarea id="textarea1">textarea1</textarea><br>
+<input type="text" id="text1" value="text1" tabindex="1"><br>
+<isindex id="isindex1" prompt="isindex1" tabindex="0"/><br>
+<input type="checkbox" id="checkbox1"><br>
+<input type="radio" id="radioChoice1a" name="radio1" tabindex="0"><br>
+<label id="label1" tabindex="-1"><input type="radio" name="radio1">label for radioChoice B</label><br>
+<input type="file" id="file1" tabindex="2"><br>
+input type="hidden"<input type="hidden" id="hidden1" tabindex="-1"><br>
+input type="image"<input type="image" id="inputImage1" src="abe.png" tabindex="3"><br>
+<button id="button1" tabindex="0">button1</button><br>
+<input type="button" id="inputButton1" value="inputButton1" tabindex="-1"><br>
+<input type="search" id="search1" placeholder="search1"><br>
+<input type="password" id="password1" tabindex="-1"><br>
+<input type="range" id="range1" tabindex="3"><br>
+<input type="submit" id="submit1" tabindex="0">
+<input type="reset" id="reset1" tabindex="-1"><br>
+</form>
+</div>
+
+<iframe width="100%" height="75%" src="tabindex-focus-blur-all-iframe1.html" id="iframe1a" tabindex="-1"></iframe>
+<iframe src="data:text/html,hello from iframe1b" id="iframe1b"></iframe>
+
+</body>
diff --git a/LayoutTests/fast/events/resources/tabindex-focus-blur-all-frame2.html b/LayoutTests/fast/events/resources/tabindex-focus-blur-all-frame2.html
new file mode 100644 (file)
index 0000000..67faadc
--- /dev/null
@@ -0,0 +1,176 @@
+<body id="frame2body">
+
+<!--anchor types-->
+<a href="#" tabindex="1" id="a3">anchor</a><br>
+<img src ="abe.png" width="76" height="103" alt="honest abe" usemap ="#theMapName" />
+<map name="theMapName" tabindex="0" id="map3">
+  <area shape ="rect" coords ="0,0,76,50" href="#" target ="_blank" alt="rectArea1" tabindex="-1" id="area3a"/>
+  <area shape ="rect" coords ="0,50,76,103" href="#" target ="_blank" alt="rectArea3" id="area3b"/>
+</map><br>
+
+<!--media elements-->
+<div id="div3a" tabindex="1">
+<audio controls src="../../../media/content/test.wav" tabindex="0" id="audio3"></audio><br>
+<video controls tabindex="-1" id="video3">
+    <source src="../../../media/content/test.mp4" type="video/mpeg" id="source3">
+</video><br>
+</div>
+
+<!--embedded elements-->
+applet:<br>
+<applet width="100" height="100" code="" tabindex="2" id="applet3"></applet><br>
+object:<br>
+<object type="application/x-webkit-test-netscape" width="100" height="100" tabindex="0" id="object3"></object><br>
+embed:<br>
+<embed type="application/x-webkit-test-netscape" width="100" height="100" tabindex="-1" id="embed3"></embed><br>
+
+<!--presentation-related elements-->
+<div id="div3b">
+<abbr title="the tooltip" tabindex="3" id="abbr3">abbr makes a tooltip</abbr><br>
+<acronym title="the tooltip" tabindex="0" id="acronym3">acronym makes a tooltip</acronym><br>
+<bdo dir="rtl" tabindex="-1" id="bdo3">text going right-to-left</bdo><br>
+a blockquote:<blockquote id="blockquote3">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis eu nisi. Fusce aliquet massa non felis. Sed consectetuer. In hac habitasse platea dictumst. Nunc vitae nulla. Quisque tristique sollicitudin libero.</blockquote>
+a short quote:<q tabindex="3" id="q3">Veni, Vidi, Vici</q>
+<p tabindex="0" id="p3">paragraph</p>
+line break:<br tabindex="-1" id="br3">
+horizontal rule:<hr id="hr3">
+<marquee tabindex="2" id="marquee3">marquee text</marquee>
+<center tabindex="0" id="center3">centered text</center>
+</div>
+
+<!--font style tags-->
+<b tabindex="-1" id="b3">Bold text</b><br>
+<big id="big3">Big text</big><br>
+<i tabindex="2" id="i3">Italic text</i><br>
+<small tabindex="0" id="small3">Small text</small><br>
+<tt tabindex="-1" id="tt3">Teletype text</tt><br>
+
+<!--canvas element-->
+<div id="div3c">
+canvas:<br>
+<canvas width='200' height='100' tabindex="3" id="canvas3"></canvas><br>
+</div>
+
+<!--Phrase elements-->
+<em tabindex="0" id="em3">em</em><br>
+<strong tabindex="-1" id="strong3">strong</strong><br>
+<dfn id="dfn3">dfn</dfn><br>
+<code tabindex="2" id="code3">code</code><br>
+<samp tabindex="0" id="samp3">samp</samp><br>
+<kbd tabindex="-1" id="kbd3">kbd</kbd><br>
+<var id="var3">var</var><br>
+<cite tabindex="3" id="cite3">cite</cite><br>
+
+<!--heading tags-->
+<div id="div3d" tabindex="0">
+<h1 tabindex="-1" id="h1_3">Heading 1</h1>
+<h2 id="h2_3">Heading 2</h2>
+<h3 tabindex="3" id="h3_3">Heading 3</h3>
+<h4 tabindex="0" id="h4_3">Heading 4</h4>
+<h5 tabindex="-1" id="h5_3">Heading 5</h5>
+<h6 id="h6_3">Heading 6</h6>
+</div>
+
+<!--other style-related tags-->
+<s tabindex="2" id="s3">strikethrough (sTag)</s><br>
+<strike tabindex="0" id="strike3">strikethrough (strikeTag)</strike><br>
+<sub tabindex="-1" id="sub3">subscript</sub><br>
+<sup id="sup3">superscript</sup><br>
+<u tabindex="3" id="u3">underlined</u><br>
+<del tabindex="0" id="del3">delete</del><br>
+<ins tabindex="-1" id="ins3">insert</ins><br>
+<pre id="pre3">preformatted</pre>
+basic usage of <font tabindex="2" id="font3">font</font> tag<br>
+basic usage of <span tabindex="0" id="span3">span</span> tag<br>
+
+<!--tables-->
+<div id="div3e" tabindex="2">
+<table border="1" id="table3">
+<caption tabindex="3" id="caption3">table caption</caption>
+<colgroup span="3" tabindex="0" id="colgroup3">
+<col width="100" tabindex="-1" id="col3a"></col>
+<col width="250" id="col3b"></col>
+</colgroup>
+<thead tabindex="3" id="thead3"><tr><th tabindex="0" id="th3">
+table header
+</th></tr></thead><tbody tabindex="-1" id="tbody3">
+<tr id="tr3">
+<td tabindex="2" id="td3a">table cell 1</td>
+<td tabindex="0" id="td3b">table cell 2</td>
+<td tabindex="-1" id="td3c">table cell 3</td>
+</tr></tbody>
+<tfoot id="tfoot3"><tr><td>
+table footer
+</td></tr></tfoot>
+</table>
+</div>
+
+<!--definition list-->
+<dl tabindex="1" id="dl3">definition list
+<dt tabindex="0" id="dt3a">term1</dt>
+<dd tabindex="-1" id="dd3a">definition1</dd>
+<dt id="dt3b">term2</dt>
+<dd tabindex="1" id="dd3b">definition2</dd>
+</dl>
+    
+<!--lists -->
+<div id="div3f" tabindex="0">
+<ul tabindex="-1" id="ul3">unordered list
+<li id="li3a"> ul li
+</ul>
+<ol tabindex="2" id="ol3">ordered list
+<li tabindex="0" id="li3b"> ol li
+</ol>
+<menu tabindex="-1" id="menu3">menu list
+<li id="li3c"> menu li
+</menu>
+<dir tabindex="3" id="dir3">directory list
+<li tabindex="0" id="li3d"> dir li
+</dir>
+</div>
+
+<!--images-->
+<image src="abe.png" tabindex="-1" id="image3"><br>
+<img src="abe.png" id="img3"><br>
+
+<!--forms-->
+<div id="div3g" tabindex="3">
+<form tabindex="0" id="form3">
+<fieldset tabindex="-1" id="fieldset3">
+    <legend id="legend3">legend1</legend>
+</fieldset>
+<select id="select3" tabindex="0">
+    <optgroup label="group1" tabindex="-1" id="optgroup3">
+        <option id="option3a">option1</option>
+        <option>option2</option>
+    </optgroup>
+    <optgroup label="group3">
+        <option>option3</option>
+        <option tabindex="1" id="option3b">option4</option>
+    </optgroup>
+</select><br>
+<textarea id="textarea3" tabindex="0">textarea</textarea><br>
+<input type="text" id="text3" value="text" tabindex="-1"><br>
+<isindex id="isindex3" prompt="isindex"/><br>
+<input type="checkbox" id="checkbox3" tabindex="0"><br>
+<input type="radio" id="radioChoice3a" name="radio3"><br>
+<label id="label3" tabindex="2"><input type="radio" name="radio3" tabindex="0">label for radio button</label><br>
+<input type="file" id="file3" tabindex="-1"><br>
+input type="hidden"<input type="hidden" id="hidden3" tabindex="3"><br>
+input type="image"<input type="image" id="inputImage3" src="abe.png" tabindex="-1"><br>
+<button id="button3">button</button><br>
+<input type="button" id="inputButton3" value="inputButton" tabindex="3"><br>
+<input type="search" id="search3" placeholder="search" tabindex="0"><br>
+<input type="password" id="password3" tabindex="2"><br>
+<input type="range" id="range3" tabindex="-1"><br>
+<input type="submit" id="submit3">
+<input type="reset" id="reset3" tabindex="2"><br>
+</form>
+</div>
+
+<iframe width="100%" height="75%" src="tabindex-focus-blur-all-iframe2.html" id="iframe2a" tabindex="0"></iframe>
+<iframe src="data:text/html,hello from iframe2b" id="iframe2b" tabindex="1"></iframe>
+
+<input class="homebase">
+
+</body>
diff --git a/LayoutTests/fast/events/resources/tabindex-focus-blur-all-iframe1.html b/LayoutTests/fast/events/resources/tabindex-focus-blur-all-iframe1.html
new file mode 100644 (file)
index 0000000..507bd88
--- /dev/null
@@ -0,0 +1,171 @@
+<body id="iframe1body" tabindex="-1">
+
+<!--anchor types-->
+<a href="#" id="a2">anchor</a><br>
+<img src ="abe.png" width="76" height="103" alt="honest abe" usemap ="#theMapName" />
+<map name="theMapName" tabindex="2" id="map2">
+  <area shape ="rect" coords ="0,0,76,50" href="#" target ="_blank" alt="rectArea1" tabindex="0" id="area2a"/>
+  <area shape ="rect" coords ="0,50,76,103" href="#" target ="_blank" alt="rectArea2" tabindex="-1" id="area2b"/>
+</map><br>
+
+<!--media elements-->
+<div id="div2a">
+<audio controls src="../../../media/content/test.wav" tabindex="3" id="audio2"></audio><br>
+<video controls tabindex="0" id="video2">
+    <source src="../../../media/content/test.mp4" type="video/mpeg" id="source2">
+</video><br>
+</div>
+
+<!--embedded elements-->
+applet:<br>
+<applet width="100" height="100" code="" id="applet2"></applet><br>
+object:<br>
+<object type="application/x-webkit-test-netscape" width="100" height="100" tabindex="3" id="object2"></object><br>
+embed:<br>
+<embed type="application/x-webkit-test-netscape" width="100" height="100" tabindex="0" id="embed2"></embed><br>
+
+<!--presentation-related elements-->
+<div id="div2b" tabindex="-1">
+<abbr title="the tooltip" id="abbr2">abbr makes a tooltip</abbr><br>
+<acronym title="the tooltip" tabindex="2" id="acronym2">acronym makes a tooltip</acronym><br>
+<bdo dir="rtl" tabindex="0" id="bdo2">text going right-to-left</bdo><br>
+a blockquote:<blockquote tabindex="-1" id="blockquote2">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis eu nisi. Fusce aliquet massa non felis. Sed consectetuer. In hac habitasse platea dictumst. Nunc vitae nulla. Quisque tristique sollicitudin libero.</blockquote>
+a short quote:<q id="q2">Veni, Vidi, Vici</q>
+<p tabindex="3" id="p2">paragraph</p>
+line break:<br tabindex="0" id="br2">
+horizontal rule:<hr tabindex="-1" id="hr2">
+<marquee id="marquee2">marquee text</marquee>
+<center tabindex="3" id="center2">centered text</center>
+</div>
+
+<!--font style tags-->
+<b tabindex="0" id="b2">Bold text</b><br>
+<big tabindex="-1" id="big2">Big text</big><br>
+<i id="i2">Italic text</i><br>
+<small tabindex="2" id="small2">Small text</small><br>
+<tt tabindex="0" id="tt2">Teletype text</tt><br>
+
+<!--canvas element-->
+<div id="div2c" tabindex="-1">
+canvas:<br>
+<canvas width='200' height='100' id="canvas2"></canvas><br>
+</div>
+
+<!--Phrase elements-->
+<em tabindex="2" id="em2">em</em><br>
+<strong tabindex="0" id="strong2">strong</strong><br>
+<dfn tabindex="-1" id="dfn2">dfn</dfn><br>
+<code id="code2">code</code><br>
+<samp tabindex="1" id="samp2">samp</samp><br>
+<kbd tabindex="0" id="kbd2">kbd</kbd><br>
+<var tabindex="-1" id="var2">var</var><br>
+<cite id="cite2">cite</cite><br>
+
+<!--heading tags-->
+<div id="div2d" tabindex="2">
+<h1 tabindex="0" id="h1_2">Heading 1</h1>
+<h2 tabindex="-1" id="h2_2">Heading 2</h2>
+<h3 id="h3_2">Heading 3</h3>
+<h4 tabindex="3" id="h4_2">Heading 4</h4>
+<h5 tabindex="0" id="h5_2">Heading 5</h5>
+<h6 tabindex="-1" id="h6_2">Heading 6</h6>
+</div>
+
+<!--other style-related tags-->
+<s id="s2">strikethrough (sTag)</s><br>
+<strike tabindex="3" id="strike2">strikethrough (strikeTag)</strike><br>
+<sub tabindex="0" id="sub2">subscript</sub><br>
+<sup tabindex="-1" id="sup2">superscript</sup><br>
+<u id="u2">underlined</u><br>
+<del tabindex="2" id="del2">delete</del><br>
+<ins tabindex="0" id="ins2">insert</ins><br>
+<pre tabindex="-1" id="pre2">preformatted</pre>
+basic usage of <font id="font2">font</font> tag<br>
+basic usage of <span tabindex="2" id="span2">span</span> tag<br>
+
+<!--tables-->
+<div id="div2e" tabindex="0">
+<table border="1" tabindex="-1" id="table2">
+<caption id="caption2">table caption</caption>
+<colgroup span="2" tabindex="2" id="colgroup2">
+<col width="100" tabindex="0" id="col2a"></col>
+<col width="250" tabindex="-1" id="col2b"></col>
+</colgroup>
+<thead id="thead2"><tr><th tabindex="2" id="th2">
+table header
+</th></tr></thead><tbody tabindex="0" id="tbody2">
+<tr tabindex="-1" id="tr2">
+<td id="td2a">table cell 1</td>
+<td tabindex="3" id="td2b">table cell 2</td>
+<td tabindex="0" id="td2c">table cell 3</td>
+</tr></tbody>
+<tfoot tabindex="-1" id="tfoot2"><tr><td>
+table footer
+</td></tr></tfoot>
+</table>
+</div>
+
+<!--definition list-->
+<dl id="dl2">definition list
+<dt tabindex="3" id="dt2a">term1</dt>
+<dd tabindex="0" id="dd2a">definition1</dd>
+<dt tabindex="-1" id="dt2b">term2</dt>
+<dd id="dd2b">definition2</dd>
+</dl>
+    
+<!--lists -->
+<div id="div2f" tabindex="2">
+<ul tabindex="0" id="ul2">unordered list
+<li tabindex="-1" id="li2a"> ul li
+</ul>
+<ol id="ol2">ordered list
+<li tabindex="3" id="li2b"> ol li
+</ol>
+<menu tabindex="0" id="menu2">menu list
+<li tabindex="-1" id="li2c"> menu li
+</menu>
+<dir id="dir2">directory list
+<li tabindex="3" id="li2d"> dir li
+</dir>
+</div>
+
+<!--images-->
+<image src="abe.png" tabindex="0" id="image2"><br>
+<img src="abe.png" tabindex="-1" id="img2"><br>
+
+<!--forms-->
+<div id="div2g">
+<form tabindex="2" id="form2">
+<fieldset tabindex="0" id="fieldset2">
+    <legend id="legend2" tabindex="-1">legend</legend>
+</fieldset>
+<select id="select2" tabindex="3">
+    <optgroup label="group1" tabindex="0" id="optgroup2">
+        <option tabindex="-1" id="option2a">option1</option>
+        <option>option2</option>
+    </optgroup>
+    <optgroup label="group2">
+        <option>option3</option>
+        <option id="option2b">option4</option>
+    </optgroup>
+</select><br>
+<textarea id="textarea2" tabindex="3">textarea</textarea><br>
+<input type="text" id="text2" value="text" tabindex="0"><br>
+<isindex id="isindex2" prompt="isindex" tabindex="-1"/><br>
+<input type="checkbox" id="checkbox2" tabindex="2"><br>
+<input type="radio" id="radioChoice2a" name="radio2" tabindex="-1"><br>
+<label id="label2"><input type="radio" name="radio2" tabindex="2">label for radio button</label><br>
+<input type="file" id="file2" tabindex="0"><br>
+input type="hidden"<input type="hidden" id="hidden2"><br>
+input type="image"<input type="image" id="inputImage2" src="abe.png" tabindex="0"><br>
+<button id="button2" tabindex="-1">button</button><br>
+<input type="button" id="inputButton2" value="inputButton"><br>
+<input type="search" id="search2" placeholder="search" tabindex="2"><br>
+<input type="password" id="password2"><br>
+<input type="range" id="range2" tabindex="0"><br>
+<input type="submit" id="submit2" tabindex="-1">
+<input type="reset" id="reset2"><br>
+</form>
+</div>
+
+</body>
diff --git a/LayoutTests/fast/events/resources/tabindex-focus-blur-all-iframe2.html b/LayoutTests/fast/events/resources/tabindex-focus-blur-all-iframe2.html
new file mode 100644 (file)
index 0000000..ae38e9b
--- /dev/null
@@ -0,0 +1,172 @@
+<body id="iframe2body" tabindex="1" onblur="parent.parent.stopTest=true;">
+
+<!--anchor types-->
+<a href="#" tabindex="0" id="a4">anchor</a><br>
+<img src ="abe.png" width="76" height="103" alt="honest abe" usemap ="#theMapName" />
+<map name="theMapName" tabindex="-1" id="map4">
+  <area shape ="rect" coords ="0,0,76,50" href="#" target ="_blank" alt="rectArea1" id="area4a"/>
+  <area shape ="rect" coords ="0,50,76,103" href="#" target ="_blank" alt="rectArea2" tabindex="1" id="area4b"/>
+</map><br>
+
+<!--media elements-->
+<div id="div4a" tabindex="0">
+<audio controls src="../../../media/content/test.wav" tabindex="-1" id="audio4"></audio><br>
+<video controls id="video4">
+    <source src="../../../media/content/test.mp4" type="video/mpeg" id="source4">
+</video><br>
+</div>
+
+<!--embedded elements-->
+applet:<br>
+<applet width="100" height="100" code="" tabindex="0" id="applet4"></applet><br>
+object:<br>
+<object type="application/x-webkit-test-netscape" width="100" height="100" tabindex="-1" id="object4"></object><br>
+embed:<br>
+<embed type="application/x-webkit-test-netscape" width="100" height="100" id="embed4"></embed><br>
+
+<!--presentation-related elements-->
+<div id="div4b" tabindex="3">
+<abbr title="the tooltip" tabindex="0" id="abbr4">abbr makes a tooltip</abbr><br>
+<acronym title="the tooltip" tabindex="-1" id="acronym4">acronym makes a tooltip</acronym><br>
+<bdo dir="rtl" id="bdo4">text going right-to-left</bdo><br>
+a blockquote:<blockquote tabindex="3" id="blockquote4">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis eu nisi. Fusce aliquet massa non felis. Sed consectetuer. In hac habitasse platea dictumst. Nunc vitae nulla. Quisque tristique sollicitudin libero.</blockquote>
+a short quote:<q tabindex="0" id="q4">Veni, Vidi, Vici</q>
+<p tabindex="-1" id="p4">paragraph</p>
+line break:<br id="br4">
+horizontal rule:<hr tabindex="2" id="hr4">
+<marquee tabindex="0" id="marquee4">marquee text</marquee>
+<center tabindex="-1" id="center4">centered text</center>
+</div>
+
+<!--font style tags-->
+<b id="b4">Bold text</b><br>
+<big tabindex="1" id="big4">Big text</big><br>
+<i tabindex="0" id="i4">Italic text</i><br>
+<small tabindex="-1" id="small4">Small text</small><br>
+<tt id="tt4">Teletype text</tt><br>
+
+<!--canvas element-->
+<div id="div4c" tabindex="1">
+canvas:<br>
+<canvas width='200' height='100' tabindex="0" id="canvas4"></canvas><br>
+</div>
+
+<!--Phrase elements-->
+<em tabindex="-1" id="em4">em</em><br>
+<strong id="strong4">strong</strong><br>
+<dfn tabindex="2" id="dfn4">dfn</dfn><br>
+<code tabindex="0" id="code4">code</code><br>
+<samp tabindex="-1" id="samp4">samp</samp><br>
+<kbd id="kbd4">kbd</kbd><br>
+<var tabindex="3" id="var4">var</var><br>
+<cite tabindex="0" id="cite4">cite</cite><br>
+
+<!--heading tags-->
+<div id="div4d" tabindex="-1">
+<h1 id="h1_4">Heading 1</h1>
+<h2 tabindex="3" id="h2_4">Heading 2</h2>
+<h3 tabindex="0" id="h3_4">Heading 3</h3>
+<h4 tabindex="-1" id="h4_4">Heading 4</h4>
+<h5 id="h5_4">Heading 5</h5>
+<h6 tabindex="2" id="h6_4">Heading 6</h6>
+</div>
+
+<!--other style-related tags-->
+<s tabindex="0" id="s4">strikethrough (sTag)</s><br>
+<strike tabindex="-1" id="strike4">strikethrough (strikeTag)</strike><br>
+<sub id="sub4">subscript</sub><br>
+<sup tabindex="1" id="sup4">superscript</sup><br>
+<u tabindex="0" id="u4">underlined</u><br>
+<del tabindex="-1" id="del4">delete</del><br>
+<ins id="inst4">insert</ins><br>
+<pre tabindex="1" id="pre4">preformatted</pre>
+basic usage of <font tabindex="0" id="font4">font</font> tag<br>
+basic usage of <span tabindex="-1" id="span4">span</span> tag<br>
+
+<!--tables-->
+<div id="div4e">
+<table border="1" tabindex="2" id="table4">
+<caption tabindex="0" id="caption4">table caption</caption>
+<colgroup span="2" tabindex="-1" id="colgroup4">
+<col width="100" id="col4a"></col>
+<col width="250" tabindex="3" id="col4b"></col>
+</colgroup>
+<thead tabindex="0" id="thead4"><tr><th tabindex="-1" id="th4">
+table header
+</th></tr></thead><tbody id="tbody4">
+<tr tabindex="3" id="tr4a">
+<td tabindex="0" id="td4a">table cell 1</td>
+<td tabindex="-1" id="tr4b">table cell 2</td>
+<td id="td4b">table cell 3</td>
+</tr></tbody>
+<tfoot tabindex="2" id="tfoot4"><tr><td>
+table footer
+</td></tr></tfoot>
+</table>
+</div>
+
+<!--definition list-->
+<dl tabindex="0" id="dl4">definition list
+<dt tabindex="-1" id="dt4a">term1</dt>
+<dd id="dd4a">definition1</dd>
+<dt tabindex="1" id="dt4b">term2</dt>
+<dd tabindex="0" id="dd4b">definition2</dd>
+</dl>
+    
+<!--lists -->
+<div id="div4f" tabindex="-1">
+<ul id="ul4">unordered list
+<li tabindex="1" id="li4a"> ul li
+</ul>
+<ol tabindex="0" id="ol4">ordered list
+<li tabindex="-1" id="li4b"> ol li
+</ol>
+<menu id="menu4">menu list
+<li tabindex="2" id="li4c"> menu li
+</menu>
+<dir tabindex="0" id="dir4">directory list
+<li tabindex="-1" id="li4d"> dir li
+</dir>
+</div>
+
+<!--images-->
+<image src="abe.png" id="image4"><br>
+<img src="abe.png" tabindex="3" id="img4"><br>
+
+<!--forms-->
+<div id="div4g" tabindex="0">
+<form tabindex="-1" id="form4">
+<fieldset id="fieldset4">
+    <legend id="legend4" tabindex="3">legend4</legend>
+</fieldset>
+<select id="select4" tabindex="-1">
+    <optgroup label="group1" id="optgroup4">
+        <option tabindex="2" id="option4a">option1</option>
+        <option>option2</option>
+    </optgroup>
+    <optgroup label="group2">
+        <option>option3</option>
+        <option tabindex="0" id="option4b">option4</option>
+    </optgroup>
+</select><br>
+<textarea id="textarea4" tabindex="-1">textarea1</textarea><br>
+<input type="text" id="text4" value="text"><br>
+<isindex id="isindex4" prompt="isindex" tabindex="1"/><br>
+<input type="checkbox" id="checkbox4" tabindex="-1"><br>
+<input type="radio" id="radioChoice4a" name="radio4" tabindex="-1"><br>
+<label id="label4" tabindex="0"><input type="radio" name="radio4">label for radio button</label><br>
+
+<input type="file" id="file4" tabindex="1"><br>
+input type="hidden"<input type="hidden" id="hidden4" tabindex="0"><br>
+input type="image"<input type="image" id="inputImage4" src="abe.png" tabindex="-1"><br>
+<button id="button4" tabindex="1">button</button><br>
+<input type="button" id="inputButton4" value="inputButton" tabindex="0"><br>
+<input type="search" id="search4" placeholder="search" tabindex="-1"><br>
+<input type="password" id="password4" tabindex="0"><br>
+<input type="range" id="range4" tabindex="-1"><br>
+<input type="submit" id="submit4" tabindex="1">
+<input type="reset" id="reset4" tabindex="0"><br>
+</form>
+</div>
+
+</body>
diff --git a/LayoutTests/fast/events/resources/tabindex-focus-blur-all.js b/LayoutTests/fast/events/resources/tabindex-focus-blur-all.js
new file mode 100644 (file)
index 0000000..c2d1f25
--- /dev/null
@@ -0,0 +1,125 @@
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+var consoleOutput = null;
+var stopTest = false;
+var focusCount = 0;
+var blurCount = 0;
+var focusedElem = null;
+var failedTestCount = 0;
+
+var tagNamesAlwaysFocused = ["A",
+                             "BUTTON",
+                             "IFRAME",
+                             "INPUT",
+                             "ISINDEX",
+                             "SELECT",
+                             "TEXTAREA"];
+
+var tagNamesTransferFocused = ["LABEL"]; // lables always transfer focus to the labeled element
+
+function printToConsole(str)
+{
+    if (!consoleOutput) {
+        consoleOutput = window.frames[2].document.getElementById("theConsole");
+    }
+    consoleOutput.innerHTML += "<br>" + str;
+}
+
+function doFocus(elem)
+{
+    focusCount++;
+    focusedElem = elem;
+}
+
+function doBlur(elem)
+{
+    blurCount++;
+}
+
+function test()
+{
+    for (var i = 0; i < 2; ++i)
+        focusEachChild(window.frames[i].document.body);
+
+    // focus an untested element so that blur can be dispatched on the last iframe tested
+    var homeBase = window.frames[1].document.getElementsByClassName('homebase');
+    homeBase[0].focus();
+
+    var resultSummary = focusCount+" focus / "+blurCount+" blur events disatched, and should be 335 / 335 ";
+    resultSummary += (focusCount==blurCount) ? "<span style='color:green'>PASSED</span><br>" : "<span style='color:red'>FAILED</span><br>";
+    resultSummary += "Total of "+failedTestCount+" focus test(s) failed.";
+    if (failedTestCount)
+        resultSummary += "<br>Details:<br>"+consoleOutput.innerHTML;
+    else
+        resultSummary += " <span style='color:green'>PASSED</span>";
+    
+    document.write(resultSummary);
+    document.close();
+
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.notifyDone();
+    }
+}
+
+function focusEachChild(elem) {
+    var childNodes = elem.childNodes;
+    for (var i = 0; i < childNodes.length; i++) {
+        if (childNodes[i].nodeType == Node.ELEMENT_NODE && childNodes[i].id) {
+            childNodes[i].addEventListener('focus',function () { doFocus(this) }, false);
+            childNodes[i].addEventListener('blur',function () { doBlur(this) }, false);
+            testProgrammaticFocus(childNodes[i]);
+        }
+        if (childNodes[i].childNodes.length)
+            focusEachChild(childNodes[i]);
+        if (childNodes[i].tagName =="IFRAME") {
+            if (childNodes[i].id == "iframe1b") {
+                window.frames[0].document.body.focus();
+            }
+            focusEachChild(childNodes[i].contentDocument.body);
+        }
+    }       
+}
+
+Array.prototype.find = function(element) {
+    for (var i = 0; i < this.length; i++) {
+        if(this[i] == element) {
+            return this[i];
+        }
+    }
+    return null;
+}
+
+function testProgrammaticFocus(elem)
+{
+    var elemThatShouldFocus = null;
+    var OKtoFocusOtherElement = false;
+    focusedElem = null;
+
+    if (elem.tabIndex == elem.getAttribute("tabindex")) // this means tabindex was explicitly set
+        elemThatShouldFocus = elem;
+    else if (tagNamesAlwaysFocused.find(elem.tagName)) // special case form elements and other controls that are always focusable
+        elemThatShouldFocus = elem;
+    
+    if (elem.tagName == "INPUT" && elem.type == "hidden") // obviously since <input type=hidden> isn't rendered, it can't be focused
+        elemThatShouldFocus = null;
+    if (tagNamesTransferFocused.find(elem.tagName)) {
+        elemThatShouldFocus = null;
+        OKtoFocusOtherElement = true;
+    }
+
+    elem.focus();
+    if (elemThatShouldFocus == focusedElem || (!elemThatShouldFocus && OKtoFocusOtherElement))
+        printToConsole("&lt;"+elem.tagName+"&gt; "+elem.id+" <span style='color:green'>passed</span> focus test");
+    else {
+        failedTestCount++;
+        printToConsole(elem.id+" <span style='color:red'>failed</span> - was " + (focusedElem ? "" : " not ") + " focused but focus " + (elemThatShouldFocus ? " was " : " wasn\'t") + " expected");
+        if (elemThatShouldFocus && focusedElem)
+            printToConsole("elemThatShouldFocus is &lt;"+elemThatShouldFocus.tagName+"&gt; "+elemThatShouldFocus.id+", focusedElem is &lt;"+focusedElem.tagName+"&gt; "+focusedElem.id);
+        if (!elemThatShouldFocus)
+            printToConsole("elemThatShouldFocus is null, focusedElem is &lt;"+focusedElem.tagName+"&gt; "+focusedElem.id);
+        if (!focusedElem)
+            printToConsole("elemThatShouldFocus is &lt;"+elemThatShouldFocus.tagName+"&gt; "+elemThatShouldFocus.id+", focusedElem is null");
+    }
+}
diff --git a/LayoutTests/fast/events/tabindex-focus-blur-all-expected.txt b/LayoutTests/fast/events/tabindex-focus-blur-all-expected.txt
new file mode 100644 (file)
index 0000000..d827983
--- /dev/null
@@ -0,0 +1,2 @@
+335 focus / 335 blur events disatched, and should be 335 / 335 PASSED
+Total of 0 focus test(s) failed. PASSED
diff --git a/LayoutTests/fast/events/tabindex-focus-blur-all.html b/LayoutTests/fast/events/tabindex-focus-blur-all.html
new file mode 100644 (file)
index 0000000..ea99506
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+<script src="resources/tabindex-focus-blur-all.js"></script>
+
+<frameset cols="33%, 33%, *" onload="test()">
+<frame src="resources/tabindex-focus-blur-all-frame1.html"/>
+<frame src="resources/tabindex-focus-blur-all-frame2.html"/>
+<frame src="data:text/html,<div id='theConsole'></div>"/>
+</frameset>
+</html>
index 7a7953d..dbed758 100644 (file)
@@ -1,3 +1,101 @@
+2008-04-28  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Darin.
+
+        Fix <rdar://problem/4911289> Add tabindex property to all children 
+        of HTMLElement (7138)
+        http://bugs.webkit.org/show_bug.cgi?id=7138
+
+        Test: fast/events/tabindex-focus-blur-all.html
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/objc/DOMPrivate.h:
+        -DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h are no
+         longer needed
+
+        * bindings/objc/PublicDOMInterfaces.h:
+        -Moving focus, blur, tabindex to HTMLElement from its descendants.
+
+        * dom/Node.cpp:
+        (WebCore::Node::Node):
+        (WebCore::Node::isFocusable):
+        (WebCore::Node::isKeyboardFocusable):
+        -The concept of being focusable now needs to account for tabindex
+        attribute.
+
+        * dom/Node.h:
+        -Need to use a bit to keep track of whether tabindex was explicitly set
+         to 0 or was just initialized to 0.
+        (WebCore::Node::tabIndex):
+        -Make this virtual so that Anchors and GenericFormElements can determine
+         tabindex without accounting for focusability
+        (WebCore::Node::setTabIndexExplicitly):
+        -Renamed setTabIndex() to setTabIndexExplicitly() so as not to hide
+         behind and/or be confused for HTMLElement::setTabIndex
+
+        * html/HTMLAnchorElement.cpp:
+        * html/HTMLAnchorElement.h:
+        (WebCore::HTMLAnchorElement::tabIndex):
+        * html/HTMLGenericFormElement.cpp:
+        * html/HTMLGenericFormElement.h:
+        (WebCore::HTMLGenericFormElement::tabIndex):
+        -Anchors and form elements are normally focusable, and need to avert the
+         check for focusability in HTMLElement::tabIndex
+         because tabIndex could be queried before a first layout happens.
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseMappedAttribute):
+        -Function Node::setTabIndex changed to Node::setTabIndexExplicitly
+        (WebCore::HTMLElement::isFocusable):
+        -The concept of being focusable now needs to account for tabindex
+         attribute.
+        (WebCore::HTMLElement::tabIndex):
+        -HTML5 specifies that querying tabindex for elements that aren't
+         focusable shall return -1
+        (WebCore::HTMLElement::setTabIndex):
+        -New default implementation
+        * html/HTMLElement.h:
+
+        * html/HTMLLegendElement.cpp:
+        (WebCore::HTMLLegendElement::focus):
+        -Now with HTML5's enhanced specification of tabindex, legend elements
+         themselves shall focus (if they should), and not the first form element 
+         they encapsulate.  This matches Firefox behavior.  HTMLLabelElements
+         still forward focus to the encapsulated element.  This also matches
+         other browsers. 
+
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::isFocusable):
+        * html/HTMLAreaElement.h:
+        -HTMLAreaElement isn't subject to the same focusability requirements as
+         its parent, HTMLAnchorElement. Default HTMLElement implementation is
+         desired.  
+
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::HTMLFieldSetElement::isFocusable):
+        * html/HTMLLegendElement.cpp:
+        (WebCore::HTMLLegendElement::isFocusable):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::isFocusable):
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::isFocusable):
+        -These elements aren't subject to the same focusability requirements as
+         their parent, HTMLGenericFormElement. Default HTMLElement 
+         implementation is desired.  
+
+        * html/HTMLAnchorElement.idl:
+        * html/HTMLAreaElement.idl:
+        * html/HTMLButtonElement.idl:
+        * html/HTMLElement.idl:
+        * html/HTMLInputElement.idl:
+        * html/HTMLLabelElement.idl:
+        * html/HTMLLegendElement.idl:
+        * html/HTMLObjectElement.idl:
+        * html/HTMLSelectElement.idl:
+        * html/HTMLTextAreaElement.idl:
+        -Moving tabindex attribute, focus and blur methods from descendants of
+         HTMLElement to HTMLElement
+
 2008-04-28  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Dave Hyatt.
index 78279b1..05b90c9 100644 (file)
                1CFCEE960AACC40100348750 /* DOMHTMLBodyElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE8D0AACC3CD00348750 /* DOMHTMLBodyElementPrivate.h */; };
                1CFCEE970AACC40100348750 /* DOMHTMLButtonElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE8E0AACC3CD00348750 /* DOMHTMLButtonElementPrivate.h */; };
                1CFCEE980AACC40100348750 /* DOMHTMLImageElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE8F0AACC3CD00348750 /* DOMHTMLImageElementPrivate.h */; };
-               1CFCEE990AACC40100348750 /* DOMHTMLLabelElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE900AACC3CD00348750 /* DOMHTMLLabelElementPrivate.h */; };
-               1CFCEE9A0AACC40100348750 /* DOMHTMLLegendElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE910AACC3CD00348750 /* DOMHTMLLegendElementPrivate.h */; };
                1CFCEE9B0AACC40100348750 /* DOMHTMLLinkElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE920AACC3CD00348750 /* DOMHTMLLinkElementPrivate.h */; };
                1CFCEE9D0AACC40100348750 /* DOMHTMLStyleElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE940AACC3CD00348750 /* DOMHTMLStyleElementPrivate.h */; };
                1CFCEE9E0AACC40100348750 /* DOMHTMLTextAreaElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE950AACC3CD00348750 /* DOMHTMLTextAreaElementPrivate.h */; };
                                8575DF820AA612D600F5DBB5 /* DOMHTMLIsIndexElement.h in Copy Generated Headers */,
                                85BA4D2B0AA6889F0088052D /* DOMHTMLLIElement.h in Copy Generated Headers */,
                                85BA4CE70AA686510088052D /* DOMHTMLLabelElement.h in Copy Generated Headers */,
-                               1CFCEE990AACC40100348750 /* DOMHTMLLabelElementPrivate.h in Copy Generated Headers */,
                                85BA4CE80AA686510088052D /* DOMHTMLLegendElement.h in Copy Generated Headers */,
-                               1CFCEE9A0AACC40100348750 /* DOMHTMLLegendElementPrivate.h in Copy Generated Headers */,
                                8575DF860AA6130E00F5DBB5 /* DOMHTMLLinkElement.h in Copy Generated Headers */,
                                1CFCEE9B0AACC40100348750 /* DOMHTMLLinkElementPrivate.h in Copy Generated Headers */,
                                85ECBF0C0AA7628900544F0B /* DOMHTMLMapElement.h in Copy Generated Headers */,
                1CFCEE8D0AACC3CD00348750 /* DOMHTMLBodyElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLBodyElementPrivate.h; sourceTree = "<group>"; };
                1CFCEE8E0AACC3CD00348750 /* DOMHTMLButtonElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLButtonElementPrivate.h; sourceTree = "<group>"; };
                1CFCEE8F0AACC3CD00348750 /* DOMHTMLImageElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLImageElementPrivate.h; sourceTree = "<group>"; };
-               1CFCEE900AACC3CD00348750 /* DOMHTMLLabelElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLLabelElementPrivate.h; sourceTree = "<group>"; };
-               1CFCEE910AACC3CD00348750 /* DOMHTMLLegendElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLLegendElementPrivate.h; sourceTree = "<group>"; };
                1CFCEE920AACC3CD00348750 /* DOMHTMLLinkElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLLinkElementPrivate.h; sourceTree = "<group>"; };
                1CFCEE940AACC3CD00348750 /* DOMHTMLStyleElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLStyleElementPrivate.h; sourceTree = "<group>"; };
                1CFCEE950AACC3CD00348750 /* DOMHTMLTextAreaElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLTextAreaElementPrivate.h; sourceTree = "<group>"; };
                                859A9C420AA5E3BD00B694B2 /* DOMHTMLIsIndexElement.mm */,
                                85BA4CD90AA6861B0088052D /* DOMHTMLLabelElement.h */,
                                85BA4CDA0AA6861B0088052D /* DOMHTMLLabelElement.mm */,
-                               1CFCEE900AACC3CD00348750 /* DOMHTMLLabelElementPrivate.h */,
                                85BA4CDB0AA6861B0088052D /* DOMHTMLLegendElement.h */,
                                85BA4CDC0AA6861B0088052D /* DOMHTMLLegendElement.mm */,
-                               1CFCEE910AACC3CD00348750 /* DOMHTMLLegendElementPrivate.h */,
                                85BA4D030AA688680088052D /* DOMHTMLLIElement.h */,
                                85BA4D040AA688680088052D /* DOMHTMLLIElement.mm */,
                                85992EB60AA5069500AC0785 /* DOMHTMLLinkElement.h */,
index 1322560..8dd752e 100644 (file)
@@ -47,8 +47,6 @@
 #import <WebCore/DOMHTMLFrameElementPrivate.h>
 #import <WebCore/DOMHTMLImageElementPrivate.h>
 #import <WebCore/DOMHTMLInputElementPrivate.h>
-#import <WebCore/DOMHTMLLabelElementPrivate.h>
-#import <WebCore/DOMHTMLLegendElementPrivate.h>
 #import <WebCore/DOMHTMLLinkElementPrivate.h>
 #import <WebCore/DOMHTMLOptionsCollectionPrivate.h>
 #import <WebCore/DOMHTMLPreElementPrivate.h>
index 00591f6..3547b95 100644 (file)
 - (BOOL)hasAttribute:(NSString *)name;
 - (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
 - (BOOL)hasAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName;
-- (void)focus;
-- (void)blur;
 - (void)scrollIntoView:(BOOL)alignWithTop;
 - (void)scrollIntoViewIfNeeded:(BOOL)centerIfNeeded;
 @end
 @property(copy) NSString *rel;
 @property(copy) NSString *rev;
 @property(copy) NSString *shape;
-@property int tabIndex;
 @property(copy) NSString *target;
 @property(copy) NSString *type;
 @property(readonly, copy) NSURL *absoluteLinkURL;
-- (void)blur;
-- (void)focus;
 @end
 
 @interface DOMHTMLAppletElement : DOMHTMLElement
 @property(copy) NSString *href;
 @property BOOL noHref;
 @property(copy) NSString *shape;
-@property int tabIndex;
 @property(copy) NSString *target;
 @property(readonly, copy) NSURL *absoluteLinkURL;
 @end
 @property(copy) NSString *accessKey;
 @property BOOL disabled;
 @property(copy) NSString *name;
-@property int tabIndex;
 @property(readonly, copy) NSString *type;
 @property(copy) NSString *value;
 @end
 @property(copy) NSString *contentEditable;
 @property(readonly) BOOL isContentEditable;
 @property(readonly, copy) NSString *titleDisplayString;
+@property int tabIndex;
+- (void)blur;
+- (void)focus;
 @end
 
 @interface DOMHTMLEmbedElement : DOMHTMLElement
 @property BOOL readOnly;
 @property(copy) NSString *size;
 @property(copy) NSString *src;
-@property int tabIndex;
 @property(copy) NSString *type;
 @property(copy) NSString *useMap;
 @property(copy) NSString *value;
 @property(readonly, copy) NSString *altDisplayString;
 @property(readonly, copy) NSURL *absoluteImageURL;
-- (void)blur;
-- (void)focus;
 - (void)select;
 - (void)click;
 @end
 @property int hspace;
 @property(copy) NSString *name;
 @property(copy) NSString *standby;
-@property int tabIndex;
 @property(copy) NSString *type;
 @property(copy) NSString *useMap;
 @property int vspace;
 @property BOOL multiple;
 @property(copy) NSString *name;
 @property int size;
-@property int tabIndex;
 - (void)add:(DOMHTMLElement *)element :(DOMHTMLElement *)before;
 - (void)add:(DOMHTMLElement *)element before:(DOMHTMLElement *)before;
 - (void)remove:(int)index;
-- (void)blur;
-- (void)focus;
 @end
 
 @interface DOMHTMLStyleElement : DOMHTMLElement
 @property(copy) NSString *name;
 @property BOOL readOnly;
 @property int rows;
-@property int tabIndex;
 @property(readonly, copy) NSString *type;
 @property(copy) NSString *value;
-- (void)blur;
-- (void)focus;
 - (void)select;
 @end
 
index 9e8c76d..268c956 100644 (file)
@@ -41,7 +41,6 @@
 #include "ExceptionCode.h"
 #include "Frame.h"
 #include "HTMLNames.h"
-#include "HTMLNames.h"
 #include "Logging.h"
 #include "NameNodeList.h"
 #include "NamedAttrMap.h"
@@ -137,7 +136,8 @@ Node::Node(Document *doc)
       m_hovered(false),
       m_inActiveChain(false),
       m_inDetach(false),
-      m_inSubtreeMark(false)
+      m_inSubtreeMark(false),
+      m_tabIndexSetExplicitly(false)
 {
 #ifndef NDEBUG
     if (shouldIgnoreLeaks)
@@ -389,12 +389,12 @@ void Node::setChanged(StyleChangeType changeType)
 
 bool Node::isFocusable() const
 {
-    return false;
+    return m_tabIndexSetExplicitly;
 }
 
 bool Node::isKeyboardFocusable(KeyboardEvent*) const
 {
-    return isFocusable();
+    return isFocusable() && m_tabIndex >= 0;
 }
 
 bool Node::isMouseFocusable() const
index fbf69f4..32119d6 100644 (file)
@@ -251,8 +251,7 @@ public:
     virtual void setActive(bool b = true, bool pause=false) { m_active = b; }
     virtual void setHovered(bool b = true) { m_hovered = b; }
 
-    short tabIndex() const { return m_tabIndex; }
-    void setTabIndex(short i) { m_tabIndex = i; }
+    virtual short tabIndex() const { return m_tabIndex; }
 
     /**
      * Whether this node can receive the keyboard focus.
@@ -469,17 +468,21 @@ private: // members
     Node* m_previous;
     Node* m_next;
     RenderObject* m_renderer;
+    short m_tabIndex;
 
 protected:
     virtual void willMoveToNewOwnerDocument() { }
     virtual void didMoveToNewOwnerDocument() { }
     
     virtual void getSubresourceAttributeStrings(Vector<String>&) const { }
+    void setTabIndexExplicitly(short i)
+    { 
+        m_tabIndex = i; 
+        m_tabIndexSetExplicitly = true;
+    }
 
     OwnPtr<NodeListsNodeData> m_nodeLists;
 
-    short m_tabIndex;
-
     // make sure we don't use more than 16 bits here -- adding more would increase the size of all Nodes
 
     bool m_hasId : 1;
@@ -500,9 +503,11 @@ protected:
 
 public:
     bool m_inSubtreeMark : 1;
-    // 1 bit left
 
 private:
+    bool m_tabIndexSetExplicitly : 1;
+    // no bits left
+
     Element* ancestorElement() const;
 
     virtual Node* virtualFirstChild() const;
index a767cc0..ac3659e 100644 (file)
@@ -391,6 +391,11 @@ void HTMLAnchorElement::setShape(const String &value)
     setAttribute(shapeAttr, value);
 }
 
+short HTMLAnchorElement::tabIndex() const
+{
+    return Element::tabIndex();
+}
+    
 void HTMLAnchorElement::setTabIndex(int tabIndex)
 {
     setAttribute(tabindexAttr, String::number(tabIndex));
index 9edcb6a..e1fb664 100644 (file)
@@ -76,6 +76,7 @@ public:
     String shape() const;
     void setShape(const String&);
 
+    short tabIndex() const;
     void setTabIndex(int);
 
     virtual String target() const;
index c7789ab..f3a15ee 100644 (file)
@@ -34,13 +34,9 @@ module html {
         attribute [ConvertNullToNullString] DOMString rel;
         attribute [ConvertNullToNullString] DOMString rev;
         attribute [ConvertNullToNullString] DOMString shape;
-        attribute long tabIndex;
         attribute [ConvertNullToNullString] DOMString target;
         attribute [ConvertNullToNullString] DOMString type;
 
-        void blur();
-        void focus();
-
         // IE Extensions
         readonly attribute DOMString hash;
         readonly attribute DOMString host;
index 8eec391..962c78c 100644 (file)
@@ -213,6 +213,11 @@ void HTMLAreaElement::setTabIndex(int tabIndex)
     setAttribute(tabindexAttr, String::number(tabIndex));
 }
 
+bool HTMLAreaElement::isFocusable() const
+{
+    return HTMLElement::isFocusable();
+}
+
 String HTMLAreaElement::target() const
 {
     return getAttribute(targetAttr);
index ff5aa55..1fa93e9 100644 (file)
@@ -66,6 +66,7 @@ public:
     void setShape(const String&);
 
     void setTabIndex(int);
+    bool isFocusable() const;
 
     virtual String target() const;
     void setTarget(const String&);
index 7effb98..39cc719 100644 (file)
@@ -31,7 +31,6 @@ module html {
         attribute [ConvertNullToNullString] DOMString href;
         attribute boolean noHref;
         attribute [ConvertNullToNullString] DOMString shape;
-        attribute long tabIndex;
         attribute [ConvertNullToNullString] DOMString target;
 
         // IE Extensions
index be39119..d6f8b87 100644 (file)
@@ -29,7 +29,6 @@ module html {
                  attribute  [ConvertNullToNullString] DOMString            accessKey;
                  attribute  boolean              disabled;
                  attribute  [ConvertNullToNullString] DOMString            name;
-                 attribute  long                 tabIndex;
         readonly attribute  DOMString            type;
                  attribute  [ConvertNullToNullString] DOMString            value;
 
index 2166dc7..b30a146 100644 (file)
@@ -145,7 +145,7 @@ void HTMLElement::parseMappedAttribute(MappedAttribute *attr)
         indexstring = getAttribute(tabindexAttr);
         if (indexstring.length())
             // Clamp tabindex to the range of 'short' to match Firefox's behavior.
-            setTabIndex(max(static_cast<int>(std::numeric_limits<short>::min()), min(indexstring.toInt(), static_cast<int>(std::numeric_limits<short>::max()))));
+            setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(indexstring.toInt(), static_cast<int>(std::numeric_limits<short>::max()))));
     } else if (attr->name() == langAttr) {
         // FIXME: Implement
     } else if (attr->name() == dirAttr) {
@@ -525,7 +525,7 @@ void HTMLElement::addHTMLAlignment(MappedAttribute* attr)
 
 bool HTMLElement::isFocusable() const
 {
-    return isContentEditable() && parent() && !parent()->isContentEditable();
+    return Element::isFocusable() || (isContentEditable() && parent() && !parent()->isContentEditable());
 }
 
 bool HTMLElement::isContentEditable() const 
@@ -703,6 +703,18 @@ void HTMLElement::setClassName(const String &value)
     setAttribute(classAttr, value);
 }
 
+short HTMLElement::tabIndex() const
+{
+    if (supportsFocus())
+        return Element::tabIndex();
+    return -1;
+}
+
+void HTMLElement::setTabIndex(int value)
+{
+    setAttribute(tabindexAttr, String::number(value));
+}
+
 PassRefPtr<HTMLCollection> HTMLElement::children()
 {
     return new HTMLCollection(this, HTMLCollection::NodeChildren);
index 729dd91..29f7b5d 100644 (file)
@@ -59,6 +59,8 @@ public:
     void setDir(const String&);
     String className() const;
     void setClassName(const String&);
+    short tabIndex() const;
+    void setTabIndex(int);
 
     String innerHTML() const;
     String outerHTML() const;
index 819b610..5d7cd16 100644 (file)
@@ -35,6 +35,10 @@ module html {
                  attribute [ConvertNullToNullString] DOMString dir;
                  attribute [ConvertNullToNullString] DOMString className;
 
+                 attribute long            tabIndex;
+                 void                      blur();
+                 void                      focus();
+
         // Extensions
                  attribute [ConvertNullToNullString] DOMString innerHTML
                      setter raises(DOMException);
index 00ae7fa..5d640a7 100644 (file)
@@ -50,7 +50,7 @@ bool HTMLFieldSetElement::checkDTD(const Node* newChild)
 
 bool HTMLFieldSetElement::isFocusable() const
 {
-    return false;
+    return HTMLElement::isFocusable();
 }
 
 const AtomicString& HTMLFieldSetElement::type() const
index c40599c..6002d3c 100644 (file)
@@ -205,6 +205,11 @@ void HTMLGenericFormElement::setTabIndex(int value)
 {
     setAttribute(tabindexAttr, String::number(value));
 }
+
+short HTMLGenericFormElement::tabIndex() const
+{
+    return Element::tabIndex();
+}
     
 bool HTMLGenericFormElement::supportsFocus() const
 {
index 7126235..a696808 100644 (file)
@@ -89,6 +89,7 @@ public:
     virtual void setActivatedSubmit(bool flag) { }
 
     void setTabIndex(int);
+    short tabIndex() const;
 
     void formDestroyed() { m_form = 0; }
 
index 29522be..d6fac68 100644 (file)
@@ -45,13 +45,10 @@ module html {
                  attribute unsigned long   size; // Changed string -> long as part of DOM level 2
 #endif
                  attribute [ConvertNullToNullString] DOMString src;
-                 attribute long            tabIndex;
                  attribute [ConvertNullToNullString] DOMString type; // readonly dropped as part of DOM level 2
                  attribute [ConvertNullToNullString] DOMString useMap;
                  attribute [ConvertNullToNullString] DOMString value;
         
-        void               blur();
-        void               focus();
         void               select();
         void               click();
         
index c40aad9..85b7ef3 100644 (file)
@@ -28,8 +28,6 @@ module html {
         readonly attribute HTMLFormElement form;
         attribute [ConvertNullToNullString] DOMString accessKey;
         attribute [ConvertNullToNullString] DOMString htmlFor;
-
-        void focus();
     };
 
 }
index 7f47861..20e2183 100644 (file)
@@ -45,7 +45,7 @@ HTMLLegendElement::~HTMLLegendElement()
 
 bool HTMLLegendElement::isFocusable() const
 {
-    return false;
+    return HTMLElement::isFocusable();
 }
 
 RenderObject* HTMLLegendElement::createRenderer(RenderArena* arena, RenderStyle* style)
@@ -107,6 +107,9 @@ Element *HTMLLegendElement::formElement()
 
 void HTMLLegendElement::focus(bool)
 {
+    if (isFocusable())
+        Element::focus();
+        
     // to match other browsers, never restore previous selection
     if (Element *element = formElement())
         element->focus(false);
index 8a78d77..da00cc1 100644 (file)
@@ -28,8 +28,6 @@ module html {
         readonly attribute HTMLFormElement form;
         attribute [ConvertNullToNullString] DOMString accessKey;
         attribute [ConvertNullToNullString] DOMString align;
-
-        void focus();
     };
 
 }
index a6fe7ac..c225238 100644 (file)
@@ -42,7 +42,6 @@ module html {
                  attribute long            hspace;
                  attribute [ConvertNullToNullString] DOMString       name;
                  attribute [ConvertNullToNullString] DOMString       standby;
-                 attribute long            tabIndex;
                  attribute [ConvertNullToNullString] DOMString       type;
                  attribute [ConvertNullToNullString] DOMString       useMap;
                  attribute long            vspace;
index 831e572..3d84099 100644 (file)
@@ -43,7 +43,7 @@ HTMLOptGroupElement::HTMLOptGroupElement(Document* doc, HTMLFormElement* f)
 
 bool HTMLOptGroupElement::isFocusable() const
 {
-    return false;
+    return HTMLElement::isFocusable();
 }
 
 const AtomicString& HTMLOptGroupElement::type() const
index e3944a8..251ad40 100644 (file)
@@ -75,7 +75,7 @@ void HTMLOptionElement::detach()
 
 bool HTMLOptionElement::isFocusable() const
 {
-    return false;
+    return HTMLElement::isFocusable();
 }
 
 const AtomicString& HTMLOptionElement::type() const
index e154ace..3fdeecd 100644 (file)
@@ -49,7 +49,6 @@ module html {
                  attribute boolean         multiple;
                  attribute [ConvertNullToNullString] DOMString       name;
                  attribute long            size;
-                 attribute long            tabIndex;
         
         [OldStyleObjC] void add(in HTMLElement element, 
                                in HTMLElement before)
@@ -61,8 +60,6 @@ module html {
 #else
         void               remove(in long index);
 #endif
-        void               blur();
-        void               focus();
 
         // These methods are not in DOM Level 2 IDL, but are mentioned in the standard:
         // "The contained options can be directly accessed through the select element as a collection."
index 40c3feb..a32f84a 100644 (file)
@@ -33,12 +33,9 @@ module html {
                  attribute  [ConvertNullToNullString] DOMString            name;
                  attribute  boolean              readOnly;
                  attribute  long                 rows;
-                 attribute  long                 tabIndex;
         readonly attribute  DOMString            type;
                  attribute  [ConvertNullToNullString] DOMString            value;
         
-        void     blur();
-        void     focus();
         void     select();
 
        // WinIE & FireFox extension:
index 9d0e54f..a45c1d4 100644 (file)
@@ -1,3 +1,16 @@
+2008-04-28  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Darin.
+
+        Fix <rdar://problem/4911289> Add tabindex property to all children 
+        of HTMLElement (7138)
+        http://bugs.webkit.org/show_bug.cgi?id=7138
+
+        * MigrateHeaders.make:
+        Removing DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h
+        because now that focus() has been moved to DOMHTMLElement.h, these
+        files are no longer needed.
+
 2008-04-25  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 378d5ce..bbdebc6 100644 (file)
@@ -124,9 +124,7 @@ all : \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLIsIndexElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLLIElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLLabelElement.h \
-    $(PRIVATE_HEADERS_DIR)/DOMHTMLLabelElementPrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLLegendElement.h \
-    $(PRIVATE_HEADERS_DIR)/DOMHTMLLegendElementPrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLLinkElement.h \
     $(PRIVATE_HEADERS_DIR)/DOMHTMLLinkElementPrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLMapElement.h \