Chromium Code Reviews| 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..f4dbd7a873940213128c238e3db75b8c52c7fa06 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,27 @@ 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. |
|
pdr.
2017/04/13 16:21:45
Nit: Remove the line "SVG is also painted atomical
|
| + if (!PaintLayerStackingNodeIterator(*StackingNode(), kAllChildren).Next()) |
| + return false; |
| + |
| + DCHECK(!Parent() || Parent()->needs_descendant_dependent_flags_update_ || |
| + Parent()->HasDescendantThatSupportsSubsequenceCaching()); |
| + |
| + return true; |
| +} |
| + |
| ScrollingCoordinator* PaintLayer::GetScrollingCoordinator() { |
| Page* page = GetLayoutObject().GetFrame()->GetPage(); |
| return (!page) ? nullptr : page->GetScrollingCoordinator(); |