| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "core/html/HTMLOptionElement.h" | 61 #include "core/html/HTMLOptionElement.h" |
| 62 #include "core/html/forms/ColorInputType.h" | 62 #include "core/html/forms/ColorInputType.h" |
| 63 #include "core/html/forms/FileInputType.h" | 63 #include "core/html/forms/FileInputType.h" |
| 64 #include "core/html/forms/FormController.h" | 64 #include "core/html/forms/FormController.h" |
| 65 #include "core/html/forms/InputType.h" | 65 #include "core/html/forms/InputType.h" |
| 66 #include "core/html/forms/SearchInputType.h" | 66 #include "core/html/forms/SearchInputType.h" |
| 67 #include "core/html/parser/HTMLParserIdioms.h" | 67 #include "core/html/parser/HTMLParserIdioms.h" |
| 68 #include "core/html/shadow/ShadowElementNames.h" | 68 #include "core/html/shadow/ShadowElementNames.h" |
| 69 #include "core/page/Chrome.h" | 69 #include "core/page/Chrome.h" |
| 70 #include "core/page/ChromeClient.h" | 70 #include "core/page/ChromeClient.h" |
| 71 #include "core/page/Page.h" |
| 71 #include "core/rendering/RenderTextControlSingleLine.h" | 72 #include "core/rendering/RenderTextControlSingleLine.h" |
| 72 #include "core/rendering/RenderTheme.h" | 73 #include "core/rendering/RenderTheme.h" |
| 73 #include "platform/DateTimeChooser.h" | 74 #include "platform/DateTimeChooser.h" |
| 74 #include "platform/Language.h" | 75 #include "platform/Language.h" |
| 75 #include "platform/PlatformMouseEvent.h" | 76 #include "platform/PlatformMouseEvent.h" |
| 76 #include "platform/text/PlatformLocale.h" | 77 #include "platform/text/PlatformLocale.h" |
| 77 #include "wtf/MathExtras.h" | 78 #include "wtf/MathExtras.h" |
| 78 | 79 |
| 79 using namespace std; | 80 using namespace std; |
| 80 | 81 |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 m_isIndeterminate = sourceElement.m_isIndeterminate; | 912 m_isIndeterminate = sourceElement.m_isIndeterminate; |
| 912 | 913 |
| 913 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); | 914 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 914 | 915 |
| 915 m_needsToUpdateViewValue = true; | 916 m_needsToUpdateViewValue = true; |
| 916 m_inputTypeView->updateView(); | 917 m_inputTypeView->updateView(); |
| 917 } | 918 } |
| 918 | 919 |
| 919 String HTMLInputElement::value() const | 920 String HTMLInputElement::value() const |
| 920 { | 921 { |
| 922 if (m_inputType->canSetValueAfterUserGesture() && !m_valueGatedOnUserGesture
.isEmpty()) { |
| 923 if (document().page()->userGestureSeenSinceLastNavigation()) |
| 924 return m_valueGatedOnUserGesture; |
| 925 return String(); |
| 926 } |
| 927 |
| 921 String value; | 928 String value; |
| 922 if (m_inputType->getTypeSpecificValue(value)) | 929 if (m_inputType->getTypeSpecificValue(value)) |
| 923 return value; | 930 return value; |
| 924 | 931 |
| 925 value = m_valueIfDirty; | 932 value = m_valueIfDirty; |
| 926 if (!value.isNull()) | 933 if (!value.isNull()) |
| 927 return value; | 934 return value; |
| 928 | 935 |
| 929 AtomicString valueString = fastGetAttribute(valueAttr); | 936 AtomicString valueString = fastGetAttribute(valueAttr); |
| 930 value = sanitizeValue(valueString); | 937 value = sanitizeValue(valueString); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 942 | 949 |
| 943 return m_inputType->defaultValue(); | 950 return m_inputType->defaultValue(); |
| 944 } | 951 } |
| 945 | 952 |
| 946 void HTMLInputElement::setValueForUser(const String& value) | 953 void HTMLInputElement::setValueForUser(const String& value) |
| 947 { | 954 { |
| 948 // Call setValue and make it send a change event. | 955 // Call setValue and make it send a change event. |
| 949 setValue(value, DispatchChangeEvent); | 956 setValue(value, DispatchChangeEvent); |
| 950 } | 957 } |
| 951 | 958 |
| 959 void HTMLInputElement::setValueAfterUserGesture(const String& value) |
| 960 { |
| 961 if (m_inputType->canSetValueAfterUserGesture()) |
| 962 m_valueGatedOnUserGesture = value; |
| 963 else |
| 964 setValueForUser(value); |
| 965 } |
| 966 |
| 952 const String& HTMLInputElement::suggestedValue() const | 967 const String& HTMLInputElement::suggestedValue() const |
| 953 { | 968 { |
| 954 return m_suggestedValue; | 969 return m_suggestedValue; |
| 955 } | 970 } |
| 956 | 971 |
| 957 void HTMLInputElement::setSuggestedValue(const String& value) | 972 void HTMLInputElement::setSuggestedValue(const String& value) |
| 958 { | 973 { |
| 959 if (!m_inputType->canSetSuggestedValue()) | 974 if (!m_inputType->canSetSuggestedValue()) |
| 960 return; | 975 return; |
| 961 m_needsToUpdateViewValue = true; | 976 m_needsToUpdateViewValue = true; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 setTextAsOfLastFormControlChangeEvent(sanitizedValue); | 1030 setTextAsOfLastFormControlChangeEvent(sanitizedValue); |
| 1016 | 1031 |
| 1017 if (!valueChanged) | 1032 if (!valueChanged) |
| 1018 return; | 1033 return; |
| 1019 | 1034 |
| 1020 notifyFormStateChanged(); | 1035 notifyFormStateChanged(); |
| 1021 } | 1036 } |
| 1022 | 1037 |
| 1023 void HTMLInputElement::setValueInternal(const String& sanitizedValue, TextFieldE
ventBehavior eventBehavior) | 1038 void HTMLInputElement::setValueInternal(const String& sanitizedValue, TextFieldE
ventBehavior eventBehavior) |
| 1024 { | 1039 { |
| 1040 m_valueGatedOnUserGesture = String(); |
| 1025 m_valueIfDirty = sanitizedValue; | 1041 m_valueIfDirty = sanitizedValue; |
| 1026 setNeedsValidityCheck(); | 1042 setNeedsValidityCheck(); |
| 1027 if (document().focusedElement() == this) | 1043 if (document().focusedElement() == this) |
| 1028 document().frameHost()->chrome().client().didUpdateTextOfFocusedElementB
yNonUserInput(); | 1044 document().frameHost()->chrome().client().didUpdateTextOfFocusedElementB
yNonUserInput(); |
| 1029 } | 1045 } |
| 1030 | 1046 |
| 1031 void HTMLInputElement::updateView() | 1047 void HTMLInputElement::updateView() |
| 1032 { | 1048 { |
| 1033 m_inputTypeView->updateView(); | 1049 m_inputTypeView->updateView(); |
| 1034 } | 1050 } |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 } | 1892 } |
| 1877 | 1893 |
| 1878 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1894 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1879 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1895 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1880 { | 1896 { |
| 1881 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1897 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
| 1882 } | 1898 } |
| 1883 #endif | 1899 #endif |
| 1884 | 1900 |
| 1885 } // namespace | 1901 } // namespace |
| OLD | NEW |