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

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

Issue 1280423002: CSS4: Implement :placeholder-shown pseudo class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 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
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index f14561f81f06a0416f789f4e2a8c18d358011798..4cbb77c6d991682f83159740eeb4c1d6d28b1ee7 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -119,6 +119,7 @@ HTMLInputElement::HTMLInputElement(Document& document, HTMLFormElement* form, bo
, m_hasTouchEventHandler(false)
, m_shouldRevealPassword(false)
, m_needsToUpdateViewValue(true)
+ , m_isPlaceholderVisible(false)
// |m_inputType| is lazily created when constructed by the parser to avoid
// constructing unnecessarily a text inputType and its shadow subtree, just
// to destroy them when the |type| attribute gets set by the parser to
@@ -700,7 +701,7 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr
} else if (name == valueAttr) {
// We only need to setChanged if the form is looking at the default value right now.
if (!hasDirtyValue()) {
- updatePlaceholderVisibility(false);
+ updatePlaceholderVisibility();
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAttribute(valueAttr));
}
m_needsToUpdateViewValue = true;
@@ -1665,6 +1666,11 @@ bool HTMLInputElement::shouldAppearChecked() const
return checked() && m_inputType->isCheckable();
}
+void HTMLInputElement::setPlaceholderVisibility(bool visible)
+{
+ m_isPlaceholderVisible = visible;
+}
+
bool HTMLInputElement::supportsPlaceholder() const
{
return m_inputType->supportsPlaceholder();

Powered by Google App Engine
This is Rietveld 408576698