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