Title: [236795] trunk
Revision
236795
Author
[email protected]
Date
2018-10-03 09:02:34 -0700 (Wed, 03 Oct 2018)

Log Message

input.checked is incorrect while we're parsing its children
https://bugs.webkit.org/show_bug.cgi?id=190227

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/html/semantics/forms/the-input-element/checked-expected.txt:

Source/WebCore:

input.checked was incorrect while we're parsing its children because we were delaying updating the
checked state until HTMLInputElement::finishParsingChildren() is called, to avoid a bad interaction
with form state restoration.

In this patch, we update the checked state as soon as the 'checked' attribute is set, when we know
that no form state to restore.

fast/forms/radio/state-restore-radio-group.html covers the form restoration case and is still
passing.

No new tests, rebaselined existing test.

* html/FormController.cpp:
(WebCore::FormController::hasFormStateToRestore const):
* html/FormController.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (236794 => 236795)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-10-03 15:47:51 UTC (rev 236794)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-10-03 16:02:34 UTC (rev 236795)
@@ -1,3 +1,14 @@
+2018-10-03  Chris Dumez  <[email protected]>
+
+        input.checked is incorrect while we're parsing its children
+        https://bugs.webkit.org/show_bug.cgi?id=190227
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline WPT test now that it is passing.
+
+        * web-platform-tests/html/semantics/forms/the-input-element/checked-expected.txt:
+
 2018-10-03  Rob Buis  <[email protected]>
 
         Import WPT mimesniff resources

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/checked-expected.txt (236794 => 236795)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/checked-expected.txt	2018-10-03 15:47:51 UTC (rev 236794)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/checked-expected.txt	2018-10-03 16:02:34 UTC (rev 236795)
@@ -1,3 +1,3 @@
 
-FAIL input@checked is immediately reflected to 'checked' IDL attribute assert_true: Examining "checked" IDL attribute value: expected true got false
+PASS input@checked is immediately reflected to 'checked' IDL attribute 
 

Modified: trunk/Source/WebCore/ChangeLog (236794 => 236795)


--- trunk/Source/WebCore/ChangeLog	2018-10-03 15:47:51 UTC (rev 236794)
+++ trunk/Source/WebCore/ChangeLog	2018-10-03 16:02:34 UTC (rev 236795)
@@ -1,3 +1,28 @@
+2018-10-03  Chris Dumez  <[email protected]>
+
+        input.checked is incorrect while we're parsing its children
+        https://bugs.webkit.org/show_bug.cgi?id=190227
+
+        Reviewed by Ryosuke Niwa.
+
+        input.checked was incorrect while we're parsing its children because we were delaying updating the
+        checked state until HTMLInputElement::finishParsingChildren() is called, to avoid a bad interaction
+        with form state restoration.
+
+        In this patch, we update the checked state as soon as the 'checked' attribute is set, when we know
+        that no form state to restore.
+
+        fast/forms/radio/state-restore-radio-group.html covers the form restoration case and is still
+        passing.
+
+        No new tests, rebaselined existing test.
+
+        * html/FormController.cpp:
+        (WebCore::FormController::hasFormStateToRestore const):
+        * html/FormController.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute):
+
 2018-10-03  Miguel Gomez  <[email protected]>
 
         [GTK][WPE] Incorrect rendering of layers whose backingStore hasn't changed

Modified: trunk/Source/WebCore/html/FormController.cpp (236794 => 236795)


--- trunk/Source/WebCore/html/FormController.cpp	2018-10-03 15:47:51 UTC (rev 236794)
+++ trunk/Source/WebCore/html/FormController.cpp	2018-10-03 16:02:34 UTC (rev 236795)
@@ -470,6 +470,11 @@
     }
 }
 
+bool FormController::hasFormStateToRestore() const
+{
+    return !m_savedFormStateMap.isEmpty();
+}
+
 Vector<String> FormController::referencedFilePaths(const Vector<String>& stateVector)
 {
     Vector<String> paths;

Modified: trunk/Source/WebCore/html/FormController.h (236794 => 236795)


--- trunk/Source/WebCore/html/FormController.h	2018-10-03 15:47:51 UTC (rev 236794)
+++ trunk/Source/WebCore/html/FormController.h	2018-10-03 16:02:34 UTC (rev 236795)
@@ -55,6 +55,7 @@
     void willDeleteForm(HTMLFormElement&);
     void restoreControlStateFor(HTMLFormControlElementWithState&);
     void restoreControlStateIn(HTMLFormElement&);
+    bool hasFormStateToRestore() const;
 
     WEBCORE_EXPORT static Vector<String> referencedFilePaths(const Vector<String>& stateVector);
 

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (236794 => 236795)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2018-10-03 15:47:51 UTC (rev 236794)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2018-10-03 16:02:34 UTC (rev 236795)
@@ -744,10 +744,8 @@
         // restore. We shouldn't call setChecked() even if this has the checked
         // attribute. So, delay the setChecked() call until
         // finishParsingChildren() is called if parsing is in progress.
-        if (!m_parsingInProgress && m_reflectsCheckedAttribute) {
+        if ((!m_parsingInProgress || !document().formController().hasFormStateToRestore()) && m_reflectsCheckedAttribute)
             setChecked(!value.isNull());
-            m_reflectsCheckedAttribute = true;
-        }
     } else if (name == maxlengthAttr)
         maxLengthAttributeChanged(value);
     else if (name == minlengthAttr)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to