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

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

Issue 69543007: Have NodeTraversal::nextSkippingChildren() 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 1999 Antti Koivisto (koivisto@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * 10 *
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const 729 void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const
730 { 730 {
731 m_listItems.clear(); 731 m_listItems.clear();
732 732
733 m_shouldRecalcListItems = false; 733 m_shouldRecalcListItems = false;
734 734
735 HTMLOptionElement* foundSelected = 0; 735 HTMLOptionElement* foundSelected = 0;
736 HTMLOptionElement* firstOption = 0; 736 HTMLOptionElement* firstOption = 0;
737 for (Element* currentElement = ElementTraversal::firstWithin(this); currentE lement; ) { 737 for (Element* currentElement = ElementTraversal::firstWithin(this); currentE lement; ) {
738 if (!currentElement->isHTMLElement()) { 738 if (!currentElement->isHTMLElement()) {
739 currentElement = ElementTraversal::nextSkippingChildren(currentEleme nt, this); 739 currentElement = ElementTraversal::nextSkippingChildren(*currentElem ent, this);
740 continue; 740 continue;
741 } 741 }
742 HTMLElement* current = toHTMLElement(currentElement); 742 HTMLElement* current = toHTMLElement(currentElement);
743 743
744 // optgroup tags may not nest. However, both FireFox and IE will 744 // optgroup tags may not nest. However, both FireFox and IE will
745 // flatten the tree automatically, so we follow suit. 745 // flatten the tree automatically, so we follow suit.
746 // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6) 746 // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6)
747 if (isHTMLOptGroupElement(current)) { 747 if (isHTMLOptGroupElement(current)) {
748 m_listItems.append(current); 748 m_listItems.append(current);
749 if (Element* nextElement = ElementTraversal::firstWithin(current)) { 749 if (Element* nextElement = ElementTraversal::firstWithin(current)) {
(...skipping 22 matching lines...) Expand all
772 772
773 if (current->hasTagName(hrTag)) 773 if (current->hasTagName(hrTag))
774 m_listItems.append(current); 774 m_listItems.append(current);
775 775
776 // In conforming HTML code, only <optgroup> and <option> will be found 776 // In conforming HTML code, only <optgroup> and <option> will be found
777 // within a <select>. We call NodeTraversal::nextSkippingChildren so tha t we only step 777 // within a <select>. We call NodeTraversal::nextSkippingChildren so tha t we only step
778 // into those tags that we choose to. For web-compat, we should cope 778 // into those tags that we choose to. For web-compat, we should cope
779 // with the case where odd tags like a <div> have been added but we 779 // with the case where odd tags like a <div> have been added but we
780 // handle this because such tags have already been removed from the 780 // handle this because such tags have already been removed from the
781 // <select>'s subtree at this point. 781 // <select>'s subtree at this point.
782 currentElement = ElementTraversal::nextSkippingChildren(currentElement, this); 782 currentElement = ElementTraversal::nextSkippingChildren(*currentElement, this);
783 } 783 }
784 784
785 if (!foundSelected && m_size <= 1 && firstOption && !firstOption->selected() ) 785 if (!foundSelected && m_size <= 1 && firstOption && !firstOption->selected() )
786 firstOption->setSelectedState(true); 786 firstOption->setSelectedState(true);
787 } 787 }
788 788
789 int HTMLSelectElement::selectedIndex() const 789 int HTMLSelectElement::selectedIndex() const
790 { 790 {
791 unsigned index = 0; 791 unsigned index = 0;
792 792
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 remove(index); 1578 remove(index);
1579 return true; 1579 return true;
1580 } 1580 }
1581 1581
1582 bool HTMLSelectElement::isInteractiveContent() const 1582 bool HTMLSelectElement::isInteractiveContent() const
1583 { 1583 {
1584 return true; 1584 return true;
1585 } 1585 }
1586 1586
1587 } // namespace 1587 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698