Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Issue 9805002: Revert 105710 - Introduce RadioButtonGroup class to keep track of the group members and required st… (Closed)

Created:
8 years, 9 months ago by tkent
Modified:
8 years, 9 months ago
Reviewers:
tkent
CC:
chromium-reviews
Base URL:
http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Visibility:
Public.

Description

Revert 105710 - Introduce RadioButtonGroup class to keep track of the group members and required state https://bugs.webkit.org/show_bug.cgi?id=74909 Reviewed by Darin Adler. Source/WebCore: RadioButtonGroup contains a set of member radio buttons in the group, and "required" status of the group. This helps implementing correct radio button validity, and improving performance of updating validity status of radio buttons. This change fixes the following bugs: - A radio button should be "required" if one of a member of the same group has the "required" attribute. https://bugs.webkit.org/show_bug.cgi?id=76365 - :invalid style is not applied when a checked radio button is removed from its radio group https://bugs.webkit.org/show_bug.cgi?id=74914 - Loading a page with N radio buttons in a group takes O(N^2) time. Tests: fast/forms/radio/radio-live-validation-style.html perf/adding-radio-buttons.html * dom/CheckedRadioButtons.cpp: (WebCore::RadioButtonGroup::isEmpty): (WebCore::RadioButtonGroup::isRequired): (WebCore::RadioButtonGroup::checkedButton): (WebCore::RadioButtonGroup::RadioButtonGroup): (WebCore::RadioButtonGroup::create): (WebCore::RadioButtonGroup::isValid): (WebCore::RadioButtonGroup::setCheckedButton): (WebCore::RadioButtonGroup::add): (WebCore::RadioButtonGroup::updateCheckedState): (WebCore::RadioButtonGroup::requiredAttributeChanged): (WebCore::RadioButtonGroup::remove): (WebCore::RadioButtonGroup::setNeedsValidityCheckForAllButtons): Add RadioButtonGroup class. It keeps track of pointers to member radio buttons and required status of the group in addition to the checked radio button pointer. (WebCore::CheckedRadioButtons::CheckedRadioButtons): (WebCore::CheckedRadioButtons::~CheckedRadioButtons): Define empty constructor and destructor in order to avoid exposing RadioButtonGroup class. (WebCore::CheckedRadioButtons::addButton): (WebCore::CheckedRadioButtons::updateCheckedState): (WebCore::CheckedRadioButtons::requiredAttributeChanged): (WebCore::CheckedRadioButtons::checkedButtonForGroup): (WebCore::CheckedRadioButtons::isInRequiredGroup): (WebCore::CheckedRadioButtons::removeButton): Change the HashMap member of this class so that it maps a group name to a RadioButtonGroup object. These functions just get a RadioButtonGroup object and call a corresponding member function of RadioButtonGroup. * dom/CheckedRadioButtons.h: Update declarations. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::parseMappedAttribute): (WebCore::HTMLFormControlElement::requiredAttributeChanged): Move a part of parseMappedAttribute() into requiredAttributeChanged(). * html/HTMLFormControlElement.h: Add requiredAttributeChanged(). * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::valueMissing): Move required check code to InputType::valueMissing implementations. RadioInputType needs special handling for checking required state. readOnly() and disabled() are unnecessary because willValidate() checks them. (WebCore::HTMLInputElement::setChecked): Call new function CheckedRadioButtons::updateCheckedState() instead of removeButton() and updateCheckedRadioButtons(). (WebCore::HTMLInputElement::requiredAttributeChanged): Override this to call CheckedRadioButtons::requiredAttributeChanged(). * html/HTMLInputElement.h: Add requiredAttributeChanged(). * html/RadioInputType.cpp: (WebCore::RadioInputType::valueMissing): Check required state by CheckedRadioButtons::isInRequiredGroup(). * html/RadioInputType.h: Remove attach(). * html/CheckboxInputType.cpp: (WebCore::CheckboxInputType::valueMissing): Move required check from HTMLInputElement::valueMissing(). * html/FileInputType.cpp: (WebCore::FileInputType::valueMissing): ditto. * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::valueMissing): ditto. LayoutTests: * fast/forms/radio/radio-live-validation-style-expected.txt: Added. * fast/forms/radio/radio-live-validation-style.html: Added. * fast/forms/script-tests/ValidityState-valueMissing-radio.js: - Update the expectation for the behavior change of https://bugs.webkit.org/show_bug.cgi?id=76365 - Add test cases for radio buttons not in a radio button group. * fast/forms/ValidityState-valueMissing-radio-expected.txt: ditto. * perf/adding-radio-buttons-expected.txt: Added. * perf/adding-radio-buttons.html: Added. TBR=tkent@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=111482

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -455 lines) Patch
M LayoutTests/fast/forms/ValidityState-valueMissing-radio-expected.txt View 3 chunks +4 lines, -12 lines 0 comments Download
D LayoutTests/fast/forms/radio/radio-live-validation-style.html View 1 chunk +0 lines, -94 lines 0 comments Download
D LayoutTests/fast/forms/radio/radio-live-validation-style-expected.txt View 1 chunk +0 lines, -45 lines 0 comments Download
M LayoutTests/fast/forms/script-tests/ValidityState-valueMissing-radio.js View 4 chunks +8 lines, -24 lines 0 comments Download
D LayoutTests/perf/adding-radio-buttons.html View 1 chunk +0 lines, -37 lines 0 comments Download
D LayoutTests/perf/adding-radio-buttons-expected.txt View 1 chunk +0 lines, -3 lines 0 comments Download
M Source/WebCore/dom/CheckedRadioButtons.h View 1 chunk +2 lines, -10 lines 0 comments Download
M Source/WebCore/dom/CheckedRadioButtons.cpp View 1 chunk +28 lines, -207 lines 0 comments Download
M Source/WebCore/html/CheckboxInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/WebCore/html/FileInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/WebCore/html/HTMLFormControlElement.h View 1 chunk +0 lines, -1 line 0 comments Download
M Source/WebCore/html/HTMLFormControlElement.cpp View 1 chunk +4 lines, -10 lines 0 comments Download
M Source/WebCore/html/HTMLInputElement.h View 1 chunk +0 lines, -1 line 0 comments Download
M Source/WebCore/html/HTMLInputElement.cpp View 4 chunks +37 lines, -7 lines 0 comments Download
M Source/WebCore/html/RadioInputType.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/WebCore/html/RadioInputType.cpp View 2 chunks +7 lines, -1 line 0 comments Download
M Source/WebCore/html/TextFieldInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 2 (0 generated)
tkent
8 years, 9 months ago (2012-03-21 01:59:59 UTC) #1
tkent
8 years, 9 months ago (2012-03-21 02:15:52 UTC) #2
LGTM

Powered by Google App Engine
This is Rietveld 408576698