Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/core/html/forms/TextFieldInputType.cpp

Issue 679273004: Set element value to its default value on reset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use sanitize value if not null, if null use defaultValue() Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 input->dispatchFormControlInputEvent(); 182 input->dispatchFormControlInputEvent();
183 input->dispatchFormControlChangeEvent(); 183 input->dispatchFormControlChangeEvent();
184 break; 184 break;
185 } 185 }
186 186
187 case DispatchNoEvent: 187 case DispatchNoEvent:
188 break; 188 break;
189 } 189 }
190 190
191 if (!input->focused()) 191 if (!input->focused())
192 input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); 192 input->setTextAsOfLastFormControlChangeEvent(sanitizedValue.isNull() ? v isibleValue() : sanitizedValue);
tkent 2014/11/10 01:54:39 Why is it visibleValue(), instead of defaultValue(
Habib Virji 2014/11/13 15:00:56 As defaultValue() and sanitizedValue both hold nul
tkent 2014/11/14 00:23:56 Using visibleValue() is semantically incorrect. I
Habib Virji 2014/11/24 11:05:32 Done.
193 } 193 }
194 194
195 void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event) 195 void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event)
196 { 196 {
197 if (!element().focused()) 197 if (!element().focused())
198 return; 198 return;
199 if (Chrome* chrome = this->chrome()) { 199 if (Chrome* chrome = this->chrome()) {
200 chrome->client().handleKeyboardEventOnTextField(element(), *event); 200 chrome->client().handleKeyboardEventOnTextField(element(), *event);
201 return; 201 return;
202 } 202 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 549 return shouldSpinButtonRespondToMouseEvents() && element().focused();
550 } 550 }
551 551
552 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch) 552 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch)
553 { 553 {
554 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) 554 if (eventDispatch == SpinButtonElement::EventDispatchAllowed)
555 element().dispatchFormControlChangeEvent(); 555 element().dispatchFormControlChangeEvent();
556 } 556 }
557 557
558 } // namespace blink 558 } // namespace blink
OLDNEW
« Source/core/html/HTMLInputElement.cpp ('K') | « Source/core/html/HTMLInputElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698