Bug 1541253 - Check PresShell::IsUnderHiddenEmbedderElement where we need to check CSS visibility state across the document boundary. r=tnikkel

Depends on D26252

Differential Revision: https://phabricator.services.mozilla.com/D26253

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2019-05-10 11:22:28 +00:00
Родитель a7b7f105b5
Коммит ddb35d3718
2 изменённых файлов: 12 добавлений и 6 удалений

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

@ -315,13 +315,19 @@ uint64_t Accessible::VisibilityState() const {
return states::INVISIBLE;
}
// Walk the parent frame chain to see if there's invisible parent or the frame
// is in background tab.
if (!frame->StyleVisibility()->IsVisible()) return states::INVISIBLE;
// It's invisible if the presshell is hidden by a visibility:hidden element in
// an ancestor document.
if (frame->PresShell()->IsUnderHiddenEmbedderElement()) {
return states::INVISIBLE;
}
// Offscreen state if the document's visibility state is not visible.
if (Document()->IsHidden()) return states::OFFSCREEN;
// Walk the parent frame chain to see if the frame is in background tab or
// scrolled out.
nsIFrame* curFrame = frame;
do {
nsView* view = curFrame->GetView();
@ -366,8 +372,6 @@ uint64_t Accessible::VisibilityState() const {
if (!parentFrame) {
parentFrame = nsLayoutUtils::GetCrossDocParentFrame(curFrame);
if (parentFrame && !parentFrame->StyleVisibility()->IsVisible())
return states::INVISIBLE;
}
curFrame = parentFrame;

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

@ -393,6 +393,10 @@ bool nsIFrame::IsVisibleConsideringAncestors(uint32_t aFlags) const {
return false;
}
if (PresShell()->IsUnderHiddenEmbedderElement()) {
return false;
}
const nsIFrame* frame = this;
while (frame) {
nsView* view = frame->GetView();
@ -416,8 +420,6 @@ bool nsIFrame::IsVisibleConsideringAncestors(uint32_t aFlags) const {
break;
}
if (!parent->StyleVisibility()->IsVisible()) return false;
frame = parent;
}
}