Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2810503002: Only store previous clip rects for PaintLayers that support subsequences. (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
+ 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();

Powered by Google App Engine
This is Rietveld 408576698