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

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

Issue 146973006: Use isFinishedParsingChildren() in HTMLSelectElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 { 200 {
201 setAttribute(valueAttr, value); 201 setAttribute(valueAttr, value);
202 } 202 }
203 203
204 bool HTMLOptionElement::selected() const 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 the isFinishedParsingChildren 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->isFinishedParsingChildren())
215 return m_isSelected; 215 return m_isSelected;
216 select->updateListItemSelectedStates(); 216 select->updateListItemSelectedStates();
217 } 217 }
218 return m_isSelected; 218 return m_isSelected;
219 } 219 }
220 220
221 void HTMLOptionElement::setSelected(bool selected) 221 void HTMLOptionElement::setSelected(bool selected)
222 { 222 {
223 if (m_isSelected == selected) 223 if (m_isSelected == selected)
224 return; 224 return;
(...skipping 140 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
« no previous file with comments | « no previous file | Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698