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

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: WIP - fix on release, still hits CHECK in LayoutGeometryMap.cpp:156 Created 4 years, 10 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); } 257 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); }
258 258
259 bool isRootLayer() const { return m_isRootLayer; } 259 bool isRootLayer() const { return m_isRootLayer; }
260 260
261 PaintLayerCompositor* compositor() const; 261 PaintLayerCompositor* compositor() const;
262 262
263 // Notification from the layoutObject that its content changed (e.g. current frame of image changed). 263 // Notification from the layoutObject that its content changed (e.g. current frame of image changed).
264 // Allows updates of layer content without invalidating paint. 264 // Allows updates of layer content without invalidating paint.
265 void contentChanged(ContentChangeType); 265 void contentChanged(ContentChangeType);
266 266
267 void updateLayerPosition();
268
267 void updateLayerPositionsAfterLayout(); 269 void updateLayerPositionsAfterLayout();
268 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta); 270 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta);
269 271
270 PaintLayer* enclosingPaginationLayer() const { return m_rareData ? m_rareDat a->enclosingPaginationLayer : nullptr; } 272 PaintLayer* enclosingPaginationLayer() const { return m_rareData ? m_rareDat a->enclosingPaginationLayer : nullptr; }
271 273
272 void updateTransformationMatrix(); 274 void updateTransformationMatrix();
273 PaintLayer* renderingContextRoot(); 275 PaintLayer* renderingContextRoot();
274 276
275 LayoutSize offsetForInFlowPosition() const { return m_rareData ? m_rareData- >offsetForInFlowPosition : LayoutSize(); } 277 LayoutSize offsetForInFlowPosition() const { return m_rareData ? m_rareData- >offsetForInFlowPosition : LayoutSize(); }
276 278
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 IntRect clippedAbsoluteBoundingBox; 522 IntRect clippedAbsoluteBoundingBox;
521 const LayoutObject* clippingContainer; 523 const LayoutObject* clippingContainer;
522 }; 524 };
523 525
524 class RareAncestorDependentCompositingInputs { 526 class RareAncestorDependentCompositingInputs {
525 public: 527 public:
526 RareAncestorDependentCompositingInputs() 528 RareAncestorDependentCompositingInputs()
527 : opacityAncestor(nullptr) 529 : opacityAncestor(nullptr)
528 , transformAncestor(nullptr) 530 , transformAncestor(nullptr)
529 , filterAncestor(nullptr) 531 , filterAncestor(nullptr)
532 , ancestorOverflowLayer(nullptr)
530 , ancestorScrollingLayer(nullptr) 533 , ancestorScrollingLayer(nullptr)
531 , nearestFixedPositionLayer(nullptr) 534 , nearestFixedPositionLayer(nullptr)
532 , scrollParent(nullptr) 535 , scrollParent(nullptr)
533 , clipParent(nullptr) 536 , clipParent(nullptr)
534 { } 537 { }
535 538
536 bool isDefault() const { return !opacityAncestor && !transformAncestor & & !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s crollParent && !clipParent; } 539 bool isDefault() const { return !opacityAncestor && !transformAncestor & & !filterAncestor && !ancestorOverflowLayer && !ancestorScrollingLayer && !neare stFixedPositionLayer && !scrollParent && !clipParent; }
537 540
538 const PaintLayer* opacityAncestor; 541 const PaintLayer* opacityAncestor;
539 const PaintLayer* transformAncestor; 542 const PaintLayer* transformAncestor;
540 const PaintLayer* filterAncestor; 543 const PaintLayer* filterAncestor;
544
545 // The first ancestor having a non visible overflow.
546 const PaintLayer* ancestorOverflowLayer;
547
548 // The fist ancestor which can scroll. This is a subset of the
549 // ancestorOverflowLayer chain where the scrolling layer is visible and
550 // has a larger scroll content than its bounds.
541 const PaintLayer* ancestorScrollingLayer; 551 const PaintLayer* ancestorScrollingLayer;
542 const PaintLayer* nearestFixedPositionLayer; 552 const PaintLayer* nearestFixedPositionLayer;
543 553
544 // A scroll parent is a compositor concept. It's only needed in blink 554 // A scroll parent is a compositor concept. It's only needed in blink
545 // because we need to use it as a promotion trigger. A layer has a 555 // because we need to use it as a promotion trigger. A layer has a
546 // scroll parent if neither its compositor scrolling ancestor, nor any 556 // scroll parent if neither its compositor scrolling ancestor, nor any
547 // other layer scrolled by this ancestor, is a stacking ancestor of this 557 // other layer scrolled by this ancestor, is a stacking ancestor of this
548 // layer. Layers with scroll parents must be scrolled with the main 558 // layer. Layers with scroll parents must be scrolled with the main
549 // scrolling layer by the compositor. 559 // scrolling layer by the compositor.
550 const PaintLayer* scrollParent; 560 const PaintLayer* scrollParent;
(...skipping 18 matching lines...) Expand all
569 579
570 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith ClipPath); 580 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith ClipPath);
571 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa th, bool hasNonIsolatedDescendantWithBlendMode); 581 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa th, bool hasNonIsolatedDescendantWithBlendMode);
572 void didUpdateCompositingInputs(); 582 void didUpdateCompositingInputs();
573 583
574 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb soluteBoundingBox; } 584 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb soluteBoundingBox; }
575 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra reAncestorDependentCompositingInputs->opacityAncestor : nullptr; } 585 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra reAncestorDependentCompositingInputs->opacityAncestor : nullptr; }
576 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ rareAncestorDependentCompositingInputs->transformAncestor : nullptr; } 586 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ rareAncestorDependentCompositingInputs->transformAncestor : nullptr; }
577 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar eAncestorDependentCompositingInputs->filterAncestor : nullptr; } 587 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar eAncestorDependentCompositingInputs->filterAncestor : nullptr; }
578 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi ngContainer; } 588 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi ngContainer; }
589 const PaintLayer* ancestorOverflowLayer() const { return m_rareAncestorDepen dentCompositingInputs ? m_rareAncestorDependentCompositingInputs->ancestorOverfl owLayer : nullptr; }
579 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; } 590 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; } 591 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; } 592 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; } 593 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; } 594 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo sitingInputsUpdate); return m_hasAncestorWithClipPath; }
584 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC ompositingInputsUpdate); return m_hasDescendantWithClipPath; } 595 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC ompositingInputsUpdate); return m_hasDescendantWithClipPath; }
585 bool hasNonIsolatedDescendantWithBlendMode() const; 596 bool hasNonIsolatedDescendantWithBlendMode() const;
586 597
587 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()) ; return m_lostGroupedMapping; } 598 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()) ; return m_lostGroupedMapping; }
588 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } 599 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 void clearClipRectsCache() const { m_clipRectsCache.clear(); } 691 void clearClipRectsCache() const { m_clipRectsCache.clear(); }
681 692
682 private: 693 private:
683 // Bounding box in the coordinates of this layer. 694 // Bounding box in the coordinates of this layer.
684 LayoutRect logicalBoundingBox() const; 695 LayoutRect logicalBoundingBox() const;
685 696
686 bool hasOverflowControls() const; 697 bool hasOverflowControls() const;
687 698
688 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 699 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
689 700
690 // Returns true if the position changed.
691 bool updateLayerPosition();
692
693 void updateLayerPositionRecursive(); 701 void updateLayerPositionRecursive();
694 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled); 702 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled);
695 703
696 void setNextSibling(PaintLayer* next) { m_next = next; } 704 void setNextSibling(PaintLayer* next) { m_next = next; }
697 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; } 705 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; }
698 void setFirstChild(PaintLayer* first) { m_first = first; } 706 void setFirstChild(PaintLayer* first) { m_first = first; }
699 void setLastChild(PaintLayer* last) { m_last = last; } 707 void setLastChild(PaintLayer* last) { m_last = last; }
700 708
701 void updateHasSelfPaintingLayerDescendant() const; 709 void updateHasSelfPaintingLayerDescendant() const;
702 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&, 710 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 870
863 } // namespace blink 871 } // namespace blink
864 872
865 #ifndef NDEBUG 873 #ifndef NDEBUG
866 // Outside the WebCore namespace for ease of invocation from gdb. 874 // Outside the WebCore namespace for ease of invocation from gdb.
867 void showLayerTree(const blink::PaintLayer*); 875 void showLayerTree(const blink::PaintLayer*);
868 void showLayerTree(const blink::LayoutObject*); 876 void showLayerTree(const blink::LayoutObject*);
869 #endif 877 #endif
870 878
871 #endif // Layer_h 879 #endif // Layer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698