Commit aa6b82a5 authored by Daniel Libby's avatar Daniel Libby Committed by Commit Bot

Remove DisableCompositingQueryAsserts from PaintLayer codepaths

These three locations in code all have a DisableCompositingQueryAsserts
disabler in order to query some compositing state. However, none of
these operations are necessary in CompositeAfterPaint.

In PaintLayer destructor, we won't have a composited layer mapping to
clear in CAP. Enforce callers of ClearCompositedLayerMapping to have
ensured that HasCompositedLayerMapping is true, clean up an unnecessary
CAP check and more tightly scope the DisableCompositingQueryAssert to
this function.

PaintLayer::StyleDidChange queries compositing state to determine
whether or not to call SetNeedsCompositingInputsUpdate. That method is
a no-op in CAP.

PaintLayer::DirtyStackingContextZOrderLists queries compositing state
in order to mark the AncestorStackingContext's CompositedLayerMapping
as needing a graphics layer update, which also is not needed in CAP.

Bug: 1007989
Change-Id: I552b348a3bc4d6da196eaad90b05e25a6b470c97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129090
Commit-Queue: Daniel Libby <dlibby@microsoft.com>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756315}
parent 34ce1481
...@@ -221,10 +221,8 @@ PaintLayer::~PaintLayer() { ...@@ -221,10 +221,8 @@ PaintLayer::~PaintLayer() {
// Child layers will be deleted by their corresponding layout objects, so // Child layers will be deleted by their corresponding layout objects, so
// we don't need to delete them ourselves. // we don't need to delete them ourselves.
{ if (HasCompositedLayerMapping())
DisableCompositingQueryAsserts disabler;
ClearCompositedLayerMapping(true); ClearCompositedLayerMapping(true);
}
// Reset this flag before disposing scrollable_area_ to prevent // Reset this flag before disposing scrollable_area_ to prevent
// PaintLayerScrollableArea::WillRemoveScrollbar() from dirtying the z-order // PaintLayerScrollableArea::WillRemoveScrollbar() from dirtying the z-order
...@@ -2762,26 +2760,24 @@ void PaintLayer::EnsureCompositedLayerMapping() { ...@@ -2762,26 +2760,24 @@ void PaintLayer::EnsureCompositedLayerMapping() {
} }
void PaintLayer::ClearCompositedLayerMapping(bool layer_being_destroyed) { void PaintLayer::ClearCompositedLayerMapping(bool layer_being_destroyed) {
if (!HasCompositedLayerMapping()) DCHECK(HasCompositedLayerMapping());
return; DCHECK(!RuntimeEnabledFeatures::CompositeAfterPaintEnabled());
DisableCompositingQueryAsserts disabler;
if (layer_being_destroyed) { if (layer_being_destroyed) {
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) { // The visual rects will be in a different coordinate space after losing
// The visual rects will be in a different coordinate space after losing // their compositing container. Clear them before prepaint to avoid
// their compositing container. Clear them before prepaint to avoid // spurious layout shift reports from LayoutShiftTracker.
// spurious layout shift reports from LayoutShiftTracker. // If the PaintLayer were not being destroyed, this would happen during
// If the PaintLayer were not being destroyed, this would happen during // the compositing update (PaintLayerCompositor::UpdateIfNeeded).
// the compositing update (PaintLayerCompositor::UpdateIfNeeded). // TODO: LayoutShiftTracker's reliance on having visual rects cleared
// TODO: LayoutShiftTracker's reliance on having visual rects cleared // before prepaint in the case of compositing changes is not ideal, and
// before prepaint in the case of compositing changes is not ideal, and // will not work with CompositeAfterPaint. Some transform tree changes may
// will not work with CompositeAfterPaint. Some transform tree changes may // still produce incorrect behavior from LayoutShiftTracker (see
// still produce incorrect behavior from LayoutShiftTracker (see // discussion on review thread of http://crrev.com/c/1636403).
// discussion on review thread of http://crrev.com/c/1636403). if (Compositor()) {
if (Compositor()) { Compositor()->ForceRecomputeVisualRectsIncludingNonCompositingDescendants(
Compositor() layout_object_);
->ForceRecomputeVisualRectsIncludingNonCompositingDescendants(
layout_object_);
}
} }
} else { } else {
// We need to make sure our decendants get a geometry update. In principle, // We need to make sure our decendants get a geometry update. In principle,
...@@ -3154,7 +3150,7 @@ void PaintLayer::StyleDidChange(StyleDifference diff, ...@@ -3154,7 +3150,7 @@ void PaintLayer::StyleDidChange(StyleDifference diff,
if (diff.CompositingReasonsChanged()) { if (diff.CompositingReasonsChanged()) {
SetNeedsCompositingInputsUpdate(); SetNeedsCompositingInputsUpdate();
} else { } else if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
// For querying stale GetCompositingState(). // For querying stale GetCompositingState().
DisableCompositingQueryAsserts disable; DisableCompositingQueryAsserts disable;
...@@ -3479,13 +3475,15 @@ void PaintLayer::DirtyStackingContextZOrderLists() { ...@@ -3479,13 +3475,15 @@ void PaintLayer::DirtyStackingContextZOrderLists() {
if (!stacking_context) if (!stacking_context)
return; return;
// This invalidation code intentionally refers to stale state. if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
DisableCompositingQueryAsserts disabler; // This invalidation code intentionally refers to stale state.
DisableCompositingQueryAsserts disabler;
// Changes of stacking may result in graphics layers changing size // Changes of stacking may result in graphics layers changing size
// due to new contents painting into them. // due to new contents painting into them.
if (auto* mapping = stacking_context->GetCompositedLayerMapping()) if (auto* mapping = stacking_context->GetCompositedLayerMapping())
mapping->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree); mapping->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree);
}
if (stacking_context->StackingNode()) if (stacking_context->StackingNode())
stacking_context->StackingNode()->DirtyZOrderLists(); stacking_context->StackingNode()->DirtyZOrderLists();
......
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