Bug 1376317 - Move the pref var cache for dom.placeholder.show_on_focus to nsContentUtils; r=smaug

This commit is contained in:
Ehsan Akhgari
2017-06-26 14:53:22 -04:00
parent 604d4d05a3
commit 57d664b78b
3 changed files with 12 additions and 9 deletions

View File

@@ -2854,15 +2854,8 @@ nsTextEditorState::UpdateOverlayTextVisibility(bool aNotify)
mPreviewVisibility = valueIsEmpty && !previewValue.IsEmpty();
mPlaceholderVisibility = valueIsEmpty && previewValue.IsEmpty();
static bool sPrefCached = false;
static bool sPrefShowOnFocus = true;
if (!sPrefCached) {
sPrefCached = true;
Preferences::AddBoolVarCache(&sPrefShowOnFocus,
"dom.placeholder.show_on_focus", true);
}
if (mPlaceholderVisibility && !sPrefShowOnFocus) {
if (mPlaceholderVisibility &&
!nsContentUtils::ShowInputPlaceholderOnFocus()) {
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
mPlaceholderVisibility = !nsContentUtils::IsFocusedContent(content);
}