Title: [164407] trunk
- Revision
- 164407
- Author
- [email protected]
- Date
- 2014-02-19 18:08:30 -0800 (Wed, 19 Feb 2014)
Log Message
fieldset:disabled fieldset > legend:first-child input should be disabled
https://bugs.webkit.org/show_bug.cgi?id=129077
Reviewed by Antti Koivisto.
Source/WebCore:
Similar to r164403. When a fieldset inside a disabled fieldset, input elements inside
the inner fieldset's first legend element child should be disabled.
Test: fast/forms/fieldset/fieldset-disabled-2.html
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::legend): Fixed the bug where it was returning the first
legend element descendent. It should be the first legend element _child_.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::updateAncestorDisabledState): Fixed the algorithm
to look for any ancestor fieldset that has been disabled instead of the first fieldset
ancestor and checking its disabledness.
LayoutTests:
Added a test case.o
* fast/forms/fieldset/fieldset-disabled-2-expected.txt:
* fast/forms/fieldset/fieldset-disabled-2.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (164406 => 164407)
--- trunk/LayoutTests/ChangeLog 2014-02-20 02:03:40 UTC (rev 164406)
+++ trunk/LayoutTests/ChangeLog 2014-02-20 02:08:30 UTC (rev 164407)
@@ -1,5 +1,17 @@
2014-02-19 Ryosuke Niwa <[email protected]>
+ fieldset:disabled fieldset > legend:first-child input should be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=129077
+
+ Reviewed by Antti Koivisto.
+
+ Added a test case.o
+
+ * fast/forms/fieldset/fieldset-disabled-2-expected.txt:
+ * fast/forms/fieldset/fieldset-disabled-2.html:
+
+2014-02-19 Ryosuke Niwa <[email protected]>
+
fieldset:disabled > legend:first-child legend input should not be disabled
https://bugs.webkit.org/show_bug.cgi?id=129068
Modified: trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-2-expected.txt (164406 => 164407)
--- trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-2-expected.txt 2014-02-20 02:03:40 UTC (rev 164406)
+++ trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-2-expected.txt 2014-02-20 02:08:30 UTC (rev 164407)
@@ -7,12 +7,14 @@
PASS isInputDisabledById("inputInsideFirstLegend") is false
PASS isInputDisabledById("inputInsideSecondLegend") is true
PASS isInputDisabledById("inputInsideNestedFirstLegend") is false
+PASS isInputDisabledById("inputInsideFirstLegendWithDisabledOuterFieldset") is true
setDisabledOnAllFieldsets(false)
PASS isInputDisabledById("inputOutsideLegend") is false
PASS isInputDisabledById("inputInsideFirstLegend") is false
PASS isInputDisabledById("inputInsideSecondLegend") is false
PASS isInputDisabledById("inputInsideNestedFirstLegend") is false
+PASS isInputDisabledById("inputInsideFirstLegendWithDisabledOuterFieldset") is false
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-2.html (164406 => 164407)
--- trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-2.html 2014-02-20 02:03:40 UTC (rev 164406)
+++ trunk/LayoutTests/fast/forms/fieldset/fieldset-disabled-2.html 2014-02-20 02:08:30 UTC (rev 164407)
@@ -12,6 +12,7 @@
<fieldset disabled><legend><input id="inputInsideFirstLegend"></legend></fieldset>
<fieldset disabled><legend></legend><legend><input id="inputInsideSecondLegend"></legend></fieldset>
<fieldset disabled><legend><legend><input id="inputInsideNestedFirstLegend"></legend></legend></fieldset>
+<fieldset disabled><fieldset><legend><input id="inputInsideFirstLegendWithDisabledOuterFieldset"></legend></fieldset></fieldset>
</div>
<script>
@@ -26,6 +27,7 @@
shouldBeFalse('isInputDisabledById("inputInsideFirstLegend")');
shouldBeTrue('isInputDisabledById("inputInsideSecondLegend")');
shouldBeFalse('isInputDisabledById("inputInsideNestedFirstLegend")');
+shouldBeTrue('isInputDisabledById("inputInsideFirstLegendWithDisabledOuterFieldset")');
function setDisabledOnAllFieldsets(value) {
var fieldsets = document.querySelectorAll('fieldset');
@@ -39,6 +41,7 @@
shouldBeFalse('isInputDisabledById("inputInsideFirstLegend")');
shouldBeFalse('isInputDisabledById("inputInsideSecondLegend")');
shouldBeFalse('isInputDisabledById("inputInsideNestedFirstLegend")');
+shouldBeFalse('isInputDisabledById("inputInsideFirstLegendWithDisabledOuterFieldset")');
document.getElementById('container').style.display = 'none';
Modified: trunk/Source/WebCore/ChangeLog (164406 => 164407)
--- trunk/Source/WebCore/ChangeLog 2014-02-20 02:03:40 UTC (rev 164406)
+++ trunk/Source/WebCore/ChangeLog 2014-02-20 02:08:30 UTC (rev 164407)
@@ -1,5 +1,25 @@
2014-02-19 Ryosuke Niwa <[email protected]>
+ fieldset:disabled fieldset > legend:first-child input should be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=129077
+
+ Reviewed by Antti Koivisto.
+
+ Similar to r164403. When a fieldset inside a disabled fieldset, input elements inside
+ the inner fieldset's first legend element child should be disabled.
+
+ Test: fast/forms/fieldset/fieldset-disabled-2.html
+
+ * html/HTMLFieldSetElement.cpp:
+ (WebCore::HTMLFieldSetElement::legend): Fixed the bug where it was returning the first
+ legend element descendent. It should be the first legend element _child_.
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::HTMLFormControlElement::updateAncestorDisabledState): Fixed the algorithm
+ to look for any ancestor fieldset that has been disabled instead of the first fieldset
+ ancestor and checking its disabledness.
+
+2014-02-19 Ryosuke Niwa <[email protected]>
+
Debug build fix after r164401. Removed a bogus assertion in comparePositions.
When either position is anchored at a detached node, they don't have a tree scope in common.
Modified: trunk/Source/WebCore/html/HTMLFieldSetElement.cpp (164406 => 164407)
--- trunk/Source/WebCore/html/HTMLFieldSetElement.cpp 2014-02-20 02:03:40 UTC (rev 164406)
+++ trunk/Source/WebCore/html/HTMLFieldSetElement.cpp 2014-02-20 02:08:30 UTC (rev 164407)
@@ -88,7 +88,7 @@
HTMLLegendElement* HTMLFieldSetElement::legend() const
{
- return const_cast<HTMLLegendElement*>(descendantsOfType<HTMLLegendElement>(*this).first());
+ return const_cast<HTMLLegendElement*>(childrenOfType<HTMLLegendElement>(*this).first());
}
PassRefPtr<HTMLCollection> HTMLFieldSetElement::elements()
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (164406 => 164407)
--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2014-02-20 02:03:40 UTC (rev 164406)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2014-02-20 02:08:30 UTC (rev 164407)
@@ -103,10 +103,10 @@
{
Element* previousAncestor = nullptr;
for (Element* ancestor = parentElement(); ancestor; ancestor = ancestor->parentElement()) {
- if (isHTMLFieldSetElement(ancestor)) {
+ if (isHTMLFieldSetElement(ancestor) && ancestor->hasAttribute(disabledAttr)) {
HTMLFieldSetElement& fieldSetAncestor = toHTMLFieldSetElement(*ancestor);
bool isInFirstLegend = previousAncestor && isHTMLLegendElement(previousAncestor) && previousAncestor == fieldSetAncestor.legend();
- m_ancestorDisabledState = !fieldSetAncestor.isDisabledFormControl() || isInFirstLegend ? AncestorDisabledStateEnabled : AncestorDisabledStateDisabled;
+ m_ancestorDisabledState = isInFirstLegend ? AncestorDisabledStateEnabled : AncestorDisabledStateDisabled;
return;
}
previousAncestor = ancestor;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes