Bug 673873 - Display placeholder when focusing empty input. r=mounir

This commit is contained in:
Frank Yan committed 2012-05-24 03:54:25 -07:00
1 parent 10c495a195
commit 7f77f2baca
5 files changed
+11 -44

No files matched your search

+1 -28
View File
@@ -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<nsISelection> ourSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL,
getter_AddRefs(ourSel));
@@ -1392,9 +1367,7 @@ nsTextControlFrame::SetValueChanged(bool aValueChanged)
nsCOMPtr<nsITextControlElement> 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);