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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 bool IsNoScriptElement(const WebElement& element) { | 67 bool IsNoScriptElement(const WebElement& element) { |
68 CR_DEFINE_STATIC_LOCAL(WebString, kNoScript, ("noscript")); | 68 CR_DEFINE_STATIC_LOCAL(WebString, kNoScript, ("noscript")); |
69 return element.hasHTMLTagName(kNoScript); | 69 return element.hasHTMLTagName(kNoScript); |
70 } | 70 } |
71 | 71 |
72 bool HasTagName(const WebNode& node, const blink::WebString& tag) { | 72 bool HasTagName(const WebNode& node, const blink::WebString& tag) { |
73 return node.isElementNode() && node.toConst<WebElement>().hasHTMLTagName(tag); | 73 return node.isElementNode() && node.toConst<WebElement>().hasHTMLTagName(tag); |
74 } | 74 } |
75 | 75 |
76 bool IsAutofillableElement(const WebFormControlElement& element) { | 76 bool IsAutofillableElement(const WebFormControlElement& element) { |
77 // Exclude disabled and readonly elements. | |
78 if (!element.isEnabled() || element.isReadOnly()) | |
79 return false; | |
80 | |
81 const WebInputElement* input_element = toWebInputElement(&element); | 77 const WebInputElement* input_element = toWebInputElement(&element); |
82 return IsAutofillableInputElement(input_element) || | 78 return IsAutofillableInputElement(input_element) || |
83 IsSelectElement(element) || | 79 IsSelectElement(element) || |
84 IsTextAreaElement(element); | 80 IsTextAreaElement(element); |
85 } | 81 } |
86 | 82 |
87 // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement. | 83 // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement. |
88 bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { | 84 bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { |
89 return input_element.autoComplete(); | 85 return input_element.autoComplete(); |
90 } | 86 } |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 | 1154 |
1159 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { | 1155 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { |
1160 gfx::Rect bounding_box(element->boundsInViewportSpace()); | 1156 gfx::Rect bounding_box(element->boundsInViewportSpace()); |
1161 return gfx::RectF(bounding_box.x() * scale, | 1157 return gfx::RectF(bounding_box.x() * scale, |
1162 bounding_box.y() * scale, | 1158 bounding_box.y() * scale, |
1163 bounding_box.width() * scale, | 1159 bounding_box.width() * scale, |
1164 bounding_box.height() * scale); | 1160 bounding_box.height() * scale); |
1165 } | 1161 } |
1166 | 1162 |
1167 } // namespace autofill | 1163 } // namespace autofill |
OLD | NEW |