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

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

Issue 2735633006: INPUT/TEXTAREA elements: Dispatch 'select' event only if text selection is changed. (Closed)
Patch Set: Remove throttling Created 3 years, 9 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) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 exceptionState.throwDOMException(InvalidStateError, 1064 exceptionState.throwDOMException(InvalidStateError,
1065 "This input element accepts a filename, " 1065 "This input element accepts a filename, "
1066 "which may only be programmatically set " 1066 "which may only be programmatically set "
1067 "to the empty string."); 1067 "to the empty string.");
1068 return; 1068 return;
1069 } 1069 }
1070 setValue(value, eventBehavior); 1070 setValue(value, eventBehavior);
1071 } 1071 }
1072 1072
1073 void HTMLInputElement::setValue(const String& value, 1073 void HTMLInputElement::setValue(const String& value,
1074 TextFieldEventBehavior eventBehavior) { 1074 TextFieldEventBehavior eventBehavior,
1075 TextControlSetValueSelection selection) {
1075 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); 1076 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value);
1076 if (!m_inputType->canSetValue(value)) 1077 if (!m_inputType->canSetValue(value))
1077 return; 1078 return;
1078 1079
1079 EventQueueScope scope; 1080 EventQueueScope scope;
1080 String sanitizedValue = sanitizeValue(value); 1081 String sanitizedValue = sanitizeValue(value);
1081 bool valueChanged = sanitizedValue != this->value(); 1082 bool valueChanged = sanitizedValue != this->value();
1082 1083
1083 setLastChangeWasNotUserEdit(); 1084 setLastChangeWasNotUserEdit();
1084 m_needsToUpdateViewValue = true; 1085 m_needsToUpdateViewValue = true;
1085 // Prevent TextFieldInputType::setValue from using the suggested value. 1086 // Prevent TextFieldInputType::setValue from using the suggested value.
1086 m_suggestedValue = String(); 1087 m_suggestedValue = String();
1087 1088
1088 m_inputType->setValue(sanitizedValue, valueChanged, eventBehavior); 1089 m_inputType->setValue(sanitizedValue, valueChanged, eventBehavior, selection);
1089 m_inputTypeView->didSetValue(sanitizedValue, valueChanged); 1090 m_inputTypeView->didSetValue(sanitizedValue, valueChanged);
1090 1091
1091 if (valueChanged) 1092 if (valueChanged)
1092 notifyFormStateChanged(); 1093 notifyFormStateChanged();
1093 } 1094 }
1094 1095
1095 void HTMLInputElement::setNonAttributeValue(const String& sanitizedValue) { 1096 void HTMLInputElement::setNonAttributeValue(const String& sanitizedValue) {
1096 // This is a common code for ValueMode::kValue. 1097 // This is a common code for ValueMode::kValue.
1097 DCHECK_EQ(m_inputType->valueMode(), ValueMode::kValue); 1098 DCHECK_EQ(m_inputType->valueMode(), ValueMode::kValue);
1098 m_nonAttributeValue = sanitizedValue; 1099 m_nonAttributeValue = sanitizedValue;
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 1880
1880 bool HTMLInputElement::hasFallbackContent() const { 1881 bool HTMLInputElement::hasFallbackContent() const {
1881 return m_inputTypeView->hasFallbackContent(); 1882 return m_inputTypeView->hasFallbackContent();
1882 } 1883 }
1883 1884
1884 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) { 1885 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) {
1885 return m_inputType->setFilesFromPaths(paths); 1886 return m_inputType->setFilesFromPaths(paths);
1886 } 1887 }
1887 1888
1888 } // namespace blink 1889 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.h ('k') | third_party/WebKit/Source/core/html/HTMLTextAreaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698