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

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

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

Powered by Google App Engine
This is Rietveld 408576698