diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp
index c4b82753d440..af493c857d11 100644
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -3203,7 +3203,6 @@ nsHTMLInputElement::IntrinsicState() const
}
if (PlaceholderApplies() && HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
- !nsContentUtils::IsFocusedContent((nsIContent*)(this)) &&
IsValueEmpty()) {
state |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
}
@@ -4075,8 +4074,7 @@ nsHTMLInputElement::OnValueChanged(bool aNotify)
// :-moz-placeholder pseudo-class may change when the value changes.
// However, we don't want to waste cycles if the state doesn't apply.
if (PlaceholderApplies() &&
- HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
- !nsContentUtils::IsFocusedContent(this)) {
+ HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
UpdateState(aNotify);
}
}
diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp
index a52bb76bf6fb..ef78a685f783 100644
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -1146,7 +1146,6 @@ nsHTMLTextAreaElement::IntrinsicState() const
}
if (HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
- !nsContentUtils::IsFocusedContent((nsIContent*)(this)) &&
IsValueEmpty()) {
state |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
}
@@ -1515,8 +1514,7 @@ nsHTMLTextAreaElement::OnValueChanged(bool aNotify)
UpdateValueMissingValidityState();
if (validBefore != IsValid() ||
- (HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)
- && !nsContentUtils::IsFocusedContent((nsIContent*)(this)))) {
+ HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
UpdateState(aNotify);
}
}
diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp
index b966953151ad..875a2c3097e9 100644
--- a/content/html/content/src/nsTextEditorState.cpp
+++ b/content/html/content/src/nsTextEditorState.cpp
@@ -1934,16 +1934,9 @@ nsTextEditorState::ValueWasChanged(bool aNotify)
return;
}
- bool showPlaceholder = false;
- nsCOMPtr content = do_QueryInterface(mTextCtrlElement);
- if (!nsContentUtils::IsFocusedContent(content)) {
- // If the content is focused, we don't care about the changes because
- // the placeholder is going to be hidden/shown on blur.
- nsAutoString valueString;
- GetValue(valueString, true);
- showPlaceholder = valueString.IsEmpty();
- }
- SetPlaceholderClass(showPlaceholder, aNotify);
+ nsAutoString valueString;
+ GetValue(valueString, true);
+ SetPlaceholderClass(valueString.IsEmpty(), aNotify);
}
void
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index a6ef33ab39c1..458973aff303 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -631,21 +631,6 @@ void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint)
mScrollEvent.Revoke();
if (!aOn) {
- if (mUsePlaceholder) {
- PRInt32 textLength;
- GetTextLength(&textLength);
-
- if (!textLength) {
- nsWeakFrame weakFrame(this);
-
- txtCtrl->SetPlaceholderClass(true, true);
-
- if (!weakFrame.IsAlive()) {
- return;
- }
- }
- }
-
return;
}
@@ -653,16 +638,6 @@ void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint)
if (!selCon)
return;
- if (mUsePlaceholder) {
- nsWeakFrame weakFrame(this);
-
- txtCtrl->SetPlaceholderClass(false, true);
-
- if (!weakFrame.IsAlive()) {
- return;
- }
- }
-
nsCOMPtr ourSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL,
getter_AddRefs(ourSel));
@@ -1392,9 +1367,7 @@ nsTextControlFrame::SetValueChanged(bool aValueChanged)
nsCOMPtr txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");
- if (mUsePlaceholder && !nsContentUtils::IsFocusedContent(mContent)) {
- // If the content is focused, we don't care about the changes because
- // the placeholder is going to be hidden/shown on blur.
+ if (mUsePlaceholder) {
PRInt32 textLength;
GetTextLength(&textLength);
diff --git a/layout/style/forms.css b/layout/style/forms.css
index 25957e50a096..f729b68280ee 100644
--- a/layout/style/forms.css
+++ b/layout/style/forms.css
@@ -145,6 +145,11 @@ textarea:-moz-placeholder {
color: GrayText;
}
+input:-moz-placeholder > .anonymous-div:not(.placeholder),
+textarea:-moz-placeholder > .anonymous-div:not(.placeholder) {
+ color: -moz-FieldText;
+}
+
input > .placeholder,
textarea > .placeholder {
overflow: hidden;