Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 } | 680 } |
| 680 } | 681 } |
| 681 | 682 |
| 682 void PaintLayer::UpdateDescendantDependentFlags() { | 683 void PaintLayer::UpdateDescendantDependentFlags() { |
| 683 if (needs_descendant_dependent_flags_update_) { | 684 if (needs_descendant_dependent_flags_update_) { |
| 684 bool old_has_non_isolated_descendant_with_blend_mode = | 685 bool old_has_non_isolated_descendant_with_blend_mode = |
| 685 has_non_isolated_descendant_with_blend_mode_; | 686 has_non_isolated_descendant_with_blend_mode_; |
| 686 has_visible_descendant_ = false; | 687 has_visible_descendant_ = false; |
| 687 has_non_isolated_descendant_with_blend_mode_ = false; | 688 has_non_isolated_descendant_with_blend_mode_ = false; |
| 688 has_descendant_with_clip_path_ = false; | 689 has_descendant_with_clip_path_ = false; |
| 690 has_descendant_that_supports_subsequence_caching_ = false; | |
| 689 | 691 |
| 690 for (PaintLayer* child = FirstChild(); child; | 692 for (PaintLayer* child = FirstChild(); child; |
| 691 child = child->NextSibling()) { | 693 child = child->NextSibling()) { |
| 692 child->UpdateDescendantDependentFlags(); | 694 child->UpdateDescendantDependentFlags(); |
| 693 | 695 |
| 694 if (child->has_visible_content_ || child->has_visible_descendant_) | 696 if (child->has_visible_content_ || child->has_visible_descendant_) |
| 695 has_visible_descendant_ = true; | 697 has_visible_descendant_ = true; |
| 696 | 698 |
| 697 has_non_isolated_descendant_with_blend_mode_ |= | 699 has_non_isolated_descendant_with_blend_mode_ |= |
| 698 (!child->StackingNode()->IsStackingContext() && | 700 (!child->StackingNode()->IsStackingContext() && |
| 699 child->HasNonIsolatedDescendantWithBlendMode()) || | 701 child->HasNonIsolatedDescendantWithBlendMode()) || |
| 700 child->GetLayoutObject().StyleRef().HasBlendMode(); | 702 child->GetLayoutObject().StyleRef().HasBlendMode(); |
| 701 | 703 |
| 702 has_descendant_with_clip_path_ |= child->HasDescendantWithClipPath() || | 704 has_descendant_with_clip_path_ |= child->HasDescendantWithClipPath() || |
| 703 child->GetLayoutObject().HasClipPath(); | 705 child->GetLayoutObject().HasClipPath(); |
| 706 | |
| 707 has_descendant_that_supports_subsequence_caching_ |= | |
| 708 child->HasDescendantThatSupportsSubsequenceCaching() || | |
| 709 child->SupportsSubsequenceCaching(); | |
| 704 } | 710 } |
| 705 | 711 |
| 706 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 712 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
| 707 old_has_non_isolated_descendant_with_blend_mode != | 713 old_has_non_isolated_descendant_with_blend_mode != |
| 708 static_cast<bool>(has_non_isolated_descendant_with_blend_mode_)) | 714 static_cast<bool>(has_non_isolated_descendant_with_blend_mode_)) |
| 709 GetLayoutObject().SetNeedsPaintPropertyUpdate(); | 715 GetLayoutObject().SetNeedsPaintPropertyUpdate(); |
| 710 needs_descendant_dependent_flags_update_ = false; | 716 needs_descendant_dependent_flags_update_ = false; |
| 711 } | 717 } |
| 712 | 718 |
| 713 bool previously_has_visible_content = has_visible_content_; | 719 bool previously_has_visible_content = has_visible_content_; |
| (...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2742 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || | 2748 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || |
| 2743 GetCompositingState() != kPaintsIntoOwnBacking); | 2749 GetCompositingState() != kPaintsIntoOwnBacking); |
| 2744 } | 2750 } |
| 2745 | 2751 |
| 2746 return (Transform() || | 2752 return (Transform() || |
| 2747 GetLayoutObject().Style()->GetPosition() == EPosition::kFixed) && | 2753 GetLayoutObject().Style()->GetPosition() == EPosition::kFixed) && |
| 2748 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || | 2754 ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || |
| 2749 GetCompositingState() != kPaintsIntoOwnBacking); | 2755 GetCompositingState() != kPaintsIntoOwnBacking); |
| 2750 } | 2756 } |
| 2751 | 2757 |
| 2758 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.
| |
| 2759 // SVG paints atomically. | |
| 2760 if (GetLayoutObject().IsSVGRoot()) | |
| 2761 return true; | |
| 2762 | |
| 2763 // Create subsequence for only stacking contexts whose painting are atomic. | |
| 2764 if (!StackingNode()->IsStackingContext()) | |
| 2765 return false; | |
| 2766 | |
| 2767 // The layer doesn't have children. Subsequence caching is not worth it, | |
| 2768 // because normally the actual painting will be cheap. | |
| 2769 // SVG is also painted atomically. | |
| 2770 if (!PaintLayerStackingNodeIterator(*StackingNode(), kAllChildren).Next()) | |
| 2771 return false; | |
| 2772 | |
| 2773 return true; | |
| 2774 } | |
| 2775 | |
| 2752 bool PaintLayer::CompositesWithTransform() const { | 2776 bool PaintLayer::CompositesWithTransform() const { |
| 2753 return TransformAncestor() || Transform(); | 2777 return TransformAncestor() || Transform(); |
| 2754 } | 2778 } |
| 2755 | 2779 |
| 2756 bool PaintLayer::CompositesWithOpacity() const { | 2780 bool PaintLayer::CompositesWithOpacity() const { |
| 2757 return OpacityAncestor() || GetLayoutObject().Style()->HasOpacity(); | 2781 return OpacityAncestor() || GetLayoutObject().Style()->HasOpacity(); |
| 2758 } | 2782 } |
| 2759 | 2783 |
| 2760 bool PaintLayer::BackgroundIsKnownToBeOpaqueInRect( | 2784 bool PaintLayer::BackgroundIsKnownToBeOpaqueInRect( |
| 2761 const LayoutRect& local_rect) const { | 2785 const LayoutRect& local_rect) const { |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3279 } | 3303 } |
| 3280 | 3304 |
| 3281 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3305 void showLayerTree(const blink::LayoutObject* layoutObject) { |
| 3282 if (!layoutObject) { | 3306 if (!layoutObject) { |
| 3283 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3307 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
| 3284 return; | 3308 return; |
| 3285 } | 3309 } |
| 3286 showLayerTree(layoutObject->EnclosingLayer()); | 3310 showLayerTree(layoutObject->EnclosingLayer()); |
| 3287 } | 3311 } |
| 3288 #endif | 3312 #endif |
| OLD | NEW |