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

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

Issue 10542040: Merge 118725 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 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/HTMLFormControlElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/html/HTMLFormControlElement.cpp
===================================================================
--- Source/WebCore/html/HTMLFormControlElement.cpp (revision 119622)
+++ Source/WebCore/html/HTMLFormControlElement.cpp (working copy)
@@ -48,13 +48,11 @@
HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
: LabelableElement(tagName, document)
- , m_fieldSetAncestor(0)
- , m_legendAncestor(0)
- , m_fieldSetAncestorValid(false)
, m_disabled(false)
, m_readOnly(false)
, m_required(false)
, m_valueMatchesRenderer(false)
+ , m_ancestorDisabledState(AncestorDisabledStateUnknown)
, m_dataListAncestorState(Unknown)
, m_willValidateInitialized(false)
, m_willValidate(true)
@@ -101,23 +99,24 @@
return fastHasAttribute(formnovalidateAttr);
}
-void HTMLFormControlElement::updateFieldSetAndLegendAncestor() const
+void HTMLFormControlElement::updateAncestorDisabledState() const
{
- m_fieldSetAncestor = 0;
- m_legendAncestor = 0;
+ HTMLFieldSetElement* fieldSetAncestor = 0;
+ ContainerNode* legendAncestor = 0;
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
- if (!m_legendAncestor && ancestor->hasTagName(legendTag))
- m_legendAncestor = static_cast<HTMLLegendElement*>(ancestor);
+ if (!legendAncestor && ancestor->hasTagName(legendTag))
+ legendAncestor = ancestor;
if (ancestor->hasTagName(fieldsetTag)) {
- m_fieldSetAncestor = static_cast<HTMLFieldSetElement*>(ancestor);
+ fieldSetAncestor = static_cast<HTMLFieldSetElement*>(ancestor);
break;
}
}
- m_fieldSetAncestorValid = true;
+ m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->disabled() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled;
}
void HTMLFormControlElement::ancestorDisabledStateWasChanged()
{
+ m_ancestorDisabledState = AncestorDisabledStateUnknown;
disabledAttributeChanged();
}
@@ -230,7 +229,7 @@
Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Node* insertionPoint)
{
- m_fieldSetAncestorValid = false;
+ m_ancestorDisabledState = AncestorDisabledStateUnknown;
m_dataListAncestorState = Unknown;
setNeedsWillValidateCheck();
HTMLElement::insertedInto(insertionPoint);
@@ -240,7 +239,7 @@
void HTMLFormControlElement::removedFrom(Node* insertionPoint)
{
- m_fieldSetAncestorValid = false;
+ m_ancestorDisabledState = AncestorDisabledStateUnknown;
m_dataListAncestorState = Unknown;
HTMLElement::removedFrom(insertionPoint);
FormAssociatedElement::removedFrom(insertionPoint);
@@ -284,13 +283,9 @@
if (m_disabled)
return true;
- if (!m_fieldSetAncestorValid)
- updateFieldSetAndLegendAncestor();
-
- // Form controls in the first legend element inside a fieldset are not affected by fieldset.disabled.
- if (m_fieldSetAncestor && m_fieldSetAncestor->disabled())
- return !(m_legendAncestor && m_legendAncestor == m_fieldSetAncestor->legend());
- return false;
+ if (m_ancestorDisabledState == AncestorDisabledStateUnknown)
+ updateAncestorDisabledState();
+ return m_ancestorDisabledState == AncestorDisabledStateDisabled;
}
void HTMLFormControlElement::setDisabled(bool b)
@@ -366,7 +361,7 @@
{
if (m_dataListAncestorState == Unknown) {
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
- if (!m_legendAncestor && ancestor->hasTagName(datalistTag)) {
+ if (ancestor->hasTagName(datalistTag)) {
m_dataListAncestorState = InsideDataList;
break;
}
« no previous file with comments | « Source/WebCore/html/HTMLFormControlElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698