Skip to content

Commit

Permalink
[CompositeAfterPaint] Disable some compositing input update code in P…
Browse files Browse the repository at this point in the history
…aintLayer

This marks code for future removal, and avoids crash on unexpected
compositing input update flag.

Change-Id: I16086f5a2e3541a4d4930a9f8282ed2b3e2c8b66
Reviewed-on: https://chromium-review.googlesource.com/c/1383044
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#617907}
  • Loading branch information
wangxianzhu authored and Commit Bot committed Dec 19, 2018
1 parent 30a04d4 commit 42d175e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
16 changes: 12 additions & 4 deletions third_party/blink/renderer/core/paint/paint_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ PaintLayer::PaintLayer(LayoutBoxModelObject& layout_object)
#endif
has3d_transformed_descendant_(false),
contains_dirty_overlay_scrollbars_(false),
needs_ancestor_dependent_compositing_inputs_update_(true),
child_needs_compositing_inputs_update_(true),
needs_ancestor_dependent_compositing_inputs_update_(
!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()),
child_needs_compositing_inputs_update_(
!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()),
has_compositing_descendant_(false),
should_isolate_composited_descendants_(false),
lost_grouped_mapping_(false),
Expand All @@ -167,7 +169,8 @@ PaintLayer::PaintLayer(LayoutBoxModelObject& layout_object)
filter_on_effect_node_dirty_(false),
is_under_svg_hidden_container_(false),
descendant_has_direct_or_scrolling_compositing_reason_(false),
needs_compositing_reasons_update_(true),
needs_compositing_reasons_update_(
!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()),
descendant_may_need_compositing_requirements_update_(false),
needs_compositing_layer_assignment_(false),
descendant_needs_compositing_layer_assignment_(false),
Expand Down Expand Up @@ -1054,12 +1057,15 @@ void PaintLayer::SetNeedsCompositingInputsUpdate() {

// TODO(chrishtr): These are a bit of a heavy hammer, because not all
// things which require compositing inputs update require a descendant-
// dependent flags udpate. Reduce call sites after CAP launch allows
// dependent flags update. Reduce call sites after CAP launch allows
/// removal of CompositingInputsUpdater.
MarkAncestorChainForDescendantDependentFlagsUpdate();
}

void PaintLayer::SetNeedsCompositingInputsUpdateInternal() {
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;

needs_ancestor_dependent_compositing_inputs_update_ = true;

for (PaintLayer* current = this;
Expand All @@ -1075,11 +1081,13 @@ void PaintLayer::SetNeedsCompositingInputsUpdateInternal() {

void PaintLayer::UpdateAncestorDependentCompositingInputs(
const AncestorDependentCompositingInputs& compositing_inputs) {
DCHECK(!RuntimeEnabledFeatures::CompositeAfterPaintEnabled());
EnsureAncestorDependentCompositingInputs() = compositing_inputs;
needs_ancestor_dependent_compositing_inputs_update_ = false;
}

void PaintLayer::ClearChildNeedsCompositingInputsUpdate() {
DCHECK(!RuntimeEnabledFeatures::CompositeAfterPaintEnabled());
DCHECK(!NeedsCompositingInputsUpdate());
child_needs_compositing_inputs_update_ = false;
}
Expand Down
15 changes: 13 additions & 2 deletions third_party/blink/renderer/core/paint/paint_layer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,8 @@ TEST_P(PaintLayerTest, BackgroundIsKnownToBeOpaqueInRectChildren) {
LayoutRect(0, 0, 100, 100), false));
}

TEST_P(PaintLayerTest, ChangeAlphaNeedsCompositingInputs) {
TEST_P(PaintLayerTest,
ChangeAlphaNeedsCompositingInputsAndPaintPropertyUpdate) {
SetBodyInnerHTML(R"HTML(
<style>
#target {
Expand All @@ -1756,10 +1757,20 @@ TEST_P(PaintLayerTest, ChangeAlphaNeedsCompositingInputs) {
</div>
)HTML");
PaintLayer* target = GetPaintLayerByElementId("target");
EXPECT_FALSE(target->NeedsCompositingInputsUpdate());
EXPECT_FALSE(target->GetLayoutObject().NeedsPaintPropertyUpdate());
EXPECT_FALSE(target->Parent()->GetLayoutObject().NeedsPaintPropertyUpdate());

StyleDifference diff;
diff.SetHasAlphaChanged();
target->StyleDidChange(diff, target->GetLayoutObject().Style());
EXPECT_TRUE(target->NeedsCompositingInputsUpdate());
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
EXPECT_FALSE(target->NeedsCompositingInputsUpdate());
else
EXPECT_TRUE(target->NeedsCompositingInputsUpdate());
EXPECT_TRUE(target->GetLayoutObject().NeedsPaintPropertyUpdate());
// See the TODO in PaintLayer::SetNeedsCompositingInputsUpdate().
EXPECT_TRUE(target->Parent()->GetLayoutObject().NeedsPaintPropertyUpdate());
}

} // namespace blink
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ Bug(none) compositing/overflow/scroll-parent-with-non-stacking-context-composite
Bug(none) compositing/overflow/scrollbar-layer-placement.html [ Failure ]
Bug(none) compositing/overflow/scrollbar-layer-placement-negative-z-index-child.html [ Failure ]
Bug(none) compositing/overflow/scrolling-content-clip-to-viewport.html [ Failure ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to-nested.html [ Failure Crash ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to-transform.html [ Failure Crash ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to.html [ Failure Crash ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to-nested.html [ Failure ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to-transform.html [ Failure ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to.html [ Failure ]
Bug(none) compositing/overflow/textarea-scroll-touch.html [ Failure ]
Bug(none) compositing/overflow/universal-accelerated-overflow-scroll.html [ Failure ]
Bug(none) compositing/reflections/deeply-nested-reflections.html [ Failure Crash ]
Bug(none) compositing/reflections/nested-reflection-mask-change.html [ Failure Crash ]
Bug(none) compositing/reflections/deeply-nested-reflections.html [ Failure ]
Bug(none) compositing/reflections/nested-reflection-mask-change.html [ Failure ]
Bug(none) compositing/rtl/rtl-absolute-overflow-scrolled.html [ Failure Crash ]
Bug(none) compositing/rtl/rtl-absolute-overflow.html [ Failure Crash ]
Bug(none) compositing/rtl/rtl-fixed-overflow-scrolled.html [ Failure Crash ]
Expand Down

0 comments on commit 42d175e

Please sign in to comment.