OLD | NEW |
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 Loading... |
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; |
570 } | 572 } |
| 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); |
571 return inferred_label; | 579 return inferred_label; |
572 } | 580 } |
573 | 581 |
574 // Fills |option_strings| with the values of the <option> elements present in | 582 // Fills |option_strings| with the values of the <option> elements present in |
575 // |select_element|. | 583 // |select_element|. |
576 void GetOptionStringsFromElement(const WebSelectElement& select_element, | 584 void GetOptionStringsFromElement(const WebSelectElement& select_element, |
577 std::vector<base::string16>* option_values, | 585 std::vector<base::string16>* option_values, |
578 std::vector<base::string16>* option_contents) { | 586 std::vector<base::string16>* option_contents) { |
579 DCHECK(!select_element.isNull()); | 587 DCHECK(!select_element.isNull()); |
580 | 588 |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 | 1425 |
1418 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) { | 1426 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) { |
1419 gfx::Rect bounding_box(element->boundsInViewportSpace()); | 1427 gfx::Rect bounding_box(element->boundsInViewportSpace()); |
1420 return gfx::RectF(bounding_box.x() * scale, | 1428 return gfx::RectF(bounding_box.x() * scale, |
1421 bounding_box.y() * scale, | 1429 bounding_box.y() * scale, |
1422 bounding_box.width() * scale, | 1430 bounding_box.width() * scale, |
1423 bounding_box.height() * scale); | 1431 bounding_box.height() * scale); |
1424 } | 1432 } |
1425 | 1433 |
1426 } // namespace autofill | 1434 } // namespace autofill |
OLD | NEW |