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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.h

Issue 2479403002: Move all ancestor-dependent properties out of PaintLayer and into an aux. struct. (Closed)
Patch Set: none Created 4 years, 1 month 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) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if (m_rareData || reasons != CompositingReasonNone) 638 if (m_rareData || reasons != CompositingReasonNone)
639 ensureRareData().potentialCompositingReasonsFromStyle = reasons; 639 ensureRareData().potentialCompositingReasonsFromStyle = reasons;
640 } 640 }
641 641
642 bool hasStyleDeterminedDirectCompositingReasons() const { 642 bool hasStyleDeterminedDirectCompositingReasons() const {
643 return potentialCompositingReasonsFromStyle() & 643 return potentialCompositingReasonsFromStyle() &
644 CompositingReasonComboAllDirectStyleDeterminedReasons; 644 CompositingReasonComboAllDirectStyleDeterminedReasons;
645 } 645 }
646 646
647 class AncestorDependentCompositingInputs { 647 class AncestorDependentCompositingInputs {
648 DISALLOW_NEW();
649
650 public: 648 public:
651 AncestorDependentCompositingInputs() : clippingContainer(nullptr) {} 649 AncestorDependentCompositingInputs()
652
653 IntRect clippedAbsoluteBoundingBox;
654 IntRect unclippedAbsoluteBoundingBox;
655 const LayoutObject* clippingContainer;
656 };
657
658 class RareAncestorDependentCompositingInputs {
659 public:
660 RareAncestorDependentCompositingInputs()
661 : opacityAncestor(nullptr), 650 : opacityAncestor(nullptr),
662 transformAncestor(nullptr), 651 transformAncestor(nullptr),
663 filterAncestor(nullptr), 652 filterAncestor(nullptr),
664 ancestorScrollingLayer(nullptr), 653 ancestorScrollingLayer(nullptr),
665 nearestFixedPositionLayer(nullptr), 654 nearestFixedPositionLayer(nullptr),
666 scrollParent(nullptr), 655 scrollParent(nullptr),
667 clipParent(nullptr) {} 656 clipParent(nullptr),
668 657 clippingContainer(nullptr) {}
669 bool isDefault() const {
670 return !opacityAncestor && !transformAncestor && !filterAncestor &&
671 !ancestorScrollingLayer && !nearestFixedPositionLayer &&
672 !scrollParent && !clipParent;
673 }
674 658
675 const PaintLayer* opacityAncestor; 659 const PaintLayer* opacityAncestor;
676 const PaintLayer* transformAncestor; 660 const PaintLayer* transformAncestor;
677 const PaintLayer* filterAncestor; 661 const PaintLayer* filterAncestor;
678 662
679 // The fist ancestor which can scroll. This is a subset of the 663 // The fist ancestor which can scroll. This is a subset of the
680 // ancestorOverflowLayer chain where the scrolling layer is visible and 664 // ancestorOverflowLayer chain where the scrolling layer is visible and
681 // has a larger scroll content than its bounds. 665 // has a larger scroll content than its bounds.
682 const PaintLayer* ancestorScrollingLayer; 666 const PaintLayer* ancestorScrollingLayer;
683 const PaintLayer* nearestFixedPositionLayer; 667 const PaintLayer* nearestFixedPositionLayer;
684 668
685 // A scroll parent is a compositor concept. It's only needed in blink 669 // A scroll parent is a compositor concept. It's only needed in blink
686 // because we need to use it as a promotion trigger. A layer has a 670 // because we need to use it as a promotion trigger. A layer has a
687 // scroll parent if neither its compositor scrolling ancestor, nor any 671 // scroll parent if neither its compositor scrolling ancestor, nor any
688 // other layer scrolled by this ancestor, is a stacking ancestor of this 672 // other layer scrolled by this ancestor, is a stacking ancestor of this
689 // layer. Layers with scroll parents must be scrolled with the main 673 // layer. Layers with scroll parents must be scrolled with the main
690 // scrolling layer by the compositor. 674 // scrolling layer by the compositor.
691 const PaintLayer* scrollParent; 675 const PaintLayer* scrollParent;
692 676
693 // A clip parent is another compositor concept that has leaked into 677 // A clip parent is another compositor concept that has leaked into
694 // blink so that it may be used as a promotion trigger. Layers with clip 678 // blink so that it may be used as a promotion trigger. Layers with clip
695 // parents escape the clip of a stacking tree ancestor. The compositor 679 // parents escape the clip of a stacking tree ancestor. The compositor
696 // needs to know about clip parents in order to circumvent its normal 680 // needs to know about clip parents in order to circumvent its normal
697 // clipping logic. 681 // clipping logic.
698 const PaintLayer* clipParent; 682 const PaintLayer* clipParent;
683
684 IntRect clippedAbsoluteBoundingBox;
685 IntRect unclippedAbsoluteBoundingBox;
686 const LayoutObject* clippingContainer;
699 }; 687 };
700 688
701 void setNeedsCompositingInputsUpdate(); 689 void setNeedsCompositingInputsUpdate();
702 bool childNeedsCompositingInputsUpdate() const { 690 bool childNeedsCompositingInputsUpdate() const {
703 return m_childNeedsCompositingInputsUpdate; 691 return m_childNeedsCompositingInputsUpdate;
704 } 692 }
705 bool needsCompositingInputsUpdate() const { 693 bool needsCompositingInputsUpdate() const {
706 // While we're updating the compositing inputs, these values may differ. 694 // While we're updating the compositing inputs, these values may differ.
707 // We should never be asking for this value when that is the case. 695 // We should never be asking for this value when that is the case.
708 DCHECK(m_needsDescendantDependentCompositingInputsUpdate == 696 DCHECK(m_needsDescendantDependentCompositingInputsUpdate ==
709 m_needsAncestorDependentCompositingInputsUpdate); 697 m_needsAncestorDependentCompositingInputsUpdate);
710 return m_needsDescendantDependentCompositingInputsUpdate; 698 return m_needsDescendantDependentCompositingInputsUpdate;
711 } 699 }
712 700
713 void updateAncestorOverflowLayer(const PaintLayer* ancestorOverflowLayer) { 701 void updateAncestorOverflowLayer(const PaintLayer* ancestorOverflowLayer) {
714 m_ancestorOverflowLayer = ancestorOverflowLayer; 702 m_ancestorOverflowLayer = ancestorOverflowLayer;
715 } 703 }
716 void updateAncestorDependentCompositingInputs( 704 void updateAncestorDependentCompositingInputs(
717 const AncestorDependentCompositingInputs&, 705 const AncestorDependentCompositingInputs&,
718 const RareAncestorDependentCompositingInputs&,
719 bool hasAncestorWithClipPath); 706 bool hasAncestorWithClipPath);
720 void updateDescendantDependentCompositingInputs( 707 void updateDescendantDependentCompositingInputs(
721 bool hasDescendantWithClipPath, 708 bool hasDescendantWithClipPath,
722 bool hasNonIsolatedDescendantWithBlendMode, 709 bool hasNonIsolatedDescendantWithBlendMode,
723 bool hasRootScrollerAsDescendant); 710 bool hasRootScrollerAsDescendant);
724 void didUpdateCompositingInputs(); 711 void didUpdateCompositingInputs();
725 712
726 const IntRect& clippedAbsoluteBoundingBox() const { 713 const IntRect& clippedAbsoluteBoundingBox() const {
727 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 714 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
728 return m_ancestorDependentCompositingInputs.clippedAbsoluteBoundingBox; 715 return m_ancestorDependentCompositingInputs->clippedAbsoluteBoundingBox;
729 } 716 }
730 const IntRect& unclippedAbsoluteBoundingBox() const { 717 const IntRect& unclippedAbsoluteBoundingBox() const {
731 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 718 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
732 return m_ancestorDependentCompositingInputs.unclippedAbsoluteBoundingBox; 719 return m_ancestorDependentCompositingInputs->unclippedAbsoluteBoundingBox;
733 } 720 }
734 const PaintLayer* opacityAncestor() const { 721 const PaintLayer* opacityAncestor() const {
735 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 722 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
736 return m_rareAncestorDependentCompositingInputs 723 return m_ancestorDependentCompositingInputs
737 ? m_rareAncestorDependentCompositingInputs->opacityAncestor 724 ? m_ancestorDependentCompositingInputs->opacityAncestor
738 : nullptr; 725 : nullptr;
739 } 726 }
740 const PaintLayer* transformAncestor() const { 727 const PaintLayer* transformAncestor() const {
741 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 728 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
742 return m_rareAncestorDependentCompositingInputs 729 return m_ancestorDependentCompositingInputs
743 ? m_rareAncestorDependentCompositingInputs->transformAncestor 730 ? m_ancestorDependentCompositingInputs->transformAncestor
744 : nullptr; 731 : nullptr;
745 } 732 }
746 const PaintLayer* filterAncestor() const { 733 const PaintLayer* filterAncestor() const {
747 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 734 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
748 return m_rareAncestorDependentCompositingInputs 735 return m_ancestorDependentCompositingInputs
749 ? m_rareAncestorDependentCompositingInputs->filterAncestor 736 ? m_ancestorDependentCompositingInputs->filterAncestor
750 : nullptr; 737 : nullptr;
751 } 738 }
752 const LayoutObject* clippingContainer() const { 739 const LayoutObject* clippingContainer() const {
753 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 740 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
754 return m_ancestorDependentCompositingInputs.clippingContainer; 741 return m_ancestorDependentCompositingInputs->clippingContainer;
755 } 742 }
756 const PaintLayer* ancestorOverflowLayer() const { 743 const PaintLayer* ancestorOverflowLayer() const {
757 return m_ancestorOverflowLayer; 744 return m_ancestorOverflowLayer;
758 } 745 }
759 const PaintLayer* ancestorScrollingLayer() const { 746 const PaintLayer* ancestorScrollingLayer() const {
760 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 747 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
761 return m_rareAncestorDependentCompositingInputs 748 return m_ancestorDependentCompositingInputs
762 ? m_rareAncestorDependentCompositingInputs 749 ? m_ancestorDependentCompositingInputs->ancestorScrollingLayer
763 ->ancestorScrollingLayer
764 : nullptr; 750 : nullptr;
765 } 751 }
766 const PaintLayer* nearestFixedPositionLayer() const { 752 const PaintLayer* nearestFixedPositionLayer() const {
767 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 753 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
768 return m_rareAncestorDependentCompositingInputs 754 return m_ancestorDependentCompositingInputs
769 ? m_rareAncestorDependentCompositingInputs 755 ? m_ancestorDependentCompositingInputs->nearestFixedPositionLayer
770 ->nearestFixedPositionLayer
771 : nullptr; 756 : nullptr;
772 } 757 }
773 const PaintLayer* scrollParent() const { 758 const PaintLayer* scrollParent() const {
774 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 759 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
775 return m_rareAncestorDependentCompositingInputs 760 return m_ancestorDependentCompositingInputs
776 ? m_rareAncestorDependentCompositingInputs->scrollParent 761 ? m_ancestorDependentCompositingInputs->scrollParent
777 : nullptr; 762 : nullptr;
778 } 763 }
779 const PaintLayer* clipParent() const { 764 const PaintLayer* clipParent() const {
780 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 765 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
781 return m_rareAncestorDependentCompositingInputs 766 return m_ancestorDependentCompositingInputs
782 ? m_rareAncestorDependentCompositingInputs->clipParent 767 ? m_ancestorDependentCompositingInputs->clipParent
783 : nullptr; 768 : nullptr;
784 } 769 }
785 bool hasAncestorWithClipPath() const { 770 bool hasAncestorWithClipPath() const {
786 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate); 771 DCHECK(!m_needsAncestorDependentCompositingInputsUpdate);
787 return m_hasAncestorWithClipPath; 772 return m_hasAncestorWithClipPath;
788 } 773 }
789 bool hasDescendantWithClipPath() const { 774 bool hasDescendantWithClipPath() const {
790 DCHECK(!m_needsDescendantDependentCompositingInputsUpdate); 775 DCHECK(!m_needsDescendantDependentCompositingInputsUpdate);
791 return m_hasDescendantWithClipPath; 776 return m_hasDescendantWithClipPath;
792 } 777 }
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 IntSize m_size; 1201 IntSize m_size;
1217 1202
1218 // Cached normal flow values for absolute positioned elements with static 1203 // Cached normal flow values for absolute positioned elements with static
1219 // left/top values. 1204 // left/top values.
1220 LayoutUnit m_staticInlinePosition; 1205 LayoutUnit m_staticInlinePosition;
1221 LayoutUnit m_staticBlockPosition; 1206 LayoutUnit m_staticBlockPosition;
1222 1207
1223 // The first ancestor having a non visible overflow. 1208 // The first ancestor having a non visible overflow.
1224 const PaintLayer* m_ancestorOverflowLayer; 1209 const PaintLayer* m_ancestorOverflowLayer;
1225 1210
1226 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; 1211 std::unique_ptr<AncestorDependentCompositingInputs>
1227 std::unique_ptr<RareAncestorDependentCompositingInputs> 1212 m_ancestorDependentCompositingInputs;
1228 m_rareAncestorDependentCompositingInputs;
1229 1213
1230 Persistent<PaintLayerScrollableArea> m_scrollableArea; 1214 Persistent<PaintLayerScrollableArea> m_scrollableArea;
1231 1215
1232 mutable std::unique_ptr<ClipRectsCache> m_clipRectsCache; 1216 mutable std::unique_ptr<ClipRectsCache> m_clipRectsCache;
1233 1217
1234 std::unique_ptr<PaintLayerStackingNode> m_stackingNode; 1218 std::unique_ptr<PaintLayerStackingNode> m_stackingNode;
1235 1219
1236 IntSize m_previousScrollOffsetAccumulationForPainting; 1220 IntSize m_previousScrollOffsetAccumulationForPainting;
1237 RefPtr<ClipRects> m_previousPaintingClipRects; 1221 RefPtr<ClipRects> m_previousPaintingClipRects;
1238 LayoutRect m_previousPaintDirtyRect; 1222 LayoutRect m_previousPaintDirtyRect;
1239 1223
1240 std::unique_ptr<PaintLayerRareData> m_rareData; 1224 std::unique_ptr<PaintLayerRareData> m_rareData;
1241 }; 1225 };
1242 1226
1243 } // namespace blink 1227 } // namespace blink
1244 1228
1245 #ifndef NDEBUG 1229 #ifndef NDEBUG
1246 // Outside the WebCore namespace for ease of invocation from gdb. 1230 // Outside the WebCore namespace for ease of invocation from gdb.
1247 CORE_EXPORT void showLayerTree(const blink::PaintLayer*); 1231 CORE_EXPORT void showLayerTree(const blink::PaintLayer*);
1248 CORE_EXPORT void showLayerTree(const blink::LayoutObject*); 1232 CORE_EXPORT void showLayerTree(const blink::LayoutObject*);
1249 #endif 1233 #endif
1250 1234
1251 #endif // Layer_h 1235 #endif // Layer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698