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 928cee186db1a94e3ed147303b1a3329c249bab8..17f4037c209a9477ba4e038c481af6dd9387c152 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), |
| @@ -686,6 +687,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()) { |
| @@ -701,6 +703,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() && |
| @@ -2749,6 +2755,24 @@ bool PaintLayer::PaintsWithTransform( |
| GetCompositingState() != kPaintsIntoOwnBacking); |
| } |
| +bool PaintLayer::SupportsSubsequenceCaching() const { |
|
pdr.
2017/04/12 18:40:06
Can you add a DCHECK in SubsequenceRecorder that S
chrishtr
2017/04/13 02:05:59
Done.
|
| + // 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; |
| + |
| + return true; |
| +} |
| + |
| bool PaintLayer::CompositesWithTransform() const { |
| return TransformAncestor() || Transform(); |
| } |