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

Unified Diff: Source/core/html/HTMLSelectElement.cpp

Issue 68173014: Have ElementTraversal::firstWithin() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/page/FocusController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLSelectElement.cpp
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index 0f693a918189e7e4003d63a99d540db22d4d0348..cd14b54c35c5fea5ca269d0586ef78a58f43c7f7 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -734,44 +734,44 @@ void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const
HTMLOptionElement* foundSelected = 0;
HTMLOptionElement* firstOption = 0;
- for (Element* currentElement = ElementTraversal::firstWithin(this); currentElement; ) {
+ for (Element* currentElement = ElementTraversal::firstWithin(*this); currentElement; ) {
if (!currentElement->isHTMLElement()) {
currentElement = ElementTraversal::nextSkippingChildren(*currentElement, this);
continue;
}
- HTMLElement* current = toHTMLElement(currentElement);
+ HTMLElement& current = toHTMLElement(*currentElement);
// optgroup tags may not nest. However, both FireFox and IE will
// flatten the tree automatically, so we follow suit.
// (http://www.w3.org/TR/html401/interact/forms.html#h-17.6)
if (isHTMLOptGroupElement(current)) {
- m_listItems.append(current);
+ m_listItems.append(&current);
if (Element* nextElement = ElementTraversal::firstWithin(current)) {
currentElement = nextElement;
continue;
}
}
- if (current->hasTagName(optionTag)) {
- m_listItems.append(current);
+ if (current.hasTagName(optionTag)) {
+ m_listItems.append(&current);
if (updateSelectedStates && !m_multiple) {
- HTMLOptionElement* option = toHTMLOptionElement(current);
+ HTMLOptionElement& option = toHTMLOptionElement(current);
if (!firstOption)
- firstOption = option;
- if (option->selected()) {
+ firstOption = &option;
+ if (option.selected()) {
if (foundSelected)
foundSelected->setSelectedState(false);
- foundSelected = option;
- } else if (m_size <= 1 && !foundSelected && !option->isDisabledFormControl()) {
- foundSelected = option;
+ foundSelected = &option;
+ } else if (m_size <= 1 && !foundSelected && !option.isDisabledFormControl()) {
+ foundSelected = &option;
foundSelected->setSelectedState(true);
}
}
}
- if (current->hasTagName(hrTag))
- m_listItems.append(current);
+ if (current.hasTagName(hrTag))
+ m_listItems.append(&current);
// In conforming HTML code, only <optgroup> and <option> will be found
// within a <select>. We call NodeTraversal::nextSkippingChildren so that we only step
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/page/FocusController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698