OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return element().isRequired() && value.isEmpty(); | 141 return element().isRequired() && value.isEmpty(); |
142 } | 142 } |
143 | 143 |
144 bool TextFieldInputType::canSetSuggestedValue() { | 144 bool TextFieldInputType::canSetSuggestedValue() { |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
148 void TextFieldInputType::setValue(const String& sanitizedValue, | 148 void TextFieldInputType::setValue(const String& sanitizedValue, |
149 bool valueChanged, | 149 bool valueChanged, |
150 TextFieldEventBehavior eventBehavior) { | 150 TextFieldEventBehavior eventBehavior) { |
151 // We don't ask InputType::setValue to dispatch events because | 151 // We don't use InputType::setValue. TextFieldInputType dispatches events |
152 // TextFieldInputType dispatches events different way from InputType. | 152 // different way from InputType::setValue. |
153 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); | 153 element().setNonAttributeValue(sanitizedValue); |
154 | 154 |
155 if (valueChanged) | 155 if (valueChanged) |
156 element().updateView(); | 156 element().updateView(); |
157 | 157 |
158 unsigned max = visibleValue().length(); | 158 unsigned max = visibleValue().length(); |
159 element().setSelectionRange(max, max); | 159 element().setSelectionRange(max, max); |
160 | 160 |
161 if (!valueChanged) | 161 if (!valueChanged) |
162 return; | 162 return; |
163 | 163 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 return shouldSpinButtonRespondToMouseEvents() && element().isFocused(); | 548 return shouldSpinButtonRespondToMouseEvents() && element().isFocused(); |
549 } | 549 } |
550 | 550 |
551 void TextFieldInputType::spinButtonDidReleaseMouseCapture( | 551 void TextFieldInputType::spinButtonDidReleaseMouseCapture( |
552 SpinButtonElement::EventDispatch eventDispatch) { | 552 SpinButtonElement::EventDispatch eventDispatch) { |
553 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) | 553 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) |
554 element().dispatchFormControlChangeEvent(); | 554 element().dispatchFormControlChangeEvent(); |
555 } | 555 } |
556 | 556 |
557 } // namespace blink | 557 } // namespace blink |
OLD | NEW |