Commit c5c632e5 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Temporarily disable composited scrolling optimization for css-clip/clip-path

This is to evaluate the performance improvement of the optimization in
1 or 2 canary builds. Will revert after that.

This disables the optimization for composited scrolling added in
crrev.com/774232.

Bug 1113269

Change-Id: I2cf85fd5e550c1fef7d29f76b90e5d1b7219d579
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353066
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797532}
parent 8266ff12
......@@ -126,6 +126,11 @@ LayoutBoxModelObject::ComputeBackgroundPaintLocationIfComposited() const {
return kBackgroundPaintInScrollingContents;
}
// TODO(crbug.com/1113269): Temporarily disable composited scrolling for
// clipped layers.
if (HasClip())
return kBackgroundPaintInGraphicsLayer;
// Inset box shadow is painted in the scrolling area above the background, and
// it doesn't scroll, so the background can only be painted in the main layer.
if (HasInsetBoxShadow(StyleRef()))
......
......@@ -397,10 +397,13 @@ TEST_F(NonCompositedMainThreadScrollingReasonsTest,
cc::MainThreadScrollingReason::kCantPaintScrollingBackgroundAndLCDText);
}
#if 0
// TODO(crbug.com/1113269): Temporarily disabled.
TEST_F(NonCompositedMainThreadScrollingReasonsTest, ClipTest) {
TestNonCompositedReasons("clip",
cc::MainThreadScrollingReason::kNotScrollingOnMain);
}
#endif
TEST_F(NonCompositedMainThreadScrollingReasonsTest, ClipPathTest) {
TestNonCompositedReasons(
......
......@@ -165,6 +165,7 @@ PaintLayer::PaintLayer(LayoutBoxModelObject& layout_object)
previous_paint_result_(kFullyPainted),
needs_paint_phase_descendant_outlines_(false),
needs_paint_phase_float_(false),
has_descendant_with_clip_path_(false),
has_non_isolated_descendant_with_blend_mode_(false),
has_fixed_position_descendant_(false),
has_sticky_position_descendant_(false),
......@@ -611,6 +612,7 @@ void PaintLayer::UpdateDescendantDependentFlags() {
has_non_isolated_descendant_with_blend_mode_;
has_visible_descendant_ = false;
has_non_isolated_descendant_with_blend_mode_ = false;
has_descendant_with_clip_path_ = false;
has_fixed_position_descendant_ = false;
has_sticky_position_descendant_ = false;
has_non_contained_absolute_position_descendant_ = false;
......@@ -644,6 +646,9 @@ void PaintLayer::UpdateDescendantDependentFlags() {
child->HasNonIsolatedDescendantWithBlendMode()) ||
child_style.HasBlendMode();
has_descendant_with_clip_path_ |= child->HasDescendantWithClipPath() ||
child->GetLayoutObject().HasClipPath();
has_fixed_position_descendant_ |=
child->HasFixedPositionDescendant() ||
child_style.GetPosition() == EPosition::kFixed;
......
......@@ -895,6 +895,11 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
const PaintLayer* MaskAncestor() const {
return GetAncestorDependentCompositingInputs().mask_ancestor;
}
// TODO(crbug.com/1113269): Temporary.
bool HasDescendantWithClipPath() const {
DCHECK(!needs_descendant_dependent_flags_update_);
return has_descendant_with_clip_path_;
}
bool HasFixedPositionDescendant() const {
DCHECK(!needs_descendant_dependent_flags_update_);
return has_fixed_position_descendant_;
......@@ -1348,6 +1353,9 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
unsigned needs_paint_phase_descendant_outlines_ : 1;
unsigned needs_paint_phase_float_ : 1;
// TODO(crbug.com/1113269): Temporary.
unsigned has_descendant_with_clip_path_ : 1;
// These bitfields are part of ancestor/descendant dependent compositing
// inputs.
unsigned has_non_isolated_descendant_with_blend_mode_ : 1;
......
......@@ -2616,6 +2616,15 @@ bool PaintLayerScrollableArea::ComputeNeedsCompositedScrollingInternal(
}
}
// TODO(crbug.com/1113269): Temporary.
if (box->HasClip() || layer_->HasDescendantWithClipPath() ||
!!layer_->ClipPathAncestor()) {
non_composited_main_thread_scrolling_reasons_ |=
// Just a random flag to disable composited scrolling.
cc::MainThreadScrollingReason::kCantPaintScrollingBackgroundAndLCDText;
needs_composited_scrolling = false;
}
DCHECK(!(non_composited_main_thread_scrolling_reasons_ &
~cc::MainThreadScrollingReason::kNonCompositedReasons));
return needs_composited_scrolling;
......
......@@ -319,7 +319,8 @@ TEST_P(PaintLayerScrollableAreaTest,
GetBackgroundPaintLocation("scroller15"));
// css-clip doesn't affect background paint location.
EXPECT_EQ(kBackgroundPaintInScrollingContents,
// TODO(crbug.com/1113269): Temporary.
EXPECT_EQ(kBackgroundPaintInGraphicsLayer,
GetBackgroundPaintLocation("css-clip"));
// #scroller17 can only be painted once as it is translucent, and it must
......
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