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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLOptionElement.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 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 return 0; 189 return 0;
190 } 190 }
191 191
192 int HTMLOptionElement::listIndex() const { 192 int HTMLOptionElement::listIndex() const {
193 if (HTMLSelectElement* selectElement = ownerSelectElement()) 193 if (HTMLSelectElement* selectElement = ownerSelectElement())
194 return selectElement->listIndexForOption(*this); 194 return selectElement->listIndexForOption(*this);
195 return -1; 195 return -1;
196 } 196 }
197 197
198 void HTMLOptionElement::parseAttribute(const QualifiedName& name, 198 void HTMLOptionElement::parseAttribute(
199 const AtomicString& oldValue, 199 const AttributeModificationParams& params) {
200 const AtomicString& value) { 200 const QualifiedName& name = params.name;
201 if (name == valueAttr) { 201 if (name == valueAttr) {
202 if (HTMLDataListElement* dataList = ownerDataListElement()) 202 if (HTMLDataListElement* dataList = ownerDataListElement())
203 dataList->optionElementChildrenChanged(); 203 dataList->optionElementChildrenChanged();
204 } else if (name == disabledAttr) { 204 } else if (name == disabledAttr) {
205 if (oldValue.isNull() != value.isNull()) { 205 if (params.oldValue.isNull() != params.newValue.isNull()) {
206 pseudoStateChanged(CSSSelector::PseudoDisabled); 206 pseudoStateChanged(CSSSelector::PseudoDisabled);
207 pseudoStateChanged(CSSSelector::PseudoEnabled); 207 pseudoStateChanged(CSSSelector::PseudoEnabled);
208 if (layoutObject()) 208 if (layoutObject())
209 LayoutTheme::theme().controlStateChanged(*layoutObject(), 209 LayoutTheme::theme().controlStateChanged(*layoutObject(),
210 EnabledControlState); 210 EnabledControlState);
211 } 211 }
212 } else if (name == selectedAttr) { 212 } else if (name == selectedAttr) {
213 if (oldValue.isNull() != value.isNull() && !m_isDirty) 213 if (params.oldValue.isNull() != params.newValue.isNull() && !m_isDirty)
214 setSelected(!value.isNull()); 214 setSelected(!params.newValue.isNull());
215 pseudoStateChanged(CSSSelector::PseudoDefault); 215 pseudoStateChanged(CSSSelector::PseudoDefault);
216 } else if (name == labelAttr) { 216 } else if (name == labelAttr) {
217 updateLabel(); 217 updateLabel();
218 } else { 218 } else {
219 HTMLElement::parseAttribute(name, oldValue, value); 219 HTMLElement::parseAttribute(params);
220 } 220 }
221 } 221 }
222 222
223 String HTMLOptionElement::value() const { 223 String HTMLOptionElement::value() const {
224 const AtomicString& value = fastGetAttribute(valueAttr); 224 const AtomicString& value = fastGetAttribute(valueAttr);
225 if (!value.isNull()) 225 if (!value.isNull())
226 return value; 226 return value;
227 return collectOptionInnerText() 227 return collectOptionInnerText()
228 .stripWhiteSpace(isHTMLSpace<UChar>) 228 .stripWhiteSpace(isHTMLSpace<UChar>)
229 .simplifyWhiteSpace(isHTMLSpace<UChar>); 229 .simplifyWhiteSpace(isHTMLSpace<UChar>);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 454 }
455 455
456 String HTMLOptionElement::innerText() { 456 String HTMLOptionElement::innerText() {
457 // A workaround for crbug.com/424578. We add ShadowRoot to an OPTION, but 457 // A workaround for crbug.com/424578. We add ShadowRoot to an OPTION, but
458 // innerText behavior for Shadow DOM is unclear. We just return the same 458 // innerText behavior for Shadow DOM is unclear. We just return the same
459 // string before adding ShadowRoot. 459 // string before adding ShadowRoot.
460 return textContent(); 460 return textContent();
461 } 461 }
462 462
463 } // namespace blink 463 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLOptionElement.h ('k') | third_party/WebKit/Source/core/html/HTMLOutputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698