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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 m_ancestorDisabledState = AncestorDisabledStateUnknown; 130 m_ancestorDisabledState = AncestorDisabledStateUnknown;
131 disabledAttributeChanged(); 131 disabledAttributeChanged();
132 } 132 }
133 133
134 void HTMLFormControlElement::reset() { 134 void HTMLFormControlElement::reset() {
135 setAutofilled(false); 135 setAutofilled(false);
136 resetImpl(); 136 resetImpl();
137 } 137 }
138 138
139 void HTMLFormControlElement::attributeChanged( 139 void HTMLFormControlElement::attributeChanged(
140 const QualifiedName& name, 140 const AttributeModificationParams& params) {
141 const AtomicString& oldValue, 141 HTMLElement::attributeChanged(params);
142 const AtomicString& newValue, 142 if (params.name == disabledAttr &&
143 AttributeModificationReason reason) { 143 params.oldValue.isNull() != params.newValue.isNull()) {
144 HTMLElement::attributeChanged(name, oldValue, newValue, reason);
145 if (name == disabledAttr && oldValue.isNull() != newValue.isNull()) {
146 disabledAttributeChanged(); 144 disabledAttributeChanged();
147 if (reason == AttributeModificationReason::kDirectly && 145 if (params.reason == AttributeModificationReason::kDirectly &&
148 isDisabledFormControl() && adjustedFocusedElementInTreeScope() == this) 146 isDisabledFormControl() && adjustedFocusedElementInTreeScope() == this)
149 blur(); 147 blur();
150 } 148 }
151 } 149 }
152 150
153 void HTMLFormControlElement::parseAttribute(const QualifiedName& name, 151 void HTMLFormControlElement::parseAttribute(
154 const AtomicString& oldValue, 152 const AttributeModificationParams& params) {
155 const AtomicString& value) { 153 const QualifiedName& name = params.name;
156 if (name == formAttr) { 154 if (name == formAttr) {
157 formAttributeChanged(); 155 formAttributeChanged();
158 UseCounter::count(document(), UseCounter::FormAttribute); 156 UseCounter::count(document(), UseCounter::FormAttribute);
159 } else if (name == readonlyAttr) { 157 } else if (name == readonlyAttr) {
160 if (oldValue.isNull() != value.isNull()) { 158 if (params.oldValue.isNull() != params.newValue.isNull()) {
161 setNeedsWillValidateCheck(); 159 setNeedsWillValidateCheck();
162 pseudoStateChanged(CSSSelector::PseudoReadOnly); 160 pseudoStateChanged(CSSSelector::PseudoReadOnly);
163 pseudoStateChanged(CSSSelector::PseudoReadWrite); 161 pseudoStateChanged(CSSSelector::PseudoReadWrite);
164 if (layoutObject()) 162 if (layoutObject())
165 LayoutTheme::theme().controlStateChanged(*layoutObject(), 163 LayoutTheme::theme().controlStateChanged(*layoutObject(),
166 ReadOnlyControlState); 164 ReadOnlyControlState);
167 } 165 }
168 } else if (name == requiredAttr) { 166 } else if (name == requiredAttr) {
169 if (oldValue.isNull() != value.isNull()) 167 if (params.oldValue.isNull() != params.newValue.isNull())
170 requiredAttributeChanged(); 168 requiredAttributeChanged();
171 UseCounter::count(document(), UseCounter::RequiredAttribute); 169 UseCounter::count(document(), UseCounter::RequiredAttribute);
172 } else if (name == autofocusAttr) { 170 } else if (name == autofocusAttr) {
173 HTMLElement::parseAttribute(name, oldValue, value); 171 HTMLElement::parseAttribute(params);
174 UseCounter::count(document(), UseCounter::AutoFocusAttribute); 172 UseCounter::count(document(), UseCounter::AutoFocusAttribute);
175 } else { 173 } else {
176 HTMLElement::parseAttribute(name, oldValue, value); 174 HTMLElement::parseAttribute(params);
177 } 175 }
178 } 176 }
179 177
180 void HTMLFormControlElement::disabledAttributeChanged() { 178 void HTMLFormControlElement::disabledAttributeChanged() {
181 // Don't blur in this function because this is called for descendants of 179 // Don't blur in this function because this is called for descendants of
182 // <fieldset> while tree traversal. 180 // <fieldset> while tree traversal.
183 EventDispatchForbiddenScope eventForbidden; 181 EventDispatchForbiddenScope eventForbidden;
184 182
185 setNeedsWillValidateCheck(); 183 setNeedsWillValidateCheck();
186 pseudoStateChanged(CSSSelector::PseudoDisabled); 184 pseudoStateChanged(CSSSelector::PseudoDisabled);
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 const Element& source) { 634 const Element& source) {
637 HTMLElement::copyNonAttributePropertiesFromElement(source); 635 HTMLElement::copyNonAttributePropertiesFromElement(source);
638 setNeedsValidityCheck(); 636 setNeedsValidityCheck();
639 } 637 }
640 638
641 void HTMLFormControlElement::associateWith(HTMLFormElement* form) { 639 void HTMLFormControlElement::associateWith(HTMLFormElement* form) {
642 associateByParser(form); 640 associateByParser(form);
643 }; 641 };
644 642
645 } // namespace blink 643 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormControlElement.h ('k') | third_party/WebKit/Source/core/html/HTMLFormElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698