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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp

Issue 1490973002: Remove HTMLFormControlElement::m_disabled, m_isReadOnly, and m_isRequired. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attr-hook-2
Patch Set: Created 5 years 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
Index: third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
index cd7c635bd7043f6e6117e15a99236bc77c855474..5cfa24813f52ed0a8ad47c601ea6082773f6c142 100644
--- a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
@@ -49,10 +49,7 @@ using namespace HTMLNames;
HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form)
: LabelableElement(tagName, document)
- , m_disabled(false)
, m_isAutofilled(false)
- , m_isReadOnly(false)
- , m_isRequired(false)
, m_hasValidationMessage(false)
, m_ancestorDisabledState(AncestorDisabledStateUnknown)
, m_dataListAncestorState(Unknown)
@@ -163,14 +160,10 @@ void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
formAttributeChanged();
UseCounter::count(document(), UseCounter::FormAttribute);
} else if (name == disabledAttr) {
- bool oldDisabled = m_disabled;
- m_disabled = !value.isNull();
- if (oldDisabled != m_disabled)
+ if (oldValue.isNull() != value.isNull())
disabledAttributeChanged();
} else if (name == readonlyAttr) {
- bool wasReadOnly = m_isReadOnly;
- m_isReadOnly = !value.isNull();
- if (wasReadOnly != m_isReadOnly) {
+ if (oldValue.isNull() != value.isNull()) {
setNeedsWillValidateCheck();
pseudoStateChanged(CSSSelector::PseudoReadOnly);
pseudoStateChanged(CSSSelector::PseudoReadWrite);
@@ -178,9 +171,7 @@ void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
LayoutTheme::theme().controlStateChanged(*layoutObject(), ReadOnlyControlState);
}
} else if (name == requiredAttr) {
- bool wasRequired = m_isRequired;
- m_isRequired = !value.isNull();
- if (wasRequired != m_isRequired)
+ if (oldValue.isNull() != value.isNull())
requiredAttributeChanged();
UseCounter::count(document(), UseCounter::RequiredAttribute);
} else if (name == autofocusAttr) {
@@ -356,7 +347,7 @@ HTMLFormElement* HTMLFormControlElement::formOwner() const
bool HTMLFormControlElement::isDisabledFormControl() const
{
- if (m_disabled)
+ if (fastHasAttribute(disabledAttr))
return true;
if (m_ancestorDisabledState == AncestorDisabledStateUnknown)
@@ -366,7 +357,7 @@ bool HTMLFormControlElement::isDisabledFormControl() const
bool HTMLFormControlElement::isRequired() const
{
- return m_isRequired;
+ return fastHasAttribute(requiredAttr);
}
String HTMLFormControlElement::resultForDialogSubmit()

Powered by Google App Engine
This is Rietveld 408576698