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,11 +2760,11 @@ void PaintLayer::EnsureCompositedLayerMapping() { ...@@ -2762,11 +2760,11 @@ 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.
...@@ -2778,11 +2776,9 @@ void PaintLayer::ClearCompositedLayerMapping(bool layer_being_destroyed) { ...@@ -2778,11 +2776,9 @@ void PaintLayer::ClearCompositedLayerMapping(bool layer_being_destroyed) {
// 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() Compositor()->ForceRecomputeVisualRectsIncludingNonCompositingDescendants(
->ForceRecomputeVisualRectsIncludingNonCompositingDescendants(
layout_object_); 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,
// we could call setNeedsGraphicsLayerUpdate on our children, but that would // we could call setNeedsGraphicsLayerUpdate on our children, but that would
...@@ -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,6 +3475,7 @@ void PaintLayer::DirtyStackingContextZOrderLists() { ...@@ -3479,6 +3475,7 @@ void PaintLayer::DirtyStackingContextZOrderLists() {
if (!stacking_context) if (!stacking_context)
return; return;
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
// This invalidation code intentionally refers to stale state. // This invalidation code intentionally refers to stale state.
DisableCompositingQueryAsserts disabler; DisableCompositingQueryAsserts disabler;
...@@ -3486,6 +3483,7 @@ void PaintLayer::DirtyStackingContextZOrderLists() { ...@@ -3486,6 +3483,7 @@ void PaintLayer::DirtyStackingContextZOrderLists() {
// 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