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

Unified Diff: Source/core/html/HTMLInputElement.cpp

Issue 461323006: input[type=date] warns if specified string is invalid. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/spatial-navigation/snav-date-expected.txt ('k') | Source/core/html/forms/DateInputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index bfa231a81a50340cd323dc691221383c30c59945..58ffff2bb0ff639cea445a00d641317a7aa9ba18 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -444,9 +444,12 @@ void HTMLInputElement::updateType()
}
if (!didStoreValue && willStoreValue) {
AtomicString valueString = fastGetAttribute(valueAttr);
+ m_inputType->warnIfValueIsInvalid(valueString);
m_valueIfDirty = sanitizeValue(valueString);
- } else
+ } else {
+ m_inputType->warnIfValueIsInvalid(hasDirtyValue() ? m_valueIfDirty : fastGetAttribute(valueAttr).string());
updateValueIfNeeded();
+ }
m_needsToUpdateViewValue = true;
m_inputTypeView->updateView();
@@ -660,6 +663,7 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr
m_needsToUpdateViewValue = true;
setNeedsValidityCheck();
m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress;
+ m_inputType->warnIfValueIsInvalid(value);
m_inputTypeView->valueAttributeChanged();
} else if (name == checkedAttr) {
// Another radio button in the same group might be checked by state
@@ -1001,6 +1005,7 @@ void HTMLInputElement::setValue(const String& value, ExceptionState& exceptionSt
void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior eventBehavior)
{
+ m_inputType->warnIfValueIsInvalid(value);
if (!m_inputType->canSetValue(value))
return;
« no previous file with comments | « LayoutTests/fast/spatial-navigation/snav-date-expected.txt ('k') | Source/core/html/forms/DateInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698