Skip to content

Commit

Permalink
Update WebNode::getElementsByTagName() callers to use a WebNodeCollec…
Browse files Browse the repository at this point in the history
…tion

Update WebNode::getElementsByTagName() callers to use a WebNodeCollection
instead of a WebNodeList. The WebNode::getElementsByTagName() public API was
updated in Blink r166263 to return a WebNodeCollection instead of a
WebNodeList.

Callers need to be updated so that we can get rid of the current workaround
allowing a WebNodeList to be implicitly converted into a WebNodeCollection.

BUG=235008

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248613 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ch.dumez@samsung.com committed Feb 3, 2014
1 parent df41e25 commit c0b58a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 4 additions & 5 deletions android_webview/renderer/aw_render_view_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#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/WebNodeCollection.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "url/url_canon.h"
Expand Down Expand Up @@ -58,10 +58,9 @@ blink::WebNode GetImgChild(const blink::WebNode& node) {
// 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::WebNodeCollection collection = node.getElementsByTagName("img");
DCHECK(!collection.isNull());
return collection.firstItem();
}

bool RemovePrefixAndAssignIfMatches(const base::StringPiece& prefix,
Expand Down
10 changes: 7 additions & 3 deletions components/autofill/content/renderer/form_autofill_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "third_party/WebKit/public/web/WebInputElement.h"
#include "third_party/WebKit/public/web/WebLabelElement.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/WebOptionElement.h"
#include "third_party/WebKit/public/web/WebSelectElement.h"
Expand All @@ -42,6 +43,7 @@ using blink::WebFrame;
using blink::WebInputElement;
using blink::WebLabelElement;
using blink::WebNode;
using blink::WebNodeCollection;
using blink::WebNodeList;
using blink::WebOptionElement;
using blink::WebSelectElement;
Expand Down Expand Up @@ -905,9 +907,11 @@ bool WebFormElementToFormData(
// element's name as a key into the <name, FormFieldData> map to find the
// previously created FormFieldData and set the FormFieldData's label to the
// label.firstChild().nodeValue() of the label element.
WebNodeList labels = form_element.getElementsByTagName(kLabel);
for (unsigned i = 0; i < labels.length(); ++i) {
WebLabelElement label = labels.item(i).to<WebLabelElement>();
WebNodeCollection labels = form_element.getElementsByTagName(kLabel);
DCHECK(!labels.isNull());
for (WebNode item = labels.firstItem(); !item.isNull();
item = labels.nextItem()) {
WebLabelElement label = item.to<WebLabelElement>();
WebFormControlElement field_element =
label.correspondingControl().to<WebFormControlElement>();

Expand Down

0 comments on commit c0b58a8

Please sign in to comment.