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

Unified Diff: Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp

Issue 130213005: Add autofill preview support for <month> input fields (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase TestExpectations file Created 6 years, 10 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
Index: Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
diff --git a/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp b/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
index 4fbb511bfc732b1ffeb7ea153eeb32d35ac2582a..a678dbebd5ba26c6b4f5f2a0bb4e7bc1b463a65b 100644
--- a/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
+++ b/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
@@ -64,15 +64,19 @@ void BaseChooserOnlyDateAndTimeInputType::createShadowSubtree()
RefPtr<HTMLDivElement> valueContainer = HTMLDivElement::create(element().document());
valueContainer->setShadowPseudoId(valueContainerPseudo);
element().userAgentShadowRoot()->appendChild(valueContainer.get());
- updateAppearance();
+ updateView();
}
-void BaseChooserOnlyDateAndTimeInputType::updateAppearance()
+void BaseChooserOnlyDateAndTimeInputType::updateView()
{
Node* node = element().userAgentShadowRoot()->firstChild();
if (!node || !node->isHTMLElement())
return;
- String displayValue = visibleValue();
+ String displayValue;
+ if (!element().suggestedValue().isNull())
+ displayValue = element().suggestedValue();
+ else
+ displayValue = visibleValue();
if (displayValue.isEmpty()) {
// Need to put something to keep text baseline.
displayValue = " ";
@@ -84,7 +88,7 @@ void BaseChooserOnlyDateAndTimeInputType::setValue(const String& value, bool val
{
BaseDateAndTimeInputType::setValue(value, valueChanged, eventBehavior);
if (valueChanged)
- updateAppearance();
+ updateView();
}
void BaseChooserOnlyDateAndTimeInputType::closePopupView()

Powered by Google App Engine
This is Rietveld 408576698