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

Side by Side Diff: Source/core/html/HTMLOptionElement.cpp

Issue 141683004: Use more const references in HTMLCollection / LiveNodeList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (!value.isNull()) 194 if (!value.isNull())
195 return value; 195 return value;
196 return collectOptionInnerText().stripWhiteSpace(isHTMLSpace<UChar>).simplify WhiteSpace(isHTMLSpace<UChar>); 196 return collectOptionInnerText().stripWhiteSpace(isHTMLSpace<UChar>).simplify WhiteSpace(isHTMLSpace<UChar>);
197 } 197 }
198 198
199 void HTMLOptionElement::setValue(const AtomicString& value) 199 void HTMLOptionElement::setValue(const AtomicString& value)
200 { 200 {
201 setAttribute(valueAttr, value); 201 setAttribute(valueAttr, value);
202 } 202 }
203 203
204 bool HTMLOptionElement::selected() 204 bool HTMLOptionElement::selected() const
205 { 205 {
206 if (HTMLSelectElement* select = ownerSelectElement()) { 206 if (HTMLSelectElement* select = ownerSelectElement()) {
207 // If a stylesheet contains option:checked selectors, this function is 207 // If a stylesheet contains option:checked selectors, this function is
208 // called during parsing. updateListItemSelectedStates() is O(N) where N 208 // called during parsing. updateListItemSelectedStates() is O(N) where N
209 // is the number of option elements, so the <select> parsing would be 209 // is the number of option elements, so the <select> parsing would be
210 // O(N^2) without isParsingInProgress check. Also, 210 // O(N^2) without isParsingInProgress check. Also,
211 // updateListItemSelectedStates() determines default selection, and we'd 211 // updateListItemSelectedStates() determines default selection, and we'd
212 // like to avoid to determine default selection with incomplete option 212 // like to avoid to determine default selection with incomplete option
213 // list. 213 // list.
214 if (select->isParsingInProgress()) 214 if (select->isParsingInProgress())
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 HTMLFormElement* HTMLOptionElement::form() const 366 HTMLFormElement* HTMLOptionElement::form() const
367 { 367 {
368 if (HTMLSelectElement* selectElement = ownerSelectElement()) 368 if (HTMLSelectElement* selectElement = ownerSelectElement())
369 return selectElement->formOwner(); 369 return selectElement->formOwner();
370 370
371 return 0; 371 return 0;
372 } 372 }
373 373
374 } // namespace WebCore 374 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698