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

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

Issue 2435973002: INPUT element: code cleanup around setValue(). (Closed)
Patch Set: Created 4 years, 2 months 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
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/RangeInputType.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/RangeInputType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698