Bug 1377752 - part2: Selection::NotifySelectionListeners() should make nsFocusManager not scroll new focused element into the view if it's not focused document r=smaug

When changing selection into a contenteditable element in non-focused document, new focused editor shouldn't be scrolled into the view for compatibility with the other browsers.

MozReview-Commit-ID: FabqizyJrPW

--HG--
extra : rebase_source : 5bd2a017ec4c4f4fc0a6f7644fba2769b3ffca2c
This commit is contained in:
Masayuki Nakano 2017-07-05 21:35:18 +09:00
Родитель ef6bac5b7b
Коммит f83bc98f97
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -3734,8 +3734,13 @@ Selection::NotifySelectionListeners()
nsCOMPtr<nsIDOMElement> domElementToFocus =
do_QueryInterface(newEditingHost->AsDOMNode());
// Note that don't steal focus from focused window if the window doesn't
// have focus.
fm->SetFocus(domElementToFocus, nsIFocusManager::FLAG_NOSWITCHFRAME);
// have focus and if the window isn't focused window, shouldn't be
// scrolled to the new focused element.
uint32_t flags = nsIFocusManager::FLAG_NOSWITCHFRAME;
if (focusedWindow != fm->GetFocusedWindow()) {
flags |= nsIFocusManager::FLAG_NOSCROLL;
}
fm->SetFocus(domElementToFocus, flags);
}
}
}