Bug 1754437. Optimize FindViewContaining to avoid calling IsVisibleConsideringAncestors more often. r=emilio

Calling IsActive is quick, IsVisibleConsideringAncestors is not so quick.

If IsActive is false then that almost certainly means we'd hit the "not in the selected box of a deck frame" case in IsVisibleConsideringAncestors at

https://searchfox.org/mozilla-central/rev/b697834e78a3ef7613e2fa57c07624b1d9d1c909/layout/generic/nsIFrame.cpp#412

Differential Revision: https://phabricator.services.mozilla.com/D138291
This commit is contained in:
Timothy Nikkel 2022-02-15 08:34:14 +00:00
Родитель 8afd3c5af5
Коммит d8a1ca407e
1 изменённых файлов: 3 добавлений и 3 удалений

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

@ -5573,9 +5573,9 @@ static nsView* FindViewContaining(nsView* aRelativeToView,
nsIFrame* frame = aView->GetFrame();
if (frame) {
if (!frame->IsVisibleConsideringAncestors(
nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY) ||
!frame->PresShell()->IsActive()) {
if (!frame->PresShell()->IsActive() ||
!frame->IsVisibleConsideringAncestors(
nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY)) {
return nullptr;
}