Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3940)

Unified Diff: chrome/browser/autofill/autofill_scanner.cc

Issue 11415221: Add support for autofilling radio buttons and checkboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix browser tests (added more data in .out files, skip checkable elements when trying to parse with… Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_scanner.cc
diff --git a/chrome/browser/autofill/autofill_scanner.cc b/chrome/browser/autofill/autofill_scanner.cc
index 41aadc894f85a2dcaf3f99525f7e0c5fa9d30006..ae217572f99af187f3c66b18ef1a4951a37d3cb8 100644
--- a/chrome/browser/autofill/autofill_scanner.cc
+++ b/chrome/browser/autofill/autofill_scanner.cc
@@ -19,11 +19,12 @@ AutofillScanner::~AutofillScanner() {
}
void AutofillScanner::Advance() {
+ SkipClickables();
DCHECK(!IsEnd());
++cursor_;
}
-const AutofillField* AutofillScanner::Cursor() const {
+const AutofillField* AutofillScanner::Cursor() {
if (IsEnd()) {
NOTREACHED();
return NULL;
@@ -32,7 +33,8 @@ const AutofillField* AutofillScanner::Cursor() const {
return *cursor_;
}
-bool AutofillScanner::IsEnd() const {
+bool AutofillScanner::IsEnd() {
+ SkipClickables();
return cursor_ == end_;
}
@@ -52,3 +54,8 @@ size_t AutofillScanner::SaveCursor() {
saved_cursor_ = cursor_;
return static_cast<size_t>(cursor_ - begin_);
}
+
+void AutofillScanner::SkipClickables() {
+ while (cursor_ != end_ && (*cursor_)->is_checkable)
+ ++cursor_;
+}

Powered by Google App Engine
This is Rietveld 408576698