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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 previous_paint_result_(kFullyPainted), 150 previous_paint_result_(kFullyPainted),
151 needs_paint_phase_descendant_outlines_(false), 151 needs_paint_phase_descendant_outlines_(false),
152 previous_paint_phase_descendant_outlines_was_empty_(false), 152 previous_paint_phase_descendant_outlines_was_empty_(false),
153 needs_paint_phase_float_(false), 153 needs_paint_phase_float_(false),
154 previous_paint_phase_float_was_empty_(false), 154 previous_paint_phase_float_was_empty_(false),
155 needs_paint_phase_descendant_block_backgrounds_(false), 155 needs_paint_phase_descendant_block_backgrounds_(false),
156 previous_paint_phase_descendant_block_backgrounds_was_empty_(false), 156 previous_paint_phase_descendant_block_backgrounds_was_empty_(false),
157 has_descendant_with_clip_path_(false), 157 has_descendant_with_clip_path_(false),
158 has_non_isolated_descendant_with_blend_mode_(false), 158 has_non_isolated_descendant_with_blend_mode_(false),
159 has_ancestor_with_clip_path_(false), 159 has_ancestor_with_clip_path_(false),
160 has_descendant_that_supports_subsequence_caching_(false),
160 self_painting_status_changed_(false), 161 self_painting_status_changed_(false),
161 layout_object_(layout_object), 162 layout_object_(layout_object),
162 parent_(0), 163 parent_(0),
163 previous_(0), 164 previous_(0),
164 next_(0), 165 next_(0),
165 first_(0), 166 first_(0),
166 last_(0), 167 last_(0),
167 static_inline_position_(0), 168 static_inline_position_(0),
168 static_block_position_(0), 169 static_block_position_(0),
169 ancestor_overflow_layer_(nullptr) { 170 ancestor_overflow_layer_(nullptr) {
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 679 }
679 } 680 }
680 681
681 void PaintLayer::UpdateDescendantDependentFlags() { 682 void PaintLayer::UpdateDescendantDependentFlags() {
682 if (needs_descendant_dependent_flags_update_) { 683 if (needs_descendant_dependent_flags_update_) {
683 bool old_has_non_isolated_descendant_with_blend_mode = 684 bool old_has_non_isolated_descendant_with_blend_mode =
684 has_non_isolated_descendant_with_blend_mode_; 685 has_non_isolated_descendant_with_blend_mode_;
685 has_visible_descendant_ = false; 686 has_visible_descendant_ = false;
686 has_non_isolated_descendant_with_blend_mode_ = false; 687 has_non_isolated_descendant_with_blend_mode_ = false;
687 has_descendant_with_clip_path_ = false; 688 has_descendant_with_clip_path_ = false;
689 has_descendant_that_supports_subsequence_caching_ = false;
688 690
689 for (PaintLayer* child = FirstChild(); child; 691 for (PaintLayer* child = FirstChild(); child;
690 child = child->NextSibling()) { 692 child = child->NextSibling()) {
691 child->UpdateDescendantDependentFlags(); 693 child->UpdateDescendantDependentFlags();
692 694
693 if (child->has_visible_content_ || child->has_visible_descendant_) 695 if (child->has_visible_content_ || child->has_visible_descendant_)
694 has_visible_descendant_ = true; 696 has_visible_descendant_ = true;
695 697
696 has_non_isolated_descendant_with_blend_mode_ |= 698 has_non_isolated_descendant_with_blend_mode_ |=
697 (!child->StackingNode()->IsStackingContext() && 699 (!child->StackingNode()->IsStackingContext() &&
698 child->HasNonIsolatedDescendantWithBlendMode()) || 700 child->HasNonIsolatedDescendantWithBlendMode()) ||
699 child->GetLayoutObject().StyleRef().HasBlendMode(); 701 child->GetLayoutObject().StyleRef().HasBlendMode();
700 702
701 has_descendant_with_clip_path_ |= child->HasDescendantWithClipPath() || 703 has_descendant_with_clip_path_ |= child->HasDescendantWithClipPath() ||
702 child->GetLayoutObject().HasClipPath(); 704 child->GetLayoutObject().HasClipPath();
705
706 has_descendant_that_supports_subsequence_caching_ |=
707 child->HasDescendantThatSupportsSubsequenceCaching() ||
708 child->SupportsSubsequenceCaching();
703 } 709 }
704 710
705 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && 711 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() &&
706 old_has_non_isolated_descendant_with_blend_mode != 712 old_has_non_isolated_descendant_with_blend_mode !=
707 static_cast<bool>(has_non_isolated_descendant_with_blend_mode_)) 713 static_cast<bool>(has_non_isolated_descendant_with_blend_mode_))
708 GetLayoutObject().SetNeedsPaintPropertyUpdate(); 714 GetLayoutObject().SetNeedsPaintPropertyUpdate();
709 needs_descendant_dependent_flags_update_ = false; 715 needs_descendant_dependent_flags_update_ = false;
710 } 716 }
711 717
712 bool previously_has_visible_content = has_visible_content_; 718 bool previously_has_visible_content = has_visible_content_;
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || 2747 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) ||
2742 GetCompositingState() != kPaintsIntoOwnBacking); 2748 GetCompositingState() != kPaintsIntoOwnBacking);
2743 } 2749 }
2744 2750
2745 return (Transform() || 2751 return (Transform() ||
2746 GetLayoutObject().Style()->GetPosition() == EPosition::kFixed) && 2752 GetLayoutObject().Style()->GetPosition() == EPosition::kFixed) &&
2747 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || 2753 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) ||
2748 GetCompositingState() != kPaintsIntoOwnBacking); 2754 GetCompositingState() != kPaintsIntoOwnBacking);
2749 } 2755 }
2750 2756
2757 bool PaintLayer::SupportsSubsequenceCaching() const {
2758 // SVG paints atomically.
2759 if (GetLayoutObject().IsSVGRoot())
2760 return true;
2761
2762 // Create subsequence for only stacking contexts whose painting are atomic.
2763 if (!StackingNode()->IsStackingContext())
2764 return false;
2765
2766 // The layer doesn't have children. Subsequence caching is not worth it,
2767 // because normally the actual painting will be cheap.
2768 // SVG is also painted atomically.
pdr. 2017/04/13 16:21:45 Nit: Remove the line "SVG is also painted atomical
2769 if (!PaintLayerStackingNodeIterator(*StackingNode(), kAllChildren).Next())
2770 return false;
2771
2772 DCHECK(!Parent() || Parent()->needs_descendant_dependent_flags_update_ ||
2773 Parent()->HasDescendantThatSupportsSubsequenceCaching());
2774
2775 return true;
2776 }
2777
2751 ScrollingCoordinator* PaintLayer::GetScrollingCoordinator() { 2778 ScrollingCoordinator* PaintLayer::GetScrollingCoordinator() {
2752 Page* page = GetLayoutObject().GetFrame()->GetPage(); 2779 Page* page = GetLayoutObject().GetFrame()->GetPage();
2753 return (!page) ? nullptr : page->GetScrollingCoordinator(); 2780 return (!page) ? nullptr : page->GetScrollingCoordinator();
2754 } 2781 }
2755 2782
2756 bool PaintLayer::CompositesWithTransform() const { 2783 bool PaintLayer::CompositesWithTransform() const {
2757 return TransformAncestor() || Transform(); 2784 return TransformAncestor() || Transform();
2758 } 2785 }
2759 2786
2760 bool PaintLayer::CompositesWithOpacity() const { 2787 bool PaintLayer::CompositesWithOpacity() const {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3283 } 3310 }
3284 3311
3285 void showLayerTree(const blink::LayoutObject* layoutObject) { 3312 void showLayerTree(const blink::LayoutObject* layoutObject) {
3286 if (!layoutObject) { 3313 if (!layoutObject) {
3287 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3314 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3288 return; 3315 return;
3289 } 3316 }
3290 showLayerTree(layoutObject->EnclosingLayer()); 3317 showLayerTree(layoutObject->EnclosingLayer());
3291 } 3318 }
3292 #endif 3319 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698