Regression(r236795) Check boxes are sometimes checked when they should not be
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 00:27:54 +0000 (00:27 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 00:27:54 +0000 (00:27 +0000)
commitd11e230766d6be9cc674be91dc19435057d9402e
treebfaa0b689c2f86f3ffc0185162f29e239939fb92
parentb3ef1e99f86c199b1ed3ce1e52979f1c8323d28d
Regression(r236795) Check boxes are sometimes checked when they should not be
https://bugs.webkit.org/show_bug.cgi?id=190651
<rdar://problem/45319934>

Reviewed by Ryosuke Niwa.

Source/WebCore:

r236795 mistakenly dropped the statement resetting m_reflectsCheckedAttribute to true
in HTMLInputElement::parseAttribute() because it looked like a no-op given that we
made sure it was true a couple of line above. However, I overlooked that calling
HTMLInputElement::setChecked() sets m_reflectsCheckedAttribute to false.

This patch thus re-introduces the statement. It also renames m_reflectsCheckedAttribute
to m_dirtyCheckednessFlag and reverses its value in order to match the specification
more closely:
- https://html.spec.whatwg.org/#concept-input-checked-dirty-flag

Test: fast/dom/HTMLInputElement/checkbox-dirty-checkedness-flag.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::parseAttribute):
(WebCore::HTMLInputElement::finishParsingChildren):
(WebCore::HTMLInputElement::reset):
(WebCore::HTMLInputElement::setChecked):
(WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
* html/HTMLInputElement.h:

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLInputElement/checkbox-dirty-checkedness-flag-expected.txt: Added.
* fast/dom/HTMLInputElement/checkbox-dirty-checkedness-flag.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLInputElement/checkbox-dirty-checkedness-flag-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLInputElement/checkbox-dirty-checkedness-flag.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h