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

Side by Side Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 934173002: Revert of Autofill: Use the title attribute as a last resort for finding labels (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/11_register_macys.com.out ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/content/renderer/form_autofill_util.h" 5 #include "components/autofill/content/renderer/form_autofill_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 560
561 // If we didn't find a label, check for table row case. 561 // If we didn't find a label, check for table row case.
562 inferred_label = InferLabelFromTableRow(element); 562 inferred_label = InferLabelFromTableRow(element);
563 if (!inferred_label.empty()) 563 if (!inferred_label.empty())
564 return inferred_label; 564 return inferred_label;
565 565
566 if (!check_div_first) { 566 if (!check_div_first) {
567 // If we didn't find a label from the table, check for div table case if we 567 // If we didn't find a label from the table, check for div table case if we
568 // haven't already. 568 // haven't already.
569 inferred_label = InferLabelFromDivTable(element); 569 inferred_label = InferLabelFromDivTable(element);
570 if (!inferred_label.empty())
571 return inferred_label;
572 } 570 }
573
574 // Not all web pages put useful info in the title attribute, thus use this as
575 // a last resort.
576 CR_DEFINE_STATIC_LOCAL(WebString, kTitle, ("title"));
577 if (element.hasAttribute(kTitle))
578 inferred_label = element.getAttribute(kTitle);
579 return inferred_label; 571 return inferred_label;
580 } 572 }
581 573
582 // Fills |option_strings| with the values of the <option> elements present in 574 // Fills |option_strings| with the values of the <option> elements present in
583 // |select_element|. 575 // |select_element|.
584 void GetOptionStringsFromElement(const WebSelectElement& select_element, 576 void GetOptionStringsFromElement(const WebSelectElement& select_element,
585 std::vector<base::string16>* option_values, 577 std::vector<base::string16>* option_values,
586 std::vector<base::string16>* option_contents) { 578 std::vector<base::string16>* option_contents) {
587 DCHECK(!select_element.isNull()); 579 DCHECK(!select_element.isNull());
588 580
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 1417
1426 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) { 1418 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) {
1427 gfx::Rect bounding_box(element->boundsInViewportSpace()); 1419 gfx::Rect bounding_box(element->boundsInViewportSpace());
1428 return gfx::RectF(bounding_box.x() * scale, 1420 return gfx::RectF(bounding_box.x() * scale,
1429 bounding_box.y() * scale, 1421 bounding_box.y() * scale,
1430 bounding_box.width() * scale, 1422 bounding_box.width() * scale,
1431 bounding_box.height() * scale); 1423 bounding_box.height() * scale);
1432 } 1424 }
1433 1425
1434 } // namespace autofill 1426 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/11_register_macys.com.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698