зеркало из https://github.com/mozilla/gecko-dev.git
Bug 712130 - Simplify focus stealing prevention for autofocus. r=bz
Remove redundant check already implied by earlier condition: If the focus manager's focused content is in our document, all parent windows including the root window must have their focused node set to non-null. MozReview-Commit-ID: CryGb6mfczK --HG-- extra : rebase_source : c16e73b159be0fd82da624ab971f6b026eb01ae6
This commit is contained in:
Родитель
222776c45b
Коммит
8224ce038d
|
@ -9982,27 +9982,14 @@ public:
|
|||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (!fm) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsIDocument* document = mElement->OwnerDoc();
|
||||
|
||||
// Don't steal focus from the user.
|
||||
if (mRootWindow->GetFocusedNode()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If something is focused in the same document, ignore autofocus.
|
||||
if (!fm->GetFocusedContent() ||
|
||||
fm->GetFocusedContent()->OwnerDoc() != document) {
|
||||
mozilla::ErrorResult rv;
|
||||
mElement->Focus(rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
mozilla::ErrorResult rv;
|
||||
mElement->Focus(rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
private:
|
||||
nsCOMPtr<Element> mElement;
|
||||
|
|
Загрузка…
Ссылка в новой задаче