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

Unified Diff: Source/core/testing/Internals.cpp

Issue 120443003: Add autofill preview support for Textarea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update code as per review comments Created 6 years, 11 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 | « Source/core/testing/Internals.h ('k') | Source/web/WebTextAreaElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index d82d4768cb905e46cdcb10b2e65337ed8882ef8d..5df6b8faf403f30e95208cfd8917f0de3a2a3d4a 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -1019,12 +1019,18 @@ String Internals::suggestedValue(Element* element, ExceptionState& exceptionStat
return String();
}
- if (!element->hasTagName(inputTag)) {
+ if (!element->isFormControlElement()) {
exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return String();
}
- return toHTMLInputElement(element)->suggestedValue();
+ String suggestedValue;
+ if (element->hasTagName(inputTag))
+ suggestedValue = toHTMLInputElement(element)->suggestedValue();
+
+ if (element->hasTagName(textareaTag))
+ suggestedValue = toHTMLTextAreaElement(element)->suggestedValue();
+ return suggestedValue;
}
void Internals::setSuggestedValue(Element* element, const String& value, ExceptionState& exceptionState)
@@ -1034,12 +1040,16 @@ void Internals::setSuggestedValue(Element* element, const String& value, Excepti
return;
}
- if (!element->hasTagName(inputTag)) {
+ if (!element->isFormControlElement()) {
exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
}
- toHTMLInputElement(element)->setSuggestedValue(value);
+ if (element->hasTagName(inputTag))
+ toHTMLInputElement(element)->setSuggestedValue(value);
+
+ if (element->hasTagName(textareaTag))
+ toHTMLTextAreaElement(element)->setSuggestedValue(value);
}
void Internals::setEditingValue(Element* element, const String& value, ExceptionState& exceptionState)
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/web/WebTextAreaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698