Commit 0562928d authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Return true from IsElementInInvisibleSubTree if root element is not rendered

This can happen if the image is in a frame that is itself invisible,
due to for example the <iframe> element owning the Frame being
display:none. In such cases the documentElement has no layout.

Bug: 1129979

Change-Id: Ic6557c936395ce539be96d255ba4f29a10b5790b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444436Reviewed-by: default avatarScott Little <sclittle@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813217}
parent 73ea038c
......@@ -84,8 +84,12 @@ bool IsElementInInvisibleSubTree(const Element& element) {
return true;
for (Node& ancestor : FlatTreeTraversal::InclusiveAncestorsOf(element)) {
auto* ancestor_element = DynamicTo<Element>(ancestor);
if (!ancestor_element)
if (!ancestor_element) {
// Return true if the whole frame is not rendered.
if (ancestor.IsDocumentNode() && !ancestor.GetLayoutObject())
return true;
continue;
}
const ComputedStyle* style = ancestor_element->EnsureComputedStyle();
if (style && (style->Visibility() != EVisibility::kVisible ||
style->Display() == EDisplay::kNone)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment