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

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

Issue 1850703002: Revert "Adapt and reland old position sticky implementation from https://codereview.chromium.org/34… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
276 void updateLayerPositionsAfterLayout(); 274 void updateLayerPositionsAfterLayout();
277 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta); 275 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta);
278 276
279 PaintLayer* enclosingPaginationLayer() const { return m_rareData ? m_rareDat a->enclosingPaginationLayer : nullptr; } 277 PaintLayer* enclosingPaginationLayer() const { return m_rareData ? m_rareDat a->enclosingPaginationLayer : nullptr; }
280 278
281 void updateTransformationMatrix(); 279 void updateTransformationMatrix();
282 PaintLayer* renderingContextRoot(); 280 PaintLayer* renderingContextRoot();
283 const PaintLayer* renderingContextRoot() const; 281 const PaintLayer* renderingContextRoot() const;
284 282
285 LayoutSize offsetForInFlowPosition() const { return m_rareData ? m_rareData- >offsetForInFlowPosition : LayoutSize(); } 283 LayoutSize offsetForInFlowPosition() const { return m_rareData ? m_rareData- >offsetForInFlowPosition : LayoutSize(); }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 , nearestFixedPositionLayer(nullptr) 523 , nearestFixedPositionLayer(nullptr)
526 , scrollParent(nullptr) 524 , scrollParent(nullptr)
527 , clipParent(nullptr) 525 , clipParent(nullptr)
528 { } 526 { }
529 527
530 bool isDefault() const { return !opacityAncestor && !transformAncestor & & !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s crollParent && !clipParent; } 528 bool isDefault() const { return !opacityAncestor && !transformAncestor & & !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s crollParent && !clipParent; }
531 529
532 const PaintLayer* opacityAncestor; 530 const PaintLayer* opacityAncestor;
533 const PaintLayer* transformAncestor; 531 const PaintLayer* transformAncestor;
534 const PaintLayer* filterAncestor; 532 const PaintLayer* filterAncestor;
535
536 // The fist ancestor which can scroll. This is a subset of the
537 // ancestorOverflowLayer chain where the scrolling layer is visible and
538 // has a larger scroll content than its bounds.
539 const PaintLayer* ancestorScrollingLayer; 533 const PaintLayer* ancestorScrollingLayer;
540 const PaintLayer* nearestFixedPositionLayer; 534 const PaintLayer* nearestFixedPositionLayer;
541 535
542 // A scroll parent is a compositor concept. It's only needed in blink 536 // A scroll parent is a compositor concept. It's only needed in blink
543 // because we need to use it as a promotion trigger. A layer has a 537 // because we need to use it as a promotion trigger. A layer has a
544 // scroll parent if neither its compositor scrolling ancestor, nor any 538 // scroll parent if neither its compositor scrolling ancestor, nor any
545 // other layer scrolled by this ancestor, is a stacking ancestor of this 539 // other layer scrolled by this ancestor, is a stacking ancestor of this
546 // layer. Layers with scroll parents must be scrolled with the main 540 // layer. Layers with scroll parents must be scrolled with the main
547 // scrolling layer by the compositor. 541 // scrolling layer by the compositor.
548 const PaintLayer* scrollParent; 542 const PaintLayer* scrollParent;
549 543
550 // A clip parent is another compositor concept that has leaked into 544 // A clip parent is another compositor concept that has leaked into
551 // blink so that it may be used as a promotion trigger. Layers with clip 545 // blink so that it may be used as a promotion trigger. Layers with clip
552 // parents escape the clip of a stacking tree ancestor. The compositor 546 // parents escape the clip of a stacking tree ancestor. The compositor
553 // needs to know about clip parents in order to circumvent its normal 547 // needs to know about clip parents in order to circumvent its normal
554 // clipping logic. 548 // clipping logic.
555 const PaintLayer* clipParent; 549 const PaintLayer* clipParent;
556 }; 550 };
557 551
558 void setNeedsCompositingInputsUpdate(); 552 void setNeedsCompositingInputsUpdate();
559 bool childNeedsCompositingInputsUpdate() const { return m_childNeedsComposit ingInputsUpdate; } 553 bool childNeedsCompositingInputsUpdate() const { return m_childNeedsComposit ingInputsUpdate; }
560 bool needsCompositingInputsUpdate() const 554 bool needsCompositingInputsUpdate() const
561 { 555 {
562 // While we're updating the compositing inputs, these values may differ. 556 // While we're updating the compositing inputs, these values may differ.
563 // We should never be asking for this value when that is the case. 557 // We should never be asking for this value when that is the case.
564 ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAnces torDependentCompositingInputsUpdate); 558 ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAnces torDependentCompositingInputsUpdate);
565 return m_needsDescendantDependentCompositingInputsUpdate; 559 return m_needsDescendantDependentCompositingInputsUpdate;
566 } 560 }
567 561
568 void updateAncestorOverflowLayer(const PaintLayer* ancestorOverflowLayer) { m_ancestorOverflowLayer = ancestorOverflowLayer; }
569 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith ClipPath); 562 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith ClipPath);
570 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa th, bool hasNonIsolatedDescendantWithBlendMode); 563 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa th, bool hasNonIsolatedDescendantWithBlendMode);
571 void didUpdateCompositingInputs(); 564 void didUpdateCompositingInputs();
572 565
573 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb soluteBoundingBox; } 566 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb soluteBoundingBox; }
574 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra reAncestorDependentCompositingInputs->opacityAncestor : nullptr; } 567 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra reAncestorDependentCompositingInputs->opacityAncestor : nullptr; }
575 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ rareAncestorDependentCompositingInputs->transformAncestor : nullptr; } 568 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ rareAncestorDependentCompositingInputs->transformAncestor : nullptr; }
576 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar eAncestorDependentCompositingInputs->filterAncestor : nullptr; } 569 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar eAncestorDependentCompositingInputs->filterAncestor : nullptr; }
577 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi ngContainer; } 570 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi ngContainer; }
578 const PaintLayer* ancestorOverflowLayer() const { return m_ancestorOverflowL ayer; }
579 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; } 571 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; }
580 const PaintLayer* nearestFixedPositionLayer() const { ASSERT(!m_needsAncesto rDependentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInp uts ? m_rareAncestorDependentCompositingInputs->nearestFixedPositionLayer : null ptr; } 572 const PaintLayer* nearestFixedPositionLayer() const { ASSERT(!m_needsAncesto rDependentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInp uts ? m_rareAncestorDependentCompositingInputs->nearestFixedPositionLayer : null ptr; }
581 const PaintLayer* scrollParent() const { ASSERT(!m_needsAncestorDependentCom positingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareA ncestorDependentCompositingInputs->scrollParent : nullptr; } 573 const PaintLayer* scrollParent() const { ASSERT(!m_needsAncestorDependentCom positingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareA ncestorDependentCompositingInputs->scrollParent : nullptr; }
582 const PaintLayer* clipParent() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAnc estorDependentCompositingInputs->clipParent : nullptr; } 574 const PaintLayer* clipParent() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAnc estorDependentCompositingInputs->clipParent : nullptr; }
583 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_hasAncestorWithClipPath; } 575 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_hasAncestorWithClipPath; }
584 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC ompositingInputsUpdate); return m_hasDescendantWithClipPath; } 576 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC ompositingInputsUpdate); return m_hasDescendantWithClipPath; }
585 bool hasNonIsolatedDescendantWithBlendMode() const; 577 bool hasNonIsolatedDescendantWithBlendMode() const;
586 578
587 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()) ; return m_lostGroupedMapping; } 579 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()) ; return m_lostGroupedMapping; }
588 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } 580 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 void clearClipRectsCache() const { m_clipRectsCache.clear(); } 678 void clearClipRectsCache() const { m_clipRectsCache.clear(); }
687 679
688 private: 680 private:
689 // Bounding box in the coordinates of this layer. 681 // Bounding box in the coordinates of this layer.
690 LayoutRect logicalBoundingBox() const; 682 LayoutRect logicalBoundingBox() const;
691 683
692 bool hasOverflowControls() const; 684 bool hasOverflowControls() const;
693 685
694 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 686 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
695 687
688 // Returns true if the position changed.
689 bool updateLayerPosition();
690
696 void updateLayerPositionRecursive(); 691 void updateLayerPositionRecursive();
697 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled); 692 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled);
698 693
699 void setNextSibling(PaintLayer* next) { m_next = next; } 694 void setNextSibling(PaintLayer* next) { m_next = next; }
700 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; } 695 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; }
701 void setFirstChild(PaintLayer* first) { m_first = first; } 696 void setFirstChild(PaintLayer* first) { m_first = first; }
702 void setLastChild(PaintLayer* last) { m_last = last; } 697 void setLastChild(PaintLayer* last) { m_last = last; }
703 698
704 void updateHasSelfPaintingLayerDescendant() const; 699 void updateHasSelfPaintingLayerDescendant() const;
705 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&, 700 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 // The layer's size. 834 // The layer's size.
840 // 835 //
841 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border 836 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border
842 // box. Otherwise, this is the LayoutInline's lines' bounding box. 837 // box. Otherwise, this is the LayoutInline's lines' bounding box.
843 IntSize m_size; 838 IntSize m_size;
844 839
845 // Cached normal flow values for absolute positioned elements with static le ft/top values. 840 // Cached normal flow values for absolute positioned elements with static le ft/top values.
846 LayoutUnit m_staticInlinePosition; 841 LayoutUnit m_staticInlinePosition;
847 LayoutUnit m_staticBlockPosition; 842 LayoutUnit m_staticBlockPosition;
848 843
849 // The first ancestor having a non visible overflow.
850 const PaintLayer* m_ancestorOverflowLayer;
851
852 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; 844 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs;
853 OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompos itingInputs; 845 OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompos itingInputs;
854 846
855 OwnPtrWillBePersistent<PaintLayerScrollableArea> m_scrollableArea; 847 OwnPtrWillBePersistent<PaintLayerScrollableArea> m_scrollableArea;
856 848
857 mutable OwnPtr<ClipRectsCache> m_clipRectsCache; 849 mutable OwnPtr<ClipRectsCache> m_clipRectsCache;
858 850
859 OwnPtr<PaintLayerStackingNode> m_stackingNode; 851 OwnPtr<PaintLayerStackingNode> m_stackingNode;
860 852
861 IntSize m_previousScrollOffsetAccumulationForPainting; 853 IntSize m_previousScrollOffsetAccumulationForPainting;
862 RefPtr<ClipRects> m_previousPaintingClipRects; 854 RefPtr<ClipRects> m_previousPaintingClipRects;
863 LayoutRect m_previousPaintDirtyRect; 855 LayoutRect m_previousPaintDirtyRect;
864 856
865 OwnPtr<PaintLayerRareData> m_rareData; 857 OwnPtr<PaintLayerRareData> m_rareData;
866 }; 858 };
867 859
868 } // namespace blink 860 } // namespace blink
869 861
870 #ifndef NDEBUG 862 #ifndef NDEBUG
871 // Outside the WebCore namespace for ease of invocation from gdb. 863 // Outside the WebCore namespace for ease of invocation from gdb.
872 void showLayerTree(const blink::PaintLayer*); 864 void showLayerTree(const blink::PaintLayer*);
873 void showLayerTree(const blink::LayoutObject*); 865 void showLayerTree(const blink::LayoutObject*);
874 #endif 866 #endif
875 867
876 #endif // Layer_h 868 #endif // Layer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698