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

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

Issue 642973003: Introduce typed Node/Element iterators for range-based for loops of C++11. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename `from` to `fromNext`. Make some parameters const references. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLFormElement.cpp
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index 880b9adeb8a9de71c2e87bc0b52c31361df87af0..75811a409b69d0d5211d324a26ed5b005a5106eb 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -622,12 +622,12 @@ PassRefPtrWillBeRawPtr<HTMLFormControlsCollection> HTMLFormElement::elements()
void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElement::List& elements) const
{
elements.clear();
- for (HTMLElement* element = Traversal<HTMLElement>::firstWithin(root); element; element = Traversal<HTMLElement>::next(*element)) {
+ for (HTMLElement& element : Traversal<HTMLElement>::fromNext(root)) {
FormAssociatedElement* associatedElement = 0;
- if (element->isFormControlElement())
- associatedElement = toHTMLFormControlElement(element);
- else if (isHTMLObjectElement(*element))
- associatedElement = toHTMLObjectElement(element);
+ if (element.isFormControlElement())
+ associatedElement = toHTMLFormControlElement(&element);
+ else if (isHTMLObjectElement(element))
+ associatedElement = toHTMLObjectElement(&element);
else
continue;
if (associatedElement->form()== this)
@@ -656,9 +656,9 @@ const FormAssociatedElement::List& HTMLFormElement::associatedElements() const
void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& elements)
{
elements.clear();
- for (HTMLImageElement* image = Traversal<HTMLImageElement>::firstWithin(root); image; image = Traversal<HTMLImageElement>::next(*image)) {
- if (image->formOwner() == this)
- elements.append(image);
+ for (HTMLImageElement& image : Traversal<HTMLImageElement>::fromNext(root)) {
+ if (image.formOwner() == this)
+ elements.append(&image);
}
}

Powered by Google App Engine
This is Rietveld 408576698