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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/ColorInputType.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 wrapperElement->setShadowPseudoId( 135 wrapperElement->setShadowPseudoId(
136 AtomicString("-webkit-color-swatch-wrapper")); 136 AtomicString("-webkit-color-swatch-wrapper"));
137 HTMLDivElement* colorSwatch = HTMLDivElement::create(document); 137 HTMLDivElement* colorSwatch = HTMLDivElement::create(document);
138 colorSwatch->setShadowPseudoId(AtomicString("-webkit-color-swatch")); 138 colorSwatch->setShadowPseudoId(AtomicString("-webkit-color-swatch"));
139 wrapperElement->appendChild(colorSwatch); 139 wrapperElement->appendChild(colorSwatch);
140 element().userAgentShadowRoot()->appendChild(wrapperElement); 140 element().userAgentShadowRoot()->appendChild(wrapperElement);
141 141
142 element().updateView(); 142 element().updateView();
143 } 143 }
144 144
145 void ColorInputType::setValue(const String& value, 145 void ColorInputType::didSetValue(const String&, bool valueChanged) {
146 bool valueChanged,
147 TextFieldEventBehavior eventBehavior) {
148 InputType::setValue(value, valueChanged, eventBehavior);
149
150 if (!valueChanged) 146 if (!valueChanged)
151 return; 147 return;
152
153 element().updateView(); 148 element().updateView();
154 if (m_chooser) 149 if (m_chooser)
155 m_chooser->setSelectedColor(valueAsColor()); 150 m_chooser->setSelectedColor(valueAsColor());
156 } 151 }
157 152
158 void ColorInputType::handleDOMActivateEvent(Event* event) { 153 void ColorInputType::handleDOMActivateEvent(Event* event) {
159 if (element().isDisabledFormControl()) 154 if (element().isDisabledFormControl())
160 return; 155 return;
161 156
162 if (!UserGestureIndicator::utilizeUserGesture()) 157 if (!UserGestureIndicator::utilizeUserGesture())
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 267
273 AXObject* ColorInputType::popupRootAXObject() { 268 AXObject* ColorInputType::popupRootAXObject() {
274 return m_chooser ? m_chooser->rootAXObject() : nullptr; 269 return m_chooser ? m_chooser->rootAXObject() : nullptr;
275 } 270 }
276 271
277 ColorChooserClient* ColorInputType::colorChooserClient() { 272 ColorChooserClient* ColorInputType::colorChooserClient() {
278 return this; 273 return this;
279 } 274 }
280 275
281 } // namespace blink 276 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/ColorInputType.h ('k') | third_party/WebKit/Source/core/html/forms/InputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698