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

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

Issue 1870663002: Reland main thread position sticky implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix crash resulting from PaintLayer::removeOnlyThisLayer Created 4 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) 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); } 264 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); }
265 265
266 bool isRootLayer() const { return m_isRootLayer; } 266 bool isRootLayer() const { return m_isRootLayer; }
267 267
268 PaintLayerCompositor* compositor() const; 268 PaintLayerCompositor* compositor() const;
269 269
270 // Notification from the layoutObject that its content changed (e.g. current frame of image changed). 270 // Notification from the layoutObject that its content changed (e.g. current frame of image changed).
271 // Allows updates of layer content without invalidating paint. 271 // Allows updates of layer content without invalidating paint.
272 void contentChanged(ContentChangeType); 272 void contentChanged(ContentChangeType);
273 273
274 void updateLayerPosition();
275
274 void updateLayerPositionsAfterLayout(); 276 void updateLayerPositionsAfterLayout();
275 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta); 277 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta);
276 278
277 PaintLayer* enclosingPaginationLayer() const { return m_rareData ? m_rareDat a->enclosingPaginationLayer : nullptr; } 279 PaintLayer* enclosingPaginationLayer() const { return m_rareData ? m_rareDat a->enclosingPaginationLayer : nullptr; }
278 280
279 void updateTransformationMatrix(); 281 void updateTransformationMatrix();
280 PaintLayer* renderingContextRoot(); 282 PaintLayer* renderingContextRoot();
281 const PaintLayer* renderingContextRoot() const; 283 const PaintLayer* renderingContextRoot() const;
282 284
283 LayoutSize offsetForInFlowPosition() const { return m_rareData ? m_rareData- >offsetForInFlowPosition : LayoutSize(); } 285 LayoutSize offsetForInFlowPosition() const { return m_rareData ? m_rareData- >offsetForInFlowPosition : LayoutSize(); }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 , nearestFixedPositionLayer(nullptr) 529 , nearestFixedPositionLayer(nullptr)
528 , scrollParent(nullptr) 530 , scrollParent(nullptr)
529 , clipParent(nullptr) 531 , clipParent(nullptr)
530 { } 532 { }
531 533
532 bool isDefault() const { return !opacityAncestor && !transformAncestor & & !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s crollParent && !clipParent; } 534 bool isDefault() const { return !opacityAncestor && !transformAncestor & & !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s crollParent && !clipParent; }
533 535
534 const PaintLayer* opacityAncestor; 536 const PaintLayer* opacityAncestor;
535 const PaintLayer* transformAncestor; 537 const PaintLayer* transformAncestor;
536 const PaintLayer* filterAncestor; 538 const PaintLayer* filterAncestor;
539
540 // The fist ancestor which can scroll. This is a subset of the
541 // ancestorOverflowLayer chain where the scrolling layer is visible and
542 // has a larger scroll content than its bounds.
537 const PaintLayer* ancestorScrollingLayer; 543 const PaintLayer* ancestorScrollingLayer;
538 const PaintLayer* nearestFixedPositionLayer; 544 const PaintLayer* nearestFixedPositionLayer;
539 545
540 // A scroll parent is a compositor concept. It's only needed in blink 546 // A scroll parent is a compositor concept. It's only needed in blink
541 // because we need to use it as a promotion trigger. A layer has a 547 // because we need to use it as a promotion trigger. A layer has a
542 // scroll parent if neither its compositor scrolling ancestor, nor any 548 // scroll parent if neither its compositor scrolling ancestor, nor any
543 // other layer scrolled by this ancestor, is a stacking ancestor of this 549 // other layer scrolled by this ancestor, is a stacking ancestor of this
544 // layer. Layers with scroll parents must be scrolled with the main 550 // layer. Layers with scroll parents must be scrolled with the main
545 // scrolling layer by the compositor. 551 // scrolling layer by the compositor.
546 const PaintLayer* scrollParent; 552 const PaintLayer* scrollParent;
547 553
548 // A clip parent is another compositor concept that has leaked into 554 // A clip parent is another compositor concept that has leaked into
549 // blink so that it may be used as a promotion trigger. Layers with clip 555 // blink so that it may be used as a promotion trigger. Layers with clip
550 // parents escape the clip of a stacking tree ancestor. The compositor 556 // parents escape the clip of a stacking tree ancestor. The compositor
551 // needs to know about clip parents in order to circumvent its normal 557 // needs to know about clip parents in order to circumvent its normal
552 // clipping logic. 558 // clipping logic.
553 const PaintLayer* clipParent; 559 const PaintLayer* clipParent;
554 }; 560 };
555 561
556 void setNeedsCompositingInputsUpdate(); 562 void setNeedsCompositingInputsUpdate();
557 bool childNeedsCompositingInputsUpdate() const { return m_childNeedsComposit ingInputsUpdate; } 563 bool childNeedsCompositingInputsUpdate() const { return m_childNeedsComposit ingInputsUpdate; }
558 bool needsCompositingInputsUpdate() const 564 bool needsCompositingInputsUpdate() const
559 { 565 {
560 // While we're updating the compositing inputs, these values may differ. 566 // While we're updating the compositing inputs, these values may differ.
561 // We should never be asking for this value when that is the case. 567 // We should never be asking for this value when that is the case.
562 ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAnces torDependentCompositingInputsUpdate); 568 ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAnces torDependentCompositingInputsUpdate);
563 return m_needsDescendantDependentCompositingInputsUpdate; 569 return m_needsDescendantDependentCompositingInputsUpdate;
564 } 570 }
565 571
572 void updateAncestorOverflowLayer(const PaintLayer* ancestorOverflowLayer) { m_ancestorOverflowLayer = ancestorOverflowLayer; }
566 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith ClipPath); 573 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith ClipPath);
567 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa th, bool hasNonIsolatedDescendantWithBlendMode); 574 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa th, bool hasNonIsolatedDescendantWithBlendMode);
568 void didUpdateCompositingInputs(); 575 void didUpdateCompositingInputs();
569 576
570 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb soluteBoundingBox; } 577 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb soluteBoundingBox; }
571 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra reAncestorDependentCompositingInputs->opacityAncestor : nullptr; } 578 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra reAncestorDependentCompositingInputs->opacityAncestor : nullptr; }
572 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ rareAncestorDependentCompositingInputs->transformAncestor : nullptr; } 579 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ rareAncestorDependentCompositingInputs->transformAncestor : nullptr; }
573 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar eAncestorDependentCompositingInputs->filterAncestor : nullptr; } 580 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar eAncestorDependentCompositingInputs->filterAncestor : nullptr; }
574 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi ngContainer; } 581 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi ngContainer; }
582 const PaintLayer* ancestorOverflowLayer() const { return m_ancestorOverflowL ayer; }
575 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; } 583 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; }
576 const PaintLayer* nearestFixedPositionLayer() const { ASSERT(!m_needsAncesto rDependentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInp uts ? m_rareAncestorDependentCompositingInputs->nearestFixedPositionLayer : null ptr; } 584 const PaintLayer* nearestFixedPositionLayer() const { ASSERT(!m_needsAncesto rDependentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInp uts ? m_rareAncestorDependentCompositingInputs->nearestFixedPositionLayer : null ptr; }
577 const PaintLayer* scrollParent() const { ASSERT(!m_needsAncestorDependentCom positingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareA ncestorDependentCompositingInputs->scrollParent : nullptr; } 585 const PaintLayer* scrollParent() const { ASSERT(!m_needsAncestorDependentCom positingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareA ncestorDependentCompositingInputs->scrollParent : nullptr; }
578 const PaintLayer* clipParent() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAnc estorDependentCompositingInputs->clipParent : nullptr; } 586 const PaintLayer* clipParent() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAnc estorDependentCompositingInputs->clipParent : nullptr; }
579 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_hasAncestorWithClipPath; } 587 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_hasAncestorWithClipPath; }
580 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC ompositingInputsUpdate); return m_hasDescendantWithClipPath; } 588 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC ompositingInputsUpdate); return m_hasDescendantWithClipPath; }
581 bool hasNonIsolatedDescendantWithBlendMode() const; 589 bool hasNonIsolatedDescendantWithBlendMode() const;
582 590
583 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()) ; return m_lostGroupedMapping; } 591 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()) ; return m_lostGroupedMapping; }
584 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } 592 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 void clearClipRectsCache() const { m_clipRectsCache.clear(); } 690 void clearClipRectsCache() const { m_clipRectsCache.clear(); }
683 691
684 private: 692 private:
685 // Bounding box in the coordinates of this layer. 693 // Bounding box in the coordinates of this layer.
686 LayoutRect logicalBoundingBox() const; 694 LayoutRect logicalBoundingBox() const;
687 695
688 bool hasOverflowControls() const; 696 bool hasOverflowControls() const;
689 697
690 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 698 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
691 699
692 // Returns true if the position changed.
693 bool updateLayerPosition();
694
695 void updateLayerPositionRecursive(); 700 void updateLayerPositionRecursive();
696 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled); 701 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled);
697 702
698 void setNextSibling(PaintLayer* next) { m_next = next; } 703 void setNextSibling(PaintLayer* next) { m_next = next; }
699 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; } 704 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; }
700 void setFirstChild(PaintLayer* first) { m_first = first; } 705 void setFirstChild(PaintLayer* first) { m_first = first; }
701 void setLastChild(PaintLayer* last) { m_last = last; } 706 void setLastChild(PaintLayer* last) { m_last = last; }
702 707
703 void updateHasSelfPaintingLayerDescendant() const; 708 void updateHasSelfPaintingLayerDescendant() const;
704 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&, 709 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 746
742 void dirtyAncestorChainVisibleDescendantStatus(); 747 void dirtyAncestorChainVisibleDescendantStatus();
743 748
744 bool attemptDirectCompositingUpdate(StyleDifference, const ComputedStyle* ol dStyle); 749 bool attemptDirectCompositingUpdate(StyleDifference, const ComputedStyle* ol dStyle);
745 void updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& new Style); 750 void updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& new Style);
746 751
747 void dirty3DTransformedDescendantStatus(); 752 void dirty3DTransformedDescendantStatus();
748 // Both updates the status, and returns true if descendants of this have 3d. 753 // Both updates the status, and returns true if descendants of this have 3d.
749 bool update3DTransformedDescendantStatus(); 754 bool update3DTransformedDescendantStatus();
750 755
756 void removeAncestorOverflowLayer(const PaintLayer* removedLayer);
757
751 void updateOrRemoveFilterClients(); 758 void updateOrRemoveFilterClients();
752 759
753 void updatePaginationRecursive(bool needsPaginationUpdate = false); 760 void updatePaginationRecursive(bool needsPaginationUpdate = false);
754 void clearPaginationRecursive(); 761 void clearPaginationRecursive();
755 762
756 void markCompositingContainerChainForNeedsRepaint(); 763 void markCompositingContainerChainForNeedsRepaint();
757 764
758 PaintLayerRareData& ensureRareData() 765 PaintLayerRareData& ensureRareData()
759 { 766 {
760 if (!m_rareData) 767 if (!m_rareData)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 // The layer's size. 845 // The layer's size.
839 // 846 //
840 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border 847 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border
841 // box. Otherwise, this is the LayoutInline's lines' bounding box. 848 // box. Otherwise, this is the LayoutInline's lines' bounding box.
842 IntSize m_size; 849 IntSize m_size;
843 850
844 // Cached normal flow values for absolute positioned elements with static le ft/top values. 851 // Cached normal flow values for absolute positioned elements with static le ft/top values.
845 LayoutUnit m_staticInlinePosition; 852 LayoutUnit m_staticInlinePosition;
846 LayoutUnit m_staticBlockPosition; 853 LayoutUnit m_staticBlockPosition;
847 854
855 // The first ancestor having a non visible overflow.
856 const PaintLayer* m_ancestorOverflowLayer;
857
848 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; 858 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs;
849 OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompos itingInputs; 859 OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompos itingInputs;
850 860
851 OwnPtrWillBePersistent<PaintLayerScrollableArea> m_scrollableArea; 861 OwnPtrWillBePersistent<PaintLayerScrollableArea> m_scrollableArea;
852 862
853 mutable OwnPtr<ClipRectsCache> m_clipRectsCache; 863 mutable OwnPtr<ClipRectsCache> m_clipRectsCache;
854 864
855 OwnPtr<PaintLayerStackingNode> m_stackingNode; 865 OwnPtr<PaintLayerStackingNode> m_stackingNode;
856 866
857 IntSize m_previousScrollOffsetAccumulationForPainting; 867 IntSize m_previousScrollOffsetAccumulationForPainting;
858 RefPtr<ClipRects> m_previousPaintingClipRects; 868 RefPtr<ClipRects> m_previousPaintingClipRects;
859 LayoutRect m_previousPaintDirtyRect; 869 LayoutRect m_previousPaintDirtyRect;
860 870
861 OwnPtr<PaintLayerRareData> m_rareData; 871 OwnPtr<PaintLayerRareData> m_rareData;
862 }; 872 };
863 873
864 } // namespace blink 874 } // namespace blink
865 875
866 #ifndef NDEBUG 876 #ifndef NDEBUG
867 // Outside the WebCore namespace for ease of invocation from gdb. 877 // Outside the WebCore namespace for ease of invocation from gdb.
868 void showLayerTree(const blink::PaintLayer*); 878 void showLayerTree(const blink::PaintLayer*);
869 void showLayerTree(const blink::LayoutObject*); 879 void showLayerTree(const blink::LayoutObject*);
870 #endif 880 #endif
871 881
872 #endif // Layer_h 882 #endif // Layer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698