| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/form_manager.h" | 5 #include "chrome/renderer/form_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/scoped_vector.h" | 8 #include "base/scoped_vector.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 if (extract_mask & EXTRACT_OPTIONS) { | 304 if (extract_mask & EXTRACT_OPTIONS) { |
| 305 // Set option strings on the field if available. | 305 // Set option strings on the field if available. |
| 306 std::vector<string16> option_strings; | 306 std::vector<string16> option_strings; |
| 307 GetOptionStringsFromElement(element, &option_strings); | 307 GetOptionStringsFromElement(element, &option_strings); |
| 308 field->set_option_strings(option_strings); | 308 field->set_option_strings(option_strings); |
| 309 } | 309 } |
| 310 | 310 |
| 311 if (element.formControlType() == WebString::fromUTF8("text")) { | 311 if (element.formControlType() == WebString::fromUTF8("text")) { |
| 312 const WebInputElement& input_element = element.toConst<WebInputElement>(); | 312 const WebInputElement& input_element = element.toConst<WebInputElement>(); |
| 313 field->set_size(input_element.size()); | 313 field->set_max_length(input_element.maxLength()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 if (!(extract_mask & EXTRACT_VALUE)) | 316 if (!(extract_mask & EXTRACT_VALUE)) |
| 317 return; | 317 return; |
| 318 | 318 |
| 319 // TODO(jhawkins): In WebKit, move value() and setValue() to | 319 // TODO(jhawkins): In WebKit, move value() and setValue() to |
| 320 // WebFormControlElement. | 320 // WebFormControlElement. |
| 321 string16 value; | 321 string16 value; |
| 322 if (element.formControlType() == WebString::fromUTF8("text") || | 322 if (element.formControlType() == WebString::fromUTF8("text") || |
| 323 element.formControlType() == WebString::fromUTF8("hidden")) { | 323 element.formControlType() == WebString::fromUTF8("hidden")) { |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 WebInputElement input_element = field->to<WebInputElement>(); | 908 WebInputElement input_element = field->to<WebInputElement>(); |
| 909 | 909 |
| 910 // If the maxlength attribute contains a negative value, maxLength() | 910 // If the maxlength attribute contains a negative value, maxLength() |
| 911 // returns the default maxlength value. | 911 // returns the default maxlength value. |
| 912 input_element.setSuggestedValue( | 912 input_element.setSuggestedValue( |
| 913 data->value().substr(0, input_element.maxLength())); | 913 data->value().substr(0, input_element.maxLength())); |
| 914 input_element.setAutofilled(true); | 914 input_element.setAutofilled(true); |
| 915 if (is_initiating_node) | 915 if (is_initiating_node) |
| 916 input_element.setSelectionRange(0, input_element.suggestedValue().length()); | 916 input_element.setSelectionRange(0, input_element.suggestedValue().length()); |
| 917 } | 917 } |
| OLD | NEW |