summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorch.dumez@samsung.com <ch.dumez@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-07 18:49:02 +0000
committerch.dumez@samsung.com <ch.dumez@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-07 18:49:02 +0000
commitc9393271bb6f6b4c6b01a4e96cd071b9d0d2a81b (patch)
tree85ac173abbf6c1d1476d913ede8ef0ac2fa30df5
parent961783a19e08087d92b69a158e51e1d2cab6044c (diff)
downloadchromium_src-c9393271bb6f6b4c6b01a4e96cd071b9d0d2a81b.zip
chromium_src-c9393271bb6f6b4c6b01a4e96cd071b9d0d2a81b.tar.gz
chromium_src-c9393271bb6f6b4c6b01a4e96cd071b9d0d2a81b.tar.bz2
Update content/renderer code to use WebElementCollection instead of WebNodeCollection
Update content/renderer code to use WebElementCollection instead of WebNodeCollection. Update safe_browsing code to use WebElementCollection instead of WebNodeCollection. After Blink r166411 and r166500, WebNodeCollection is renamed to WebElementCollection and its API returns WebElements instead of WebNodes. The new code is clearer and avoids unnecessary isElementNode() checks. Review URL: https://codereview.chromium.org/149913011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249736 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/dom_serializer_browsertest.cc23
-rw-r--r--content/renderer/savable_resources.cc16
2 files changed, 14 insertions, 25 deletions
diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc
index bbe89cb..f3861b2 100644
--- a/content/renderer/dom_serializer_browsertest.cc
+++ b/content/renderer/dom_serializer_browsertest.cc
@@ -27,9 +27,9 @@
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
+#include "third_party/WebKit/public/web/WebElementCollection.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebNode.h"
-#include "third_party/WebKit/public/web/WebNodeCollection.h"
#include "third_party/WebKit/public/web/WebNodeList.h"
#include "third_party/WebKit/public/web/WebPageSerializer.h"
#include "third_party/WebKit/public/web/WebPageSerializerClient.h"
@@ -39,13 +39,12 @@ using blink::WebCString;
using blink::WebData;
using blink::WebDocument;
using blink::WebElement;
+using blink::WebElementCollection;
using blink::WebFrame;
using blink::WebNode;
-using blink::WebNodeCollection;
using blink::WebNodeList;
using blink::WebPageSerializer;
using blink::WebPageSerializerClient;
-using blink::WebNode;
using blink::WebString;
using blink::WebURL;
using blink::WebView;
@@ -73,13 +72,10 @@ WebFrame* FindSubFrameByURL(WebView* web_view, const GURL& url) {
stack.pop_back();
if (GURL(current_frame->document().url()) == url)
return current_frame;
- WebNodeCollection all = current_frame->document().all();
- for (WebNode node = all.firstItem();
- !node.isNull(); node = all.nextItem()) {
- if (!node.isElementNode())
- continue;
+ WebElementCollection all = current_frame->document().all();
+ for (WebElement element = all.firstItem();
+ !element.isNull(); element = all.nextItem()) {
// Check frame tag and iframe tag
- WebElement element = node.to<WebElement>();
if (!element.hasTagName("frame") && !element.hasTagName("iframe"))
continue;
WebFrame* sub_frame = WebFrame::fromFrameOwnerElement(element);
@@ -614,13 +610,10 @@ class DomSerializerTests : public ContentBrowserTest,
WebDocument doc = web_frame->document();
ASSERT_TRUE(doc.isHTMLDocument());
// Go through all descent nodes.
- WebNodeCollection all = doc.all();
+ WebElementCollection all = doc.all();
int original_base_tag_count = 0;
- for (WebNode node = all.firstItem(); !node.isNull();
- node = all.nextItem()) {
- if (!node.isElementNode())
- continue;
- WebElement element = node.to<WebElement>();
+ for (WebElement element = all.firstItem(); !element.isNull();
+ element = all.nextItem()) {
if (element.hasTagName("base")) {
original_base_tag_count++;
} else {
diff --git a/content/renderer/savable_resources.cc b/content/renderer/savable_resources.cc
index 5e5e047..59e534f 100644
--- a/content/renderer/savable_resources.cc
+++ b/content/renderer/savable_resources.cc
@@ -13,19 +13,19 @@
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
+#include "third_party/WebKit/public/web/WebElementCollection.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
#include "third_party/WebKit/public/web/WebNode.h"
-#include "third_party/WebKit/public/web/WebNodeCollection.h"
#include "third_party/WebKit/public/web/WebNodeList.h"
#include "third_party/WebKit/public/web/WebView.h"
using blink::WebDocument;
using blink::WebElement;
+using blink::WebElementCollection;
using blink::WebFrame;
using blink::WebInputElement;
using blink::WebNode;
-using blink::WebNodeCollection;
using blink::WebNodeList;
using blink::WebString;
using blink::WebVector;
@@ -130,14 +130,10 @@ void GetAllSavableResourceLinksForFrame(WebFrame* current_frame,
// Get current using document.
WebDocument current_doc = current_frame->document();
// Go through all descent nodes.
- WebNodeCollection all = current_doc.all();
- // Go through all node in this frame.
- for (WebNode node = all.firstItem(); !node.isNull();
- node = all.nextItem()) {
- // We only save HTML resources.
- if (!node.isElementNode())
- continue;
- WebElement element = node.to<WebElement>();
+ WebElementCollection all = current_doc.all();
+ // Go through all elements in this frame.
+ for (WebElement element = all.firstItem(); !element.isNull();
+ element = all.nextItem()) {
GetSavableResourceLinkForElement(element,
current_doc,
unique_check,