Title: [125446] branches/safari-536.26-branch

Diff

Modified: branches/safari-536.26-branch/LayoutTests/ChangeLog (125445 => 125446)


--- branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-13 20:48:35 UTC (rev 125445)
+++ branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-13 21:01:15 UTC (rev 125446)
@@ -1,3 +1,17 @@
+2012-08-13  Lucas Forschler  <[email protected]>
+
+    Merge r118721
+
+    2012-05-28  Kent Tamura  <[email protected]>
+
+            Form controls in <fieldset disabled> should not be validated.
+            https://bugs.webkit.org/show_bug.cgi?id=87381
+
+            Reviewed by Hajime Morita.
+
+            * fast/forms/fieldset/validation-in-fieldset-expected.txt: Added.
+            * fast/forms/fieldset/validation-in-fieldset.html: Added.
+
 2012-08-10  Lucas Forschler  <[email protected]>
 
     Merge r125124.
@@ -10110,3 +10124,4 @@
 
         * ChangeLog-2012-04-23: Copied from LayoutTests/ChangeLog.
 
+.

Copied: branches/safari-536.26-branch/LayoutTests/fast/forms/fieldset/validation-in-fieldset-expected.txt (from rev 118721, trunk/LayoutTests/fast/forms/fieldset/validation-in-fieldset-expected.txt) (0 => 125446)


--- branches/safari-536.26-branch/LayoutTests/fast/forms/fieldset/validation-in-fieldset-expected.txt	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/forms/fieldset/validation-in-fieldset-expected.txt	2012-08-13 21:01:15 UTC (rev 125446)
@@ -0,0 +1,12 @@
+A form control in initially disabled fieldset:
+PASS control1.willValidate is false
+Then, enables the fieldset:
+PASS document.getElementById("f1").disabled = false; control1.willValidate is true
+A form control in initially enabled fieldset:
+PASS control2.willValidate is true
+Then, disables fieldset:
+PASS fieldset2.disabled = true; control2.willValidate is false
+Detach the form control from the fieldset:
+PASS fieldset2.removeChild(control2); control2.willValidate is true
+
+

Copied: branches/safari-536.26-branch/LayoutTests/fast/forms/fieldset/validation-in-fieldset.html (from rev 118721, trunk/LayoutTests/fast/forms/fieldset/validation-in-fieldset.html) (0 => 125446)


--- branches/safari-536.26-branch/LayoutTests/fast/forms/fieldset/validation-in-fieldset.html	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/forms/fieldset/validation-in-fieldset.html	2012-08-13 21:01:15 UTC (rev 125446)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+
+<fieldset id="f1" disabled>
+  <input required id="i1">
+</fieldset>
+<fieldset id="f2">
+  <input required id="i2">
+</fieldset>
+
+<script>
+debug('A form control in initially disabled fieldset:');
+var control1 = document.getElementById("i1");
+shouldBeFalse('control1.willValidate');
+debug('Then, enables the fieldset:');
+shouldBeTrue('document.getElementById("f1").disabled = false; control1.willValidate');
+
+debug('A form control in initially enabled fieldset:');
+var control2 = document.getElementById("i2");
+var fieldset2 = document.getElementById("f2");
+shouldBeTrue('control2.willValidate');
+debug('Then, disables fieldset:');
+shouldBeFalse('fieldset2.disabled = true; control2.willValidate');
+debug('Detach the form control from the fieldset:');
+shouldBeTrue('fieldset2.removeChild(control2); control2.willValidate');
+
+</script>
+<script src=""
+</body>

Modified: branches/safari-536.26-branch/Source/WebCore/ChangeLog (125445 => 125446)


--- branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-13 20:48:35 UTC (rev 125445)
+++ branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-13 21:01:15 UTC (rev 125446)
@@ -1,3 +1,41 @@
+2012-08-13  Lucas Forschler  <[email protected]>
+
+    Merge r118721
+
+    2012-05-28  Kent Tamura  <[email protected]>
+
+            Form controls in <fieldset disabled> should not be validated.
+            https://bugs.webkit.org/show_bug.cgi?id=87381
+
+            Reviewed by Hajime Morita.
+
+            We need to use disabeld() instead of m_disabled to calculate
+            willValidate property. Also, we need to update willValidate if
+            necessary.
+
+            Test: fast/forms/fieldset/validation-in-fieldset.html
+
+            * html/HTMLFieldSetElement.cpp:
+            (WebCore::HTMLFieldSetElement::disabledAttributeChanged):
+             - Do not traverse this.
+             - Calls ancestorDisabledStateWasChanged() instead of
+              setNeedsStyleRecalc() because we'd like to do additional tasks.
+            * html/HTMLFormControlElement.cpp:
+            (WebCore::HTMLFormControlElement::ancestorDisabledStateWasChanged):
+            Added. Just calls disabledAttributeChanged().
+            (WebCore::HTMLFormControlElement::parseAttribute):
+            Do not call setNeedsWillValidateCheck() whenever an attribute is updated.
+            It should be called only if disabled or readonly attribute is updated.
+            (WebCore::HTMLFormControlElement::disabledAttributeChanged):
+            Add setNeedsWillValidateCheck(). It was moved from parseAttribute().
+            (WebCore::HTMLFormControlElement::insertedInto):
+            Invalidate ancestor information.
+            (WebCore::HTMLFormControlElement::recalcWillValidate):
+            Use disabled() instead of m_disabled. disabled() takes care of
+            ancestor's disabled state.
+            * html/HTMLFormControlElement.h:
+            (HTMLFormControlElement):
+
 2012-08-10  Lucas Forschler  <[email protected]>
 
     Merge r125124.
@@ -205027,3 +205065,4 @@
         * GNUmakefile.am:
 
 == Rolled over to ChangeLog-2011-10-19 ==
+.

Modified: branches/safari-536.26-branch/Source/WebCore/html/HTMLFieldSetElement.cpp (125445 => 125446)


--- branches/safari-536.26-branch/Source/WebCore/html/HTMLFieldSetElement.cpp	2012-08-13 20:48:35 UTC (rev 125445)
+++ branches/safari-536.26-branch/Source/WebCore/html/HTMLFieldSetElement.cpp	2012-08-13 21:01:15 UTC (rev 125446)
@@ -50,9 +50,9 @@
     // This element must be updated before the style of nodes in its subtree gets recalculated.
     HTMLFormControlElement::disabledAttributeChanged();
 
-    for (Node* currentNode = this; currentNode; currentNode = currentNode->traverseNextNode(this)) {
+    for (Node* currentNode = this->traverseNextNode(this); currentNode; currentNode = currentNode->traverseNextNode(this)) {
         if (currentNode && currentNode->isElementNode() && toElement(currentNode)->isFormControlElement())
-            static_cast<HTMLFormControlElement*>(currentNode)->setNeedsStyleRecalc();
+            static_cast<HTMLFormControlElement*>(currentNode)->ancestorDisabledStateWasChanged();
     }
 }
 

Modified: branches/safari-536.26-branch/Source/WebCore/html/HTMLFormControlElement.cpp (125445 => 125446)


--- branches/safari-536.26-branch/Source/WebCore/html/HTMLFormControlElement.cpp	2012-08-13 20:48:35 UTC (rev 125445)
+++ branches/safari-536.26-branch/Source/WebCore/html/HTMLFormControlElement.cpp	2012-08-13 21:01:15 UTC (rev 125446)
@@ -116,6 +116,11 @@
     m_fieldSetAncestorValid = true;
 }
 
+void HTMLFormControlElement::ancestorDisabledStateWasChanged()
+{
+    disabledAttributeChanged();
+}
+
 void HTMLFormControlElement::parseAttribute(Attribute* attr)
 {
     if (attr->name() == formAttr)
@@ -129,6 +134,7 @@
         bool oldReadOnly = m_readOnly;
         m_readOnly = !attr->isNull();
         if (oldReadOnly != m_readOnly) {
+            setNeedsWillValidateCheck();
             setNeedsStyleRecalc();
             if (renderer() && renderer()->style()->hasAppearance())
                 renderer()->theme()->stateChanged(renderer(), ReadOnlyState);
@@ -140,11 +146,11 @@
             requiredAttributeChanged();
     } else
         HTMLElement::parseAttribute(attr);
-    setNeedsWillValidateCheck();
 }
 
 void HTMLFormControlElement::disabledAttributeChanged()
 {
+    setNeedsWillValidateCheck();
     setNeedsStyleRecalc();
     if (renderer() && renderer()->style()->hasAppearance())
         renderer()->theme()->stateChanged(renderer(), EnabledState);
@@ -224,6 +230,7 @@
 
 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Node* insertionPoint)
 {
+    m_fieldSetAncestorValid = false;
     m_dataListAncestorState = Unknown;
     setNeedsWillValidateCheck();
     HTMLElement::insertedInto(insertionPoint);
@@ -367,7 +374,7 @@
         if (m_dataListAncestorState == Unknown)
             m_dataListAncestorState = NotInsideDataList;
     }
-    return m_dataListAncestorState == NotInsideDataList && !m_disabled && !m_readOnly;
+    return m_dataListAncestorState == NotInsideDataList && !disabled() && !m_readOnly;
 }
 
 bool HTMLFormControlElement::willValidate() const

Modified: branches/safari-536.26-branch/Source/WebCore/html/HTMLFormControlElement.h (125445 => 125446)


--- branches/safari-536.26-branch/Source/WebCore/html/HTMLFormControlElement.h	2012-08-13 20:48:35 UTC (rev 125445)
+++ branches/safari-536.26-branch/Source/WebCore/html/HTMLFormControlElement.h	2012-08-13 21:01:15 UTC (rev 125446)
@@ -52,6 +52,7 @@
     bool formNoValidate() const;
 
     void updateFieldSetAndLegendAncestor() const;
+    void ancestorDisabledStateWasChanged();
 
     virtual void reset() { }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to