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

Unified Diff: Source/WebCore/html/HTMLInputElement.cpp

Issue 9805002: Revert 105710 - Introduce RadioButtonGroup class to keep track of the group members and required st… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/html/HTMLInputElement.h ('k') | Source/WebCore/html/RadioInputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/html/HTMLInputElement.cpp
===================================================================
--- Source/WebCore/html/HTMLInputElement.cpp (revision 111481)
+++ Source/WebCore/html/HTMLInputElement.cpp (working copy)
@@ -178,6 +178,38 @@
return HTMLTextFormControlElement::shouldAutocomplete();
}
+void HTMLInputElement::updateCheckedRadioButtons()
+{
+ checkedRadioButtons().addButton(this);
+
+ if (form()) {
+ const Vector<FormAssociatedElement*>& controls = form()->associatedElements();
+ for (unsigned i = 0; i < controls.size(); ++i) {
+ if (!controls[i]->isFormControlElement())
+ continue;
+ HTMLFormControlElement* control = static_cast<HTMLFormControlElement*>(controls[i]);
+ if (control->name() != name())
+ continue;
+ if (control->type() != type())
+ continue;
+ control->setNeedsValidityCheck();
+ }
+ } else {
+ typedef Document::FormElementListHashSet::const_iterator Iterator;
+ Iterator end = document()->formElements()->end();
+ for (Iterator it = document()->formElements()->begin(); it != end; ++it) {
+ HTMLFormControlElementWithState* control = *it;
+ if (control->formControlName() != name())
+ continue;
+ if (control->formControlType() != type())
+ continue;
+ if (control->form())
+ continue;
+ control->setNeedsValidityCheck();
+ }
+ }
+}
+
bool HTMLInputElement::isValidValue(const String& value) const
{
if (!m_inputType->canSetStringValue()) {
@@ -200,6 +232,8 @@
bool HTMLInputElement::valueMissing(const String& value) const
{
+ if (!isRequiredFormControl() || readOnly() || disabled())
+ return false;
return m_inputType->valueMissing(value);
}
@@ -918,11 +952,13 @@
if (checked() == nowChecked)
return;
+ checkedRadioButtons().removeButton(this);
+
m_reflectsCheckedAttribute = false;
m_isChecked = nowChecked;
setNeedsStyleRecalc();
if (isRadioButton())
- checkedRadioButtons().updateCheckedState(this);
+ updateCheckedRadioButtons();
if (renderer() && renderer()->style()->hasAppearance())
renderer()->theme()->stateChanged(renderer(), CheckedState);
setNeedsValidityCheck();
@@ -1513,12 +1549,6 @@
return m_inputType->supportsValidation() && HTMLTextFormControlElement::recalcWillValidate();
}
-void HTMLInputElement::requiredAttributeChanged()
-{
- HTMLTextFormControlElement::requiredAttributeChanged();
- checkedRadioButtons().requiredAttributeChanged(this);
-}
-
#if ENABLE(INPUT_COLOR)
void HTMLInputElement::selectColorInColorChooser(const Color& color)
{
« no previous file with comments | « Source/WebCore/html/HTMLInputElement.h ('k') | Source/WebCore/html/RadioInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698