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

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

Issue 1837463002: Improve conformance of default OPTION selection of SELECT element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming to resetToDefaultSelection Created 4 years, 8 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return collectOptionInnerText().stripWhiteSpace(isHTMLSpace<UChar>).simplify WhiteSpace(isHTMLSpace<UChar>); 232 return collectOptionInnerText().stripWhiteSpace(isHTMLSpace<UChar>).simplify WhiteSpace(isHTMLSpace<UChar>);
233 } 233 }
234 234
235 void HTMLOptionElement::setValue(const AtomicString& value) 235 void HTMLOptionElement::setValue(const AtomicString& value)
236 { 236 {
237 setAttribute(valueAttr, value); 237 setAttribute(valueAttr, value);
238 } 238 }
239 239
240 bool HTMLOptionElement::selected() const 240 bool HTMLOptionElement::selected() const
241 { 241 {
242 if (HTMLSelectElement* select = ownerSelectElement()) {
243 // If a stylesheet contains option:checked selectors, this function is
244 // called during parsing. updateListItemSelectedStates() is O(N) where N
245 // is the number of option elements, so the <select> parsing would be
246 // O(N^2) without the isFinishedParsingChildren check. Also,
247 // updateListItemSelectedStates() determines default selection, and we'd
248 // like to avoid to determine default selection with incomplete option
249 // list.
250 if (!select->isFinishedParsingChildren())
251 return m_isSelected;
252 select->updateListItemSelectedStates();
253 }
254 return m_isSelected; 242 return m_isSelected;
255 } 243 }
256 244
257 void HTMLOptionElement::setSelected(bool selected) 245 void HTMLOptionElement::setSelected(bool selected)
258 { 246 {
259 if (m_isSelected == selected) 247 if (m_isSelected == selected)
260 return; 248 return;
261 249
262 setSelectedState(selected); 250 setSelectedState(selected);
263 251
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 ASSERT(parent); 469 ASSERT(parent);
482 if (isHTMLOptGroupElement(*parent)) { 470 if (isHTMLOptGroupElement(*parent)) {
483 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle(); 471 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle();
484 return !parentStyle || parentStyle->display() == NONE; 472 return !parentStyle || parentStyle->display() == NONE;
485 } 473 }
486 } 474 }
487 return m_style->display() == NONE; 475 return m_style->display() == NONE;
488 } 476 }
489 477
490 } // namespace blink 478 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698