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

Unified Diff: Source/WebKit/chromium/src/WebFrameImpl.cpp

Issue 7039019: Merge 86219 - 2011-05-10 Kent Tamura <tkent@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/WebFrameImpl.cpp
===================================================================
--- Source/WebKit/chromium/src/WebFrameImpl.cpp (revision 86710)
+++ Source/WebKit/chromium/src/WebFrameImpl.cpp (working copy)
@@ -705,23 +705,16 @@
return;
RefPtr<HTMLCollection> forms = m_frame->document()->forms();
- size_t formCount = 0;
- for (size_t i = 0; i < forms->length(); ++i) {
+ size_t sourceLength = forms->length();
+ Vector<WebFormElement> temp;
+ temp.reserveCapacity(sourceLength);
+ for (size_t i = 0; i < sourceLength; ++i) {
Node* node = forms->item(i);
+ // Strange but true, sometimes node can be 0.
if (node && node->isHTMLElement())
- ++formCount;
+ temp.append(WebFormElement(static_cast<HTMLFormElement*>(node)));
}
-
- WebVector<WebFormElement> temp(formCount);
- size_t j = 0;
- for (size_t sourceIndex = 0; j < forms->length(); ++sourceIndex) {
- Node* node = forms->item(sourceIndex);
- // Strange but true, sometimes item can be 0.
- if (node && node->isHTMLElement())
- temp[j++] = static_cast<HTMLFormElement*>(node);
- }
- ASSERT(j == formCount);
- results.swap(temp);
+ results.assign(temp);
}
WebAnimationController* WebFrameImpl::animationController()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698