Skip to content

Commit

Permalink
Update android WebView to use WebElementCollection instead of WebNode…
Browse files Browse the repository at this point in the history
…Collection

Update android WebView 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 an unnecessary isElementNode() check.

Review URL: https://codereview.chromium.org/149313005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250284 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ch.dumez@samsung.com committed Feb 11, 2014
1 parent 33f0e35 commit e0025a5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions android_webview/renderer/aw_render_view_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
#include "third_party/WebKit/public/web/WebDataSource.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/WebHitTestResult.h"
#include "third_party/WebKit/public/web/WebImageCache.h"
#include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebNodeCollection.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "url/url_canon.h"
Expand All @@ -54,11 +54,11 @@ GURL GetAbsoluteSrcUrl(const blink::WebElement& element) {
return GetAbsoluteUrl(element, element.getAttribute("src"));
}

blink::WebNode GetImgChild(const blink::WebNode& node) {
blink::WebElement GetImgChild(const blink::WebElement& element) {
// This implementation is incomplete (for example if is an area tag) but
// matches the original WebViewClassic implementation.

blink::WebNodeCollection collection = node.getElementsByTagName("img");
blink::WebElementCollection collection = element.getElementsByTagName("img");
DCHECK(!collection.isNull());
return collection.firstItem();
}
Expand Down Expand Up @@ -261,10 +261,10 @@ void AwRenderViewExt::FocusedNodeChanged(const blink::WebNode& node) {
absolute_link_url = GetAbsoluteUrl(node, data.href);

GURL absolute_image_url;
const blink::WebNode child_img = GetImgChild(node);
if (!child_img.isNull() && child_img.isElementNode()) {
const blink::WebElement child_img = GetImgChild(element);
if (!child_img.isNull()) {
absolute_image_url =
GetAbsoluteSrcUrl(child_img.toConst<blink::WebElement>());
GetAbsoluteSrcUrl(child_img);
}

PopulateHitTestData(absolute_link_url,
Expand Down

0 comments on commit e0025a5

Please sign in to comment.