Title: [119023] trunk
Revision
119023
Author
[email protected]
Date
2012-05-30 19:24:22 -0700 (Wed, 30 May 2012)

Log Message

Form controls in <fieldset disabled> should not be focusable.
https://bugs.webkit.org/show_bug.cgi?id=87380

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/forms/fieldset/focus-in-fieldset-disabled.html

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::supportsFocus):
Refer to disabled() instead of m_disabled to take account of wrapping
fieldset elements.

LayoutTests:

* fast/forms/fieldset/fieldset-disabled-expected.txt:
* fast/forms/fieldset/fieldset-disabled.html:
Updated because disabled controls are not focusable.
Also, remove testing elements to remove unnecessary blank lines.
* fast/forms/fieldset/focus-in-fieldset-disabled-expected.txt: Added.
* fast/forms/fieldset/focus-in-fieldset-disabled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119022 => 119023)


--- trunk/LayoutTests/ChangeLog	2012-05-31 02:17:42 UTC (rev 119022)
+++ trunk/LayoutTests/ChangeLog	2012-05-31 02:24:22 UTC (rev 119023)
@@ -1,3 +1,17 @@
+2012-05-30  Kent Tamura  <[email protected]>
+
+        Form controls in <fieldset disabled> should not be focusable.
+        https://bugs.webkit.org/show_bug.cgi?id=87380
+
+        Reviewed by Darin Adler.
+
+        * fast/forms/fieldset/fieldset-disabled-expected.txt:
+        * fast/forms/fieldset/fieldset-disabled.html:
+        Updated because disabled controls are not focusable.
+        Also, remove testing elements to remove unnecessary blank lines.
+        * fast/forms/fieldset/focus-in-fieldset-disabled-expected.txt: Added.
+        * fast/forms/fieldset/focus-in-fieldset-disabled.html: Added.
+
 2012-05-30  Hayato Ito  <[email protected]>
 
         Fix a composed-shadow-tree-walker.html so that it uses correct selectors.

Modified: trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-expected.txt (119022 => 119023)


--- trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-expected.txt	2012-05-31 02:17:42 UTC (rev 119022)
+++ trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-expected.txt	2012-05-31 02:24:22 UTC (rev 119023)
@@ -9,7 +9,7 @@
 PASS parserGeneratedInput2.value is "M"
 PASS parserGeneratedInput3.value is "NO"
 PASS parserGeneratedInput4.value is ""
-PASS parserGeneratedInput5.value is "P"
+PASS parserGeneratedInput5.value is "PQRST"
 PASS parserGeneratedInput6.value is ""
 PASS parserGeneratedInput7.value is ""
 PASS parserGeneratedInput8.value is ""
@@ -56,52 +56,39 @@
 PASS innerTextInput.value is "F"
 Disabling the inner fieldset only.
 PASS innerFieldSet.disabled is true
-PASS outerTextInput.value is "FG"
+PASS outerTextInput.value is "FGG"
 PASS innerTextInput.value is "F"
 Enabling the inner and disabling the outer fieldset.
 PASS outerFieldSet.disabled is true
 PASS innerFieldSet.disabled is false
-PASS outerTextInput.value is "FG"
+PASS outerTextInput.value is "FGG"
 PASS innerTextInput.value is "F"
 Disabling both fieldset elements.
 PASS outerFieldSet.disabled is true
 PASS innerFieldSet.disabled is true
-PASS outerTextInput.value is "FG"
+PASS outerTextInput.value is "FGG"
 PASS innerTextInput.value is "F"
 Enabling both fieldset elements.
 PASS outerFieldSet.disabled is false
 PASS innerFieldSet.disabled is false
-PASS outerTextInput.value is "FGH"
+PASS outerTextInput.value is "FGGH"
 PASS innerTextInput.value is "FH"
 
 Test behavior of the first legend element in a fieldset elements.
 Children of the first legend element in a fieldset should not get disabled with the fieldset.
 PASS legendFieldSet.disabled is true
-PASS firstLegendTextInput.value is "I"
+PASS firstLegendTextInput.value is "II"
 PASS secondLegendTextInput.value is ""
 Insert another legend element before the currently first one, and check again.
-PASS insertedLegendTextInput.value is "J"
-PASS firstLegendTextInput.value is "I"
+PASS insertedLegendTextInput.value is "JJJ"
+PASS firstLegendTextInput.value is "II"
 PASS secondLegendTextInput.value is ""
 Enable the fieldset again and check for sanity.
 PASS legendFieldSet.disabled is false
-PASS insertedLegendTextInput.value is "JK"
-PASS firstLegendTextInput.value is "IK"
+PASS insertedLegendTextInput.value is "JJJK"
+PASS firstLegendTextInput.value is "IIK"
 PASS secondLegendTextInput.value is "K"
 PASS successfullyParsed is true
 
 TEST COMPLETE
 
-
- 
-
-
- 
-
-
-
-
-
-
-
-

Modified: trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled.html (119022 => 119023)


--- trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled.html	2012-05-31 02:17:42 UTC (rev 119022)
+++ trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled.html	2012-05-31 02:24:22 UTC (rev 119023)
@@ -70,7 +70,7 @@
 shouldBe('parserGeneratedInput2.value', '"M"');
 shouldBe('parserGeneratedInput3.value', '"NO"');
 shouldBe('parserGeneratedInput4.value', '""');
-shouldBe('parserGeneratedInput5.value', '"P"');
+shouldBe('parserGeneratedInput5.value', '"PQRST"');
 shouldBe('parserGeneratedInput6.value', '""');
 shouldBe('parserGeneratedInput7.value', '""');
 shouldBe('parserGeneratedInput8.value', '""');
@@ -197,7 +197,7 @@
 document.execCommand('insertText', false, 'G');
 innerTextInput.focus();
 document.execCommand('insertText', false, 'G');
-shouldBe('outerTextInput.value', '"FG"');
+shouldBe('outerTextInput.value', '"FGG"');
 shouldBe('innerTextInput.value', '"F"');
 
 debug('Enabling the inner and disabling the outer fieldset.');
@@ -209,7 +209,7 @@
 document.execCommand('insertText', false, 'H');
 innerTextInput.focus();
 document.execCommand('insertText', false, 'H');
-shouldBe('outerTextInput.value', '"FG"');
+shouldBe('outerTextInput.value', '"FGG"');
 shouldBe('innerTextInput.value', '"F"');
 
 debug('Disabling both fieldset elements.');
@@ -221,7 +221,7 @@
 document.execCommand('insertText', false, 'H');
 innerTextInput.focus();
 document.execCommand('insertText', false, 'H');
-shouldBe('outerTextInput.value', '"FG"');
+shouldBe('outerTextInput.value', '"FGG"');
 shouldBe('innerTextInput.value', '"F"');
 
 debug('Enabling both fieldset elements.');
@@ -233,7 +233,7 @@
 document.execCommand('insertText', false, 'H');
 innerTextInput.focus();
 document.execCommand('insertText', false, 'H');
-shouldBe('outerTextInput.value', '"FGH"');
+shouldBe('outerTextInput.value', '"FGGH"');
 shouldBe('innerTextInput.value', '"FH"');
 
 
@@ -260,7 +260,7 @@
 document.execCommand('insertText', false, 'I');
 secondLegendTextInput.focus()
 document.execCommand('insertText', false, 'I');
-shouldBe('firstLegendTextInput.value', '"I"');
+shouldBe('firstLegendTextInput.value', '"II"');
 shouldBe('secondLegendTextInput.value', '""');
 
 debug('Insert another legend element before the currently first one, and check again.');
@@ -275,8 +275,8 @@
 document.execCommand('insertText', false, 'J');
 secondLegendTextInput.focus()
 document.execCommand('insertText', false, 'J');
-shouldBe('insertedLegendTextInput.value', '"J"');
-shouldBe('firstLegendTextInput.value', '"I"');
+shouldBe('insertedLegendTextInput.value', '"JJJ"');
+shouldBe('firstLegendTextInput.value', '"II"');
 shouldBe('secondLegendTextInput.value', '""');
 
 debug('Enable the fieldset again and check for sanity.');
@@ -288,10 +288,14 @@
 document.execCommand('insertText', false, 'K');
 secondLegendTextInput.focus()
 document.execCommand('insertText', false, 'K');
-shouldBe('insertedLegendTextInput.value', '"JK"');
-shouldBe('firstLegendTextInput.value', '"IK"');
+shouldBe('insertedLegendTextInput.value', '"JJJK"');
+shouldBe('firstLegendTextInput.value', '"IIK"');
 shouldBe('secondLegendTextInput.value', '"K"');
 
+document.body.removeChild(document.getElementsByTagName('form')[0]);
+document.body.removeChild(fieldSet);
+document.body.removeChild(outerFieldSet);
+document.body.removeChild(legendFieldSet);
 var successfullyParsed = true;
 </script>
 <script src=""

Added: trunk/LayoutTests/fast/forms/fieldset/focus-in-fieldset-disabled-expected.txt (0 => 119023)


--- trunk/LayoutTests/fast/forms/fieldset/focus-in-fieldset-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/fieldset/focus-in-fieldset-disabled-expected.txt	2012-05-31 02:24:22 UTC (rev 119023)
@@ -0,0 +1,8 @@
+A form control in a disabled fieldset is not focusable:
+PASS input1.focus(); document.activeElement is document.body
+It becomes focusable if the fieldset is enabled:
+PASS input1.focus(); document.activeElement is input1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/fieldset/focus-in-fieldset-disabled.html (0 => 119023)


--- trunk/LayoutTests/fast/forms/fieldset/focus-in-fieldset-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/fieldset/focus-in-fieldset-disabled.html	2012-05-31 02:24:22 UTC (rev 119023)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<fieldset disabled>
+  <input id=input1>
+</fieldset>
+<script>
+var input1 = document.getElementById('input1');
+debug('A form control in a disabled fieldset is not focusable:');
+shouldBe('input1.focus(); document.activeElement', 'document.body');
+
+debug('It becomes focusable if the fieldset is enabled:');
+document.getElementsByTagName('fieldset')[0].disabled = false;
+shouldBe('input1.focus(); document.activeElement', 'input1');
+</script>
+<script src=""
+</body>
+

Modified: trunk/Source/WebCore/ChangeLog (119022 => 119023)


--- trunk/Source/WebCore/ChangeLog	2012-05-31 02:17:42 UTC (rev 119022)
+++ trunk/Source/WebCore/ChangeLog	2012-05-31 02:24:22 UTC (rev 119023)
@@ -1,3 +1,17 @@
+2012-05-30  Kent Tamura  <[email protected]>
+
+        Form controls in <fieldset disabled> should not be focusable.
+        https://bugs.webkit.org/show_bug.cgi?id=87380
+
+        Reviewed by Darin Adler.
+
+        Test: fast/forms/fieldset/focus-in-fieldset-disabled.html
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::supportsFocus):
+        Refer to disabled() instead of m_disabled to take account of wrapping
+        fieldset elements.
+
 2012-05-30  Robin Dunn  <[email protected]>
 
         [wx] Implement HTML clipboard support.

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (119022 => 119023)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2012-05-31 02:17:42 UTC (rev 119022)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2012-05-31 02:24:22 UTC (rev 119023)
@@ -318,7 +318,7 @@
 
 bool HTMLFormControlElement::supportsFocus() const
 {
-    return !m_disabled;
+    return !disabled();
 }
 
 bool HTMLFormControlElement::isFocusable() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to