Title: [86711] branches/chromium/742/Source/WebKit/chromium/src/WebFrameImpl.cpp
- Revision
- 86711
- Author
- [email protected]
- Date
- 2011-05-17 15:31:49 -0700 (Tue, 17 May 2011)
Log Message
Merge 86219 - 2011-05-10 Kent Tamura <[email protected]>
Reviewed by Hajime Morita.
[Chromium] Fix a bug of WebFrameImpl::forms()
https://bugs.webkit.org/show_bug.cgi?id=60606
If document()->forms() contained non-HTML element, the second for
loop didn't stop.
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::forms): Simplify the function by wtf::Vector().
BUG=82154
Review URL: http://codereview.chromium.org/7039019
Modified Paths
Diff
Modified: branches/chromium/742/Source/WebKit/chromium/src/WebFrameImpl.cpp (86710 => 86711)
--- branches/chromium/742/Source/WebKit/chromium/src/WebFrameImpl.cpp 2011-05-17 22:07:53 UTC (rev 86710)
+++ branches/chromium/742/Source/WebKit/chromium/src/WebFrameImpl.cpp 2011-05-17 22:31:49 UTC (rev 86711)
@@ -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()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes