Bug 1697580 - Remove special case for offscreen browsers in nsFocusManager. r=smacleod,hsivonen

Offscreen browsers are no longer a thing.

We should just check whether the frame is focusable, which will check
visibility for us instead on relying on IsWindowVisible looking up the
docshell tree.

Depends on D107888

Differential Revision: https://phabricator.services.mozilla.com/D107889
This commit is contained in:
Emilio Cobos Álvarez
2021-03-15 21:00:10 +00:00
parent fd402a9a90
commit 985ce7e5c4

View File

@@ -2104,21 +2104,6 @@ Element* nsFocusManager::FlushAndCheckIfFocusable(Element* aElement,
}
}
// if this is a child frame content node, check if it is visible and
// call the content node's IsFocusable method instead of the frame's
// IsFocusable method. This skips checking the style system and ensures that
// offscreen browsers can still be focused.
Document* subdoc = doc->GetSubDocumentFor(aElement);
if (subdoc && IsWindowVisible(subdoc->GetWindow())) {
const nsStyleUI* ui = frame->StyleUI();
int32_t tabIndex = (ui->mUserFocus == StyleUserFocus::Ignore ||
ui->mUserFocus == StyleUserFocus::None)
? -1
: 0;
return aElement->IsFocusable(&tabIndex, aFlags & FLAG_BYMOUSE) ? aElement
: nullptr;
}
return frame->IsFocusable(aFlags & FLAG_BYMOUSE) ? aElement : nullptr;
}