| 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 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 | 1626 |
| 1627 WebElement element = child.to<WebElement>(); | 1627 WebElement element = child.to<WebElement>(); |
| 1628 if (!element.hasHTMLTagName(kScript) && | 1628 if (!element.hasHTMLTagName(kScript) && |
| 1629 !element.hasHTMLTagName(kMeta) && | 1629 !element.hasHTMLTagName(kMeta) && |
| 1630 !element.hasHTMLTagName(kTitle)) | 1630 !element.hasHTMLTagName(kTitle)) |
| 1631 return false; | 1631 return false; |
| 1632 } | 1632 } |
| 1633 return true; | 1633 return true; |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) { | |
| 1637 gfx::Rect bounding_box(element->boundsInViewportSpace()); | |
| 1638 return gfx::RectF(bounding_box.x() * scale, | |
| 1639 bounding_box.y() * scale, | |
| 1640 bounding_box.width() * scale, | |
| 1641 bounding_box.height() * scale); | |
| 1642 } | |
| 1643 | |
| 1644 void PreviewSuggestion(const base::string16& suggestion, | 1636 void PreviewSuggestion(const base::string16& suggestion, |
| 1645 const base::string16& user_input, | 1637 const base::string16& user_input, |
| 1646 blink::WebFormControlElement* input_element) { | 1638 blink::WebFormControlElement* input_element) { |
| 1647 size_t selection_start = user_input.length(); | 1639 size_t selection_start = user_input.length(); |
| 1648 if (IsFeatureSubstringMatchEnabled()) { | 1640 if (IsFeatureSubstringMatchEnabled()) { |
| 1649 size_t offset = GetTextSelectionStart(suggestion, user_input, false); | 1641 size_t offset = GetTextSelectionStart(suggestion, user_input, false); |
| 1650 // Zero selection start is for password manager, which can show usernames | 1642 // Zero selection start is for password manager, which can show usernames |
| 1651 // that do not begin with the user input value. | 1643 // that do not begin with the user input value. |
| 1652 selection_start = (offset == base::string16::npos) ? 0 : offset; | 1644 selection_start = (offset == base::string16::npos) ? 0 : offset; |
| 1653 } | 1645 } |
| 1654 | 1646 |
| 1655 input_element->setSelectionRange(selection_start, suggestion.length()); | 1647 input_element->setSelectionRange(selection_start, suggestion.length()); |
| 1656 } | 1648 } |
| 1657 | 1649 |
| 1658 } // namespace form_util | 1650 } // namespace form_util |
| 1659 } // namespace autofill | 1651 } // namespace autofill |
| OLD | NEW |