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

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

Issue 2796853002: Update text field 'change' event logic to match to Firefox. (Closed)
Patch Set: . Created 3 years, 8 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 void InputType::dispatchSearchEvent() {} 516 void InputType::dispatchSearchEvent() {}
517 517
518 void InputType::setValue(const String& sanitizedValue, 518 void InputType::setValue(const String& sanitizedValue,
519 bool valueChanged, 519 bool valueChanged,
520 TextFieldEventBehavior eventBehavior, 520 TextFieldEventBehavior eventBehavior,
521 TextControlSetValueSelection) { 521 TextControlSetValueSelection) {
522 // This setValue() implementation is used only for ValueMode::kValue except 522 // This setValue() implementation is used only for ValueMode::kValue except
523 // TextFieldInputType. That is to say, type=color, type=range, and temporal 523 // TextFieldInputType. That is to say, type=color, type=range, and temporal
524 // input types. 524 // input types.
525 DCHECK_EQ(valueMode(), ValueMode::kValue); 525 DCHECK_EQ(valueMode(), ValueMode::kValue);
526 element().setNonAttributeValue(sanitizedValue); 526 if (eventBehavior == DispatchNoEvent)
527 element().setNonAttributeValue(sanitizedValue);
528 else
529 element().setNonAttributeValueByUserEdit(sanitizedValue);
527 if (!valueChanged) 530 if (!valueChanged)
528 return; 531 return;
529 switch (eventBehavior) { 532 switch (eventBehavior) {
530 case DispatchChangeEvent: 533 case DispatchChangeEvent:
531 element().dispatchFormControlChangeEvent(); 534 element().dispatchFormControlChangeEvent();
532 break; 535 break;
533 case DispatchInputAndChangeEvent: 536 case DispatchInputAndChangeEvent:
534 element().dispatchFormControlInputEvent(); 537 element().dispatchFormControlInputEvent();
535 element().dispatchFormControlChangeEvent(); 538 element().dispatchFormControlChangeEvent();
536 break; 539 break;
537 case DispatchNoEvent: 540 case DispatchNoEvent:
538 element().setTextAsOfLastFormControlChangeEvent(element().value());
539 break; 541 break;
540 } 542 }
541 } 543 }
542 544
543 bool InputType::canSetValue(const String&) { 545 bool InputType::canSetValue(const String&) {
544 return true; 546 return true;
545 } 547 }
546 548
547 String InputType::localizeValue(const String& proposedValue) const { 549 String InputType::localizeValue(const String& proposedValue) const {
548 return proposedValue; 550 return proposedValue;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 916
915 void InputType::addWarningToConsole(const char* messageFormat, 917 void InputType::addWarningToConsole(const char* messageFormat,
916 const String& value) const { 918 const String& value) const {
917 element().document().addConsoleMessage(ConsoleMessage::create( 919 element().document().addConsoleMessage(ConsoleMessage::create(
918 RenderingMessageSource, WarningMessageLevel, 920 RenderingMessageSource, WarningMessageLevel,
919 String::format(messageFormat, 921 String::format(messageFormat,
920 JSONValue::quoteString(value).utf8().data()))); 922 JSONValue::quoteString(value).utf8().data())));
921 } 923 }
922 924
923 } // namespace blink 925 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698