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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 case DispatchInputAndChangeEvent: { | 179 case DispatchInputAndChangeEvent: { |
180 input->dispatchFormControlInputEvent(); | 180 input->dispatchFormControlInputEvent(); |
181 input->dispatchFormControlChangeEvent(); | 181 input->dispatchFormControlChangeEvent(); |
182 break; | 182 break; |
183 } | 183 } |
184 | 184 |
185 case DispatchNoEvent: | 185 case DispatchNoEvent: |
186 break; | 186 break; |
187 } | 187 } |
188 | 188 |
189 if (!input->focused()) | 189 if (!input->focused() && eventBehavior != DispatchNoEvent) |
tkent
2014/04/04 01:31:46
I think this change will make an incompatible beha
Habib Virji
2014/04/04 09:24:05
Done.
| |
190 input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); | 190 input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); |
191 } | 191 } |
192 | 192 |
193 void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event) | 193 void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event) |
194 { | 194 { |
195 if (!element().focused()) | 195 if (!element().focused()) |
196 return; | 196 return; |
197 if (Chrome* chrome = this->chrome()) { | 197 if (Chrome* chrome = this->chrome()) { |
198 chrome->client().handleKeyboardEventOnTextField(element(), *event); | 198 chrome->client().handleKeyboardEventOnTextField(element(), *event); |
199 return; | 199 return; |
200 } | 200 } |
201 event->setDefaultHandled(); | 201 event->setDefaultHandled(); |
202 } | 202 } |
203 | 203 |
204 void TextFieldInputType::handleKeydownEventForSpinButton(KeyboardEvent* event) | 204 void TextFieldInputType::handleKeydownEventForSpinButton(KeyboardEvent* event) |
205 { | 205 { |
206 if (element().isDisabledOrReadOnly()) | 206 if (element().isDisabledOrReadOnly()) |
207 return; | 207 return; |
208 const String& key = event->keyIdentifier(); | 208 const String& key = event->keyIdentifier(); |
209 if (key == "Up") | 209 if (key == "Up") |
210 spinButtonStepUp(); | 210 spinButtonStepUp(); |
211 else if (key == "Down") | 211 else if (key == "Down") |
212 spinButtonStepDown(); | 212 spinButtonStepDown(); |
213 else | 213 else |
214 return; | 214 return; |
215 element().dispatchFormControlChangeEvent(); | |
215 event->setDefaultHandled(); | 216 event->setDefaultHandled(); |
216 } | 217 } |
217 | 218 |
218 void TextFieldInputType::forwardEvent(Event* event) | 219 void TextFieldInputType::forwardEvent(Event* event) |
219 { | 220 { |
220 if (SpinButtonElement* spinButton = spinButtonElement()) { | 221 if (SpinButtonElement* spinButton = spinButtonElement()) { |
221 spinButton->forwardEvent(event); | 222 spinButton->forwardEvent(event); |
222 if (event->defaultHandled()) | 223 if (event->defaultHandled()) |
223 return; | 224 return; |
224 } | 225 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 bool TextFieldInputType::shouldSpinButtonRespondToMouseEvents() | 552 bool TextFieldInputType::shouldSpinButtonRespondToMouseEvents() |
552 { | 553 { |
553 return !element().isDisabledOrReadOnly(); | 554 return !element().isDisabledOrReadOnly(); |
554 } | 555 } |
555 | 556 |
556 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() | 557 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() |
557 { | 558 { |
558 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 559 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
559 } | 560 } |
560 | 561 |
562 void TextFieldInputType::spinButtonDidReleaseMouseCapture() | |
563 { | |
564 element().dispatchFormControlChangeEvent(); | |
565 } | |
566 | |
561 } // namespace WebCore | 567 } // namespace WebCore |
OLD | NEW |