| Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| index 2736ebb03cb8a76dc7c9d136bdc40fd8f0963dc7..92a09d8bd466204ed1768d87c1fe0f3f63a12690 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| @@ -157,6 +157,7 @@ PaintLayer::PaintLayer(LayoutBoxModelObject& layout_object)
|
| has_descendant_with_clip_path_(false),
|
| has_non_isolated_descendant_with_blend_mode_(false),
|
| has_ancestor_with_clip_path_(false),
|
| + has_descendant_that_supports_subsequence_caching_(false),
|
| self_painting_status_changed_(false),
|
| layout_object_(layout_object),
|
| parent_(0),
|
| @@ -685,6 +686,7 @@ void PaintLayer::UpdateDescendantDependentFlags() {
|
| has_visible_descendant_ = false;
|
| has_non_isolated_descendant_with_blend_mode_ = false;
|
| has_descendant_with_clip_path_ = false;
|
| + has_descendant_that_supports_subsequence_caching_ = false;
|
|
|
| for (PaintLayer* child = FirstChild(); child;
|
| child = child->NextSibling()) {
|
| @@ -700,6 +702,10 @@ void PaintLayer::UpdateDescendantDependentFlags() {
|
|
|
| has_descendant_with_clip_path_ |= child->HasDescendantWithClipPath() ||
|
| child->GetLayoutObject().HasClipPath();
|
| +
|
| + has_descendant_that_supports_subsequence_caching_ |=
|
| + child->HasDescendantThatSupportsSubsequenceCaching() ||
|
| + child->SupportsSubsequenceCaching();
|
| }
|
|
|
| if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() &&
|
| @@ -2748,6 +2754,26 @@ bool PaintLayer::PaintsWithTransform(
|
| GetCompositingState() != kPaintsIntoOwnBacking);
|
| }
|
|
|
| +bool PaintLayer::SupportsSubsequenceCaching() const {
|
| + // SVG paints atomically.
|
| + if (GetLayoutObject().IsSVGRoot())
|
| + return true;
|
| +
|
| + // Create subsequence for only stacking contexts whose painting are atomic.
|
| + if (!StackingNode()->IsStackingContext())
|
| + return false;
|
| +
|
| + // The layer doesn't have children. Subsequence caching is not worth it,
|
| + // because normally the actual painting will be cheap.
|
| + // SVG is also painted atomically.
|
| + if (!PaintLayerStackingNodeIterator(*StackingNode(), kAllChildren).Next())
|
| + return false;
|
| +
|
| + DCHECK(!Parent() || Parent()->HasDescendantThatSupportsSubsequenceCaching());
|
| +
|
| + return true;
|
| +}
|
| +
|
| ScrollingCoordinator* PaintLayer::GetScrollingCoordinator() {
|
| Page* page = GetLayoutObject().GetFrame()->GetPage();
|
| return (!page) ? nullptr : page->GetScrollingCoordinator();
|
|
|