Commit 511e3d59 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Rebuild parent frame GraphicsLayers if a subframe has dirty root layer attachment

When a frame rebuilds its GraphicsLayer tree, we mark its root layer
attachment dirty. Previously when we updated GraphicsLayer tree of the
parent frame and saw a subframe had the flag, we forced rebuild of the
parent frame's GraphicsLayerTree. However, if the parent frame didn't
have any compositing update flag set, we wouldn't do GraphicsLayer tree
update, and the subframe's root layer would be left detached.

Now check child frame's root layer attachment dirty flag when we walk
the frame tree, which is unconditional, and set the parent layer
needing rebuild GraphicsLayer tree if any child frame has the flag set.

Haven't created a simple test case for the bug. It happens as the
following:
1. Some change in a subframe happens, requiring paint property update,
   but not compositing input update.
2. During paint property update, we mark the subframe's compositor
   needing compositing update.
3. During compositing update for the subframe, we rebuild the
   GraphicsLayer subtree and set the root layer attachment dirty.
4. Previously, as the parent frame didn't have any compositing flag
   set, the subframe's GraphicsLayer was left unattached.
   Now we force the parent frame to rebuild GraphicsLayer tree.

Bug: 1142725
Change-Id: I11bd1839cf410aec4dd1e4ae87e9df32de9d210b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522877Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825046}
parent ab9aff5a
......@@ -146,15 +146,6 @@ void GraphicsLayerUpdater::UpdateRecursive(
}
}
if (auto* embedded =
DynamicTo<LayoutEmbeddedContent>(layer.GetLayoutObject())) {
if (PaintLayerCompositor* inner_compositor =
PaintLayerCompositor::FrameContentsCompositor(*embedded)) {
if (inner_compositor->RootLayerAttachmentDirty())
needs_rebuild_tree_ = true;
}
}
PaintLayer* first_child = layer.FirstChild();
// If we have children but the update is blocked, then we should clear the
// first child to block recursion.
......
......@@ -216,10 +216,11 @@ void PaintLayerCompositor::UpdateAssignmentsIfNeededRecursiveInternal(
// TODO(bbudge) Remove this check when trusted Pepper plugins are gone.
if (local_frame->GetDocument()->IsActive() &&
local_frame->ContentLayoutObject()) {
local_frame->ContentLayoutObject()
->Compositor()
->UpdateAssignmentsIfNeededRecursiveInternal(
target_state, compositing_reasons_stats);
auto* child_compositor = local_frame->ContentLayoutObject()->Compositor();
child_compositor->UpdateAssignmentsIfNeededRecursiveInternal(
target_state, compositing_reasons_stats);
if (child_compositor->root_layer_attachment_dirty_)
SetNeedsCompositingUpdate(kCompositingUpdateRebuildTree);
}
}
......
......@@ -129,7 +129,6 @@ class CORE_EXPORT PaintLayerCompositor {
// Whether the layer could ever be composited.
bool CanBeComposited(const PaintLayer*) const;
bool RootLayerAttachmentDirty() const { return root_layer_attachment_dirty_; }
void ClearRootLayerAttachmentDirty() { root_layer_attachment_dirty_ = false; }
// FIXME: Move allocateOrClearCompositedLayerMapping to
......
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