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 |
77 const WebInputElement* input_element = toWebInputElement(&element); | 81 const WebInputElement* input_element = toWebInputElement(&element); |
78 return IsAutofillableInputElement(input_element) || | 82 return IsAutofillableInputElement(input_element) || |
79 IsSelectElement(element) || | 83 IsSelectElement(element) || |
80 IsTextAreaElement(element); | 84 IsTextAreaElement(element); |
81 } | 85 } |
82 | 86 |
83 // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement. | 87 // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement. |
84 bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { | 88 bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { |
85 return input_element.autoComplete(); | 89 return input_element.autoComplete(); |
86 } | 90 } |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 | 1158 |
1155 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { | 1159 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { |
1156 gfx::Rect bounding_box(element->boundsInViewportSpace()); | 1160 gfx::Rect bounding_box(element->boundsInViewportSpace()); |
1157 return gfx::RectF(bounding_box.x() * scale, | 1161 return gfx::RectF(bounding_box.x() * scale, |
1158 bounding_box.y() * scale, | 1162 bounding_box.y() * scale, |
1159 bounding_box.width() * scale, | 1163 bounding_box.width() * scale, |
1160 bounding_box.height() * scale); | 1164 bounding_box.height() * scale); |
1161 } | 1165 } |
1162 | 1166 |
1163 } // namespace autofill | 1167 } // namespace autofill |
OLD | NEW |