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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/InputType.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. 9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved.
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 bool InputType::shouldDispatchFormControlChangeEvent(String& oldValue, 506 bool InputType::shouldDispatchFormControlChangeEvent(String& oldValue,
507 String& newValue) { 507 String& newValue) {
508 return !equalIgnoringNullity(oldValue, newValue); 508 return !equalIgnoringNullity(oldValue, newValue);
509 } 509 }
510 510
511 void InputType::dispatchSearchEvent() {} 511 void InputType::dispatchSearchEvent() {}
512 512
513 void InputType::setValue(const String& sanitizedValue, 513 void InputType::setValue(const String& sanitizedValue,
514 bool valueChanged, 514 bool valueChanged,
515 TextFieldEventBehavior eventBehavior) { 515 TextFieldEventBehavior eventBehavior) {
516 element().setValueInternal(sanitizedValue, eventBehavior); 516 // This setValue() implementation is used only for ValueMode::kValue except
517 // TextFieldInputType. That is to say, type=color, type=range, and temporal
518 // input types.
519 DCHECK_EQ(valueMode(), ValueMode::kValue);
520 element().setNonAttributeValue(sanitizedValue);
517 if (!valueChanged) 521 if (!valueChanged)
518 return; 522 return;
519 switch (eventBehavior) { 523 switch (eventBehavior) {
520 case DispatchChangeEvent: 524 case DispatchChangeEvent:
521 element().dispatchFormControlChangeEvent(); 525 element().dispatchFormControlChangeEvent();
522 break; 526 break;
523 case DispatchInputAndChangeEvent: 527 case DispatchInputAndChangeEvent:
524 element().dispatchFormControlInputEvent(); 528 element().dispatchFormControlInputEvent();
525 element().dispatchFormControlChangeEvent(); 529 element().dispatchFormControlChangeEvent();
526 break; 530 break;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 902
899 void InputType::addWarningToConsole(const char* messageFormat, 903 void InputType::addWarningToConsole(const char* messageFormat,
900 const String& value) const { 904 const String& value) const {
901 element().document().addConsoleMessage(ConsoleMessage::create( 905 element().document().addConsoleMessage(ConsoleMessage::create(
902 RenderingMessageSource, WarningMessageLevel, 906 RenderingMessageSource, WarningMessageLevel,
903 String::format(messageFormat, 907 String::format(messageFormat,
904 JSONValue::quoteString(value).utf8().data()))); 908 JSONValue::quoteString(value).utf8().data())));
905 } 909 }
906 910
907 } // namespace blink 911 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698