Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 // We don't ask InputType::setValue to dispatch events because | 153 // We don't ask InputType::setValue to dispatch events because |
| 154 // TextFieldInputType dispatches events different way from InputType. | 154 // TextFieldInputType dispatches events different way from InputType. |
| 155 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); | 155 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); |
| 156 | 156 |
| 157 if (valueChanged) | 157 if (valueChanged) |
| 158 input->updateView(); | 158 input->updateView(); |
| 159 | 159 |
| 160 unsigned max = visibleValue().length(); | 160 unsigned max = visibleValue().length(); |
| 161 if (input->focused()) | 161 if (input->focused()) |
| 162 input->setSelectionRange(max, max); | 162 input->setSelectionRange(max, max); |
| 163 else | |
| 164 input->cacheSelectionInResponseToSetValue(max); | |
|
tkent
2014/04/28 00:33:40
What happens if selectionStart=selectionEnd=3 befo
harpreet.sk
2014/04/28 16:07:55
In the above case the caret is place at end of tex
| |
| 165 | 163 |
| 166 if (!valueChanged) | 164 if (!valueChanged) |
| 167 return; | 165 return; |
| 168 | 166 |
| 169 switch (eventBehavior) { | 167 switch (eventBehavior) { |
| 170 case DispatchChangeEvent: | 168 case DispatchChangeEvent: |
| 171 // If the user is still editing this field, dispatch an input event rath er than a change event. | 169 // If the user is still editing this field, dispatch an input event rath er than a change event. |
| 172 // The change event will be dispatched when editing finishes. | 170 // The change event will be dispatched when editing finishes. |
| 173 if (input->focused()) | 171 if (input->focused()) |
| 174 input->dispatchFormControlInputEvent(); | 172 input->dispatchFormControlInputEvent(); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 563 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
| 566 } | 564 } |
| 567 | 565 |
| 568 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch) | 566 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch) |
| 569 { | 567 { |
| 570 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) | 568 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) |
| 571 element().dispatchFormControlChangeEvent(); | 569 element().dispatchFormControlChangeEvent(); |
| 572 } | 570 } |
| 573 | 571 |
| 574 } // namespace WebCore | 572 } // namespace WebCore |
| OLD | NEW |