#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/WebNodeList.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "url/url_canon.h"
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::WebNodeList list = node.getElementsByTagName("img");
- if (list.length() > 0)
- return list.item(0);
- return blink::WebNode();
+ blink::WebElementCollection collection = element.getElementsByTagName("img");
+ DCHECK(!collection.isNull());
+ return collection.firstItem();
}
bool RemovePrefixAndAssignIfMatches(const base::StringPiece& prefix,
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,