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

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

Issue 1280423002: CSS4: Implement :placeholder-shown pseudo class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated testcase 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/HTMLTextAreaElement.cpp
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index ae4aa22442000f1de019f3b142435cefb8b923b7..3441312a86a368e49c1f3a26ea6d717ed23359ba 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -274,7 +274,7 @@ void HTMLTextAreaElement::subtreeHasChanged()
m_valueIsUpToDate = false;
setNeedsValidityCheck();
setAutofilled(false);
- updatePlaceholderVisibility(false);
+ updatePlaceholderVisibility();
if (!focused())
return;
@@ -332,7 +332,7 @@ void HTMLTextAreaElement::updateValue() const
const_cast<HTMLTextAreaElement*>(this)->m_valueIsUpToDate = true;
const_cast<HTMLTextAreaElement*>(this)->notifyFormStateChanged();
m_isDirty = true;
- const_cast<HTMLTextAreaElement*>(this)->updatePlaceholderVisibility(false);
+ const_cast<HTMLTextAreaElement*>(this)->updatePlaceholderVisibility();
}
String HTMLTextAreaElement::value() const
@@ -384,7 +384,7 @@ void HTMLTextAreaElement::setValueCommon(const String& newValue, TextFieldEventB
setInnerEditorValue(m_value);
if (eventBehavior == DispatchNoEvent)
setLastChangeWasNotUserEdit();
- updatePlaceholderVisibility(false);
+ updatePlaceholderVisibility();
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue));
m_suggestedValue = String();
setNeedsValidityCheck();
@@ -499,7 +499,7 @@ void HTMLTextAreaElement::setSuggestedValue(const String& value)
setInnerEditorValue(m_suggestedValue);
else
setInnerEditorValue(m_value);
- updatePlaceholderVisibility(false);
+ updatePlaceholderVisibility();
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue));
}
@@ -618,6 +618,7 @@ void HTMLTextAreaElement::updatePlaceholderText()
placeholder = newElement.get();
placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
placeholder->setAttribute(idAttr, ShadowElementNames::placeholder());
+ placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true);
esprehn 2015/08/21 10:18:10 Just call updatePlaceholderVisibility() here, no r
ramya.v 2015/08/25 10:24:45 updatePlaceholderText is called from inside update
userAgentShadowRoot()->insertBefore(placeholder, innerEditorElement()->nextSibling());
}
placeholder->setTextContent(placeholderText);

Powered by Google App Engine
This is Rietveld 408576698