Chromium Code Reviews| 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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1392 return; | 1392 return; |
| 1393 | 1393 |
| 1394 const WebInputElement* input_element = toWebInputElement(&element); | 1394 const WebInputElement* input_element = toWebInputElement(&element); |
| 1395 if (IsAutofillableInputElement(input_element) || | 1395 if (IsAutofillableInputElement(input_element) || |
| 1396 IsTextAreaElement(element) || | 1396 IsTextAreaElement(element) || |
| 1397 IsSelectElement(element)) { | 1397 IsSelectElement(element)) { |
| 1398 field->is_autofilled = element.isAutofilled(); | 1398 field->is_autofilled = element.isAutofilled(); |
| 1399 if (!g_prevent_layout) | 1399 if (!g_prevent_layout) |
| 1400 field->is_focusable = element.isFocusable(); | 1400 field->is_focusable = element.isFocusable(); |
| 1401 field->should_autocomplete = element.autoComplete(); | 1401 field->should_autocomplete = element.autoComplete(); |
| 1402 | |
| 1403 // Use 'text-align: left|right' if set or 'direction' otherwise. | |
| 1404 // See crbug.com/482339 | |
| 1402 field->text_direction = element.directionForFormData() == | 1405 field->text_direction = element.directionForFormData() == |
| 1403 "rtl" ? base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT; | 1406 "rtl" ? base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT; |
| 1407 if (element.alignmentForFormData() == "left") | |
| 1408 field->text_direction = base::i18n::LEFT_TO_RIGHT; | |
|
esprehn
2016/07/21 22:05:19
This makes text-align always win over direction. I
| |
| 1409 else if (element.alignmentForFormData() == "right") | |
| 1410 field->text_direction = base::i18n::RIGHT_TO_LEFT; | |
| 1404 } | 1411 } |
| 1405 | 1412 |
| 1406 if (IsAutofillableInputElement(input_element)) { | 1413 if (IsAutofillableInputElement(input_element)) { |
| 1407 if (IsTextInput(input_element)) | 1414 if (IsTextInput(input_element)) |
| 1408 field->max_length = input_element->maxLength(); | 1415 field->max_length = input_element->maxLength(); |
| 1409 | 1416 |
| 1410 SetCheckStatus(field, IsCheckableElement(input_element), | 1417 SetCheckStatus(field, IsCheckableElement(input_element), |
| 1411 input_element->isChecked()); | 1418 input_element->isChecked()); |
| 1412 } else if (IsTextAreaElement(element)) { | 1419 } else if (IsTextAreaElement(element)) { |
| 1413 // Nothing more to do in this case. | 1420 // Nothing more to do in this case. |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1789 // Zero selection start is for password manager, which can show usernames | 1796 // Zero selection start is for password manager, which can show usernames |
| 1790 // that do not begin with the user input value. | 1797 // that do not begin with the user input value. |
| 1791 selection_start = (offset == base::string16::npos) ? 0 : offset; | 1798 selection_start = (offset == base::string16::npos) ? 0 : offset; |
| 1792 } | 1799 } |
| 1793 | 1800 |
| 1794 input_element->setSelectionRange(selection_start, suggestion.length()); | 1801 input_element->setSelectionRange(selection_start, suggestion.length()); |
| 1795 } | 1802 } |
| 1796 | 1803 |
| 1797 } // namespace form_util | 1804 } // namespace form_util |
| 1798 } // namespace autofill | 1805 } // namespace autofill |
| OLD | NEW |