OLD | NEW |
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 Loading... |
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 , nearestFixedPositionLayer(nullptr) | 537 , nearestFixedPositionLayer(nullptr) |
536 , scrollParent(nullptr) | 538 , scrollParent(nullptr) |
537 , clipParent(nullptr) | 539 , clipParent(nullptr) |
538 { } | 540 { } |
539 | 541 |
540 bool isDefault() const { return !opacityAncestor && !transformAncestor &
& !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s
crollParent && !clipParent; } | 542 bool isDefault() const { return !opacityAncestor && !transformAncestor &
& !filterAncestor && !ancestorScrollingLayer && !nearestFixedPositionLayer && !s
crollParent && !clipParent; } |
541 | 543 |
542 const PaintLayer* opacityAncestor; | 544 const PaintLayer* opacityAncestor; |
543 const PaintLayer* transformAncestor; | 545 const PaintLayer* transformAncestor; |
544 const PaintLayer* filterAncestor; | 546 const PaintLayer* filterAncestor; |
| 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. |
545 const PaintLayer* ancestorScrollingLayer; | 551 const PaintLayer* ancestorScrollingLayer; |
546 const PaintLayer* nearestFixedPositionLayer; | 552 const PaintLayer* nearestFixedPositionLayer; |
547 | 553 |
548 // 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 |
549 // 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 |
550 // scroll parent if neither its compositor scrolling ancestor, nor any | 556 // scroll parent if neither its compositor scrolling ancestor, nor any |
551 // 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 |
552 // layer. Layers with scroll parents must be scrolled with the main | 558 // layer. Layers with scroll parents must be scrolled with the main |
553 // scrolling layer by the compositor. | 559 // scrolling layer by the compositor. |
554 const PaintLayer* scrollParent; | 560 const PaintLayer* scrollParent; |
555 | 561 |
556 // A clip parent is another compositor concept that has leaked into | 562 // A clip parent is another compositor concept that has leaked into |
557 // blink so that it may be used as a promotion trigger. Layers with clip | 563 // blink so that it may be used as a promotion trigger. Layers with clip |
558 // parents escape the clip of a stacking tree ancestor. The compositor | 564 // parents escape the clip of a stacking tree ancestor. The compositor |
559 // needs to know about clip parents in order to circumvent its normal | 565 // needs to know about clip parents in order to circumvent its normal |
560 // clipping logic. | 566 // clipping logic. |
561 const PaintLayer* clipParent; | 567 const PaintLayer* clipParent; |
562 }; | 568 }; |
563 | 569 |
564 void setNeedsCompositingInputsUpdate(); | 570 void setNeedsCompositingInputsUpdate(); |
565 bool childNeedsCompositingInputsUpdate() const { return m_childNeedsComposit
ingInputsUpdate; } | 571 bool childNeedsCompositingInputsUpdate() const { return m_childNeedsComposit
ingInputsUpdate; } |
566 bool needsCompositingInputsUpdate() const | 572 bool needsCompositingInputsUpdate() const |
567 { | 573 { |
568 // While we're updating the compositing inputs, these values may differ. | 574 // While we're updating the compositing inputs, these values may differ. |
569 // We should never be asking for this value when that is the case. | 575 // We should never be asking for this value when that is the case. |
570 ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAnces
torDependentCompositingInputsUpdate); | 576 ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAnces
torDependentCompositingInputsUpdate); |
571 return m_needsDescendantDependentCompositingInputsUpdate; | 577 return m_needsDescendantDependentCompositingInputsUpdate; |
572 } | 578 } |
573 | 579 |
| 580 void updateAncestorOverflowLayer(const PaintLayer* ancestorOverflowLayer) {
m_ancestorOverflowLayer = ancestorOverflowLayer; } |
574 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi
tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith
ClipPath); | 581 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi
tingInputs&, const RareAncestorDependentCompositingInputs&, bool hasAncestorWith
ClipPath); |
575 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa
th, bool hasNonIsolatedDescendantWithBlendMode); | 582 void updateDescendantDependentCompositingInputs(bool hasDescendantWithClipPa
th, bool hasNonIsolatedDescendantWithBlendMode); |
576 void didUpdateCompositingInputs(); | 583 void didUpdateCompositingInputs(); |
577 | 584 |
578 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen
tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb
soluteBoundingBox; } | 585 IntRect clippedAbsoluteBoundingBox() const { ASSERT(!m_needsAncestorDependen
tCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippedAb
soluteBoundingBox; } |
579 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent
CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra
reAncestorDependentCompositingInputs->opacityAncestor : nullptr; } | 586 const PaintLayer* opacityAncestor() const { ASSERT(!m_needsAncestorDependent
CompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_ra
reAncestorDependentCompositingInputs->opacityAncestor : nullptr; } |
580 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende
ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_
rareAncestorDependentCompositingInputs->transformAncestor : nullptr; } | 587 const PaintLayer* transformAncestor() const { ASSERT(!m_needsAncestorDepende
ntCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_
rareAncestorDependentCompositingInputs->transformAncestor : nullptr; } |
581 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC
ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar
eAncestorDependentCompositingInputs->filterAncestor : nullptr; } | 588 const PaintLayer* filterAncestor() const { ASSERT(!m_needsAncestorDependentC
ompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rar
eAncestorDependentCompositingInputs->filterAncestor : nullptr; } |
582 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen
dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi
ngContainer; } | 589 const LayoutObject* clippingContainer() const { ASSERT(!m_needsAncestorDepen
dentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs.clippi
ngContainer; } |
| 590 const PaintLayer* ancestorOverflowLayer() const { return m_ancestorOverflowL
ayer; } |
583 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe
pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs
? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; } | 591 const PaintLayer* ancestorScrollingLayer() const { ASSERT(!m_needsAncestorDe
pendentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInputs
? m_rareAncestorDependentCompositingInputs->ancestorScrollingLayer : nullptr; } |
584 const PaintLayer* nearestFixedPositionLayer() const { ASSERT(!m_needsAncesto
rDependentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInp
uts ? m_rareAncestorDependentCompositingInputs->nearestFixedPositionLayer : null
ptr; } | 592 const PaintLayer* nearestFixedPositionLayer() const { ASSERT(!m_needsAncesto
rDependentCompositingInputsUpdate); return m_rareAncestorDependentCompositingInp
uts ? m_rareAncestorDependentCompositingInputs->nearestFixedPositionLayer : null
ptr; } |
585 const PaintLayer* scrollParent() const { ASSERT(!m_needsAncestorDependentCom
positingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareA
ncestorDependentCompositingInputs->scrollParent : nullptr; } | 593 const PaintLayer* scrollParent() const { ASSERT(!m_needsAncestorDependentCom
positingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareA
ncestorDependentCompositingInputs->scrollParent : nullptr; } |
586 const PaintLayer* clipParent() const { ASSERT(!m_needsAncestorDependentCompo
sitingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAnc
estorDependentCompositingInputs->clipParent : nullptr; } | 594 const PaintLayer* clipParent() const { ASSERT(!m_needsAncestorDependentCompo
sitingInputsUpdate); return m_rareAncestorDependentCompositingInputs ? m_rareAnc
estorDependentCompositingInputs->clipParent : nullptr; } |
587 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo
sitingInputsUpdate); return m_hasAncestorWithClipPath; } | 595 bool hasAncestorWithClipPath() const { ASSERT(!m_needsAncestorDependentCompo
sitingInputsUpdate); return m_hasAncestorWithClipPath; } |
588 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC
ompositingInputsUpdate); return m_hasDescendantWithClipPath; } | 596 bool hasDescendantWithClipPath() const { ASSERT(!m_needsDescendantDependentC
ompositingInputsUpdate); return m_hasDescendantWithClipPath; } |
589 bool hasNonIsolatedDescendantWithBlendMode() const; | 597 bool hasNonIsolatedDescendantWithBlendMode() const; |
590 | 598 |
591 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } | 599 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } |
592 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } | 600 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 void clearClipRectsCache() const { m_clipRectsCache.clear(); } | 699 void clearClipRectsCache() const { m_clipRectsCache.clear(); } |
692 | 700 |
693 private: | 701 private: |
694 // Bounding box in the coordinates of this layer. | 702 // Bounding box in the coordinates of this layer. |
695 LayoutRect logicalBoundingBox() const; | 703 LayoutRect logicalBoundingBox() const; |
696 | 704 |
697 bool hasOverflowControls() const; | 705 bool hasOverflowControls() const; |
698 | 706 |
699 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 707 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
700 | 708 |
701 // Returns true if the position changed. | |
702 bool updateLayerPosition(); | |
703 | |
704 void updateLayerPositionRecursive(); | 709 void updateLayerPositionRecursive(); |
705 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta,
bool paintInvalidationContainerWasScrolled); | 710 void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta,
bool paintInvalidationContainerWasScrolled); |
706 | 711 |
707 void setNextSibling(PaintLayer* next) { m_next = next; } | 712 void setNextSibling(PaintLayer* next) { m_next = next; } |
708 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; } | 713 void setPreviousSibling(PaintLayer* prev) { m_previous = prev; } |
709 void setFirstChild(PaintLayer* first) { m_first = first; } | 714 void setFirstChild(PaintLayer* first) { m_first = first; } |
710 void setLastChild(PaintLayer* last) { m_last = last; } | 715 void setLastChild(PaintLayer* last) { m_last = last; } |
711 | 716 |
712 void updateHasSelfPaintingLayerDescendant() const; | 717 void updateHasSelfPaintingLayerDescendant() const; |
713 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer,
HitTestResult&, | 718 PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer,
HitTestResult&, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 | 755 |
751 void dirtyAncestorChainVisibleDescendantStatus(); | 756 void dirtyAncestorChainVisibleDescendantStatus(); |
752 | 757 |
753 bool attemptDirectCompositingUpdate(StyleDifference, const ComputedStyle* ol
dStyle); | 758 bool attemptDirectCompositingUpdate(StyleDifference, const ComputedStyle* ol
dStyle); |
754 void updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& new
Style); | 759 void updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& new
Style); |
755 | 760 |
756 void dirty3DTransformedDescendantStatus(); | 761 void dirty3DTransformedDescendantStatus(); |
757 // Both updates the status, and returns true if descendants of this have 3d. | 762 // Both updates the status, and returns true if descendants of this have 3d. |
758 bool update3DTransformedDescendantStatus(); | 763 bool update3DTransformedDescendantStatus(); |
759 | 764 |
| 765 void removeAncestorOverflowLayer(const PaintLayer* removedLayer); |
| 766 |
760 void updateOrRemoveFilterClients(); | 767 void updateOrRemoveFilterClients(); |
761 | 768 |
762 void updatePaginationRecursive(bool needsPaginationUpdate = false); | 769 void updatePaginationRecursive(bool needsPaginationUpdate = false); |
763 void clearPaginationRecursive(); | 770 void clearPaginationRecursive(); |
764 | 771 |
765 void markCompositingContainerChainForNeedsRepaint(); | 772 void markCompositingContainerChainForNeedsRepaint(); |
766 | 773 |
767 PaintLayerRareData& ensureRareData() | 774 PaintLayerRareData& ensureRareData() |
768 { | 775 { |
769 if (!m_rareData) | 776 if (!m_rareData) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 // The layer's size. | 861 // The layer's size. |
855 // | 862 // |
856 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border | 863 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border |
857 // box. Otherwise, this is the LayoutInline's lines' bounding box. | 864 // box. Otherwise, this is the LayoutInline's lines' bounding box. |
858 IntSize m_size; | 865 IntSize m_size; |
859 | 866 |
860 // Cached normal flow values for absolute positioned elements with static le
ft/top values. | 867 // Cached normal flow values for absolute positioned elements with static le
ft/top values. |
861 LayoutUnit m_staticInlinePosition; | 868 LayoutUnit m_staticInlinePosition; |
862 LayoutUnit m_staticBlockPosition; | 869 LayoutUnit m_staticBlockPosition; |
863 | 870 |
| 871 // The first ancestor having a non visible overflow. |
| 872 const PaintLayer* m_ancestorOverflowLayer; |
| 873 |
864 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; | 874 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; |
865 OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompos
itingInputs; | 875 OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompos
itingInputs; |
866 | 876 |
867 Persistent<PaintLayerScrollableArea> m_scrollableArea; | 877 Persistent<PaintLayerScrollableArea> m_scrollableArea; |
868 | 878 |
869 mutable OwnPtr<ClipRectsCache> m_clipRectsCache; | 879 mutable OwnPtr<ClipRectsCache> m_clipRectsCache; |
870 | 880 |
871 OwnPtr<PaintLayerStackingNode> m_stackingNode; | 881 OwnPtr<PaintLayerStackingNode> m_stackingNode; |
872 | 882 |
873 IntSize m_previousScrollOffsetAccumulationForPainting; | 883 IntSize m_previousScrollOffsetAccumulationForPainting; |
874 RefPtr<ClipRects> m_previousPaintingClipRects; | 884 RefPtr<ClipRects> m_previousPaintingClipRects; |
875 LayoutRect m_previousPaintDirtyRect; | 885 LayoutRect m_previousPaintDirtyRect; |
876 | 886 |
877 OwnPtr<PaintLayerRareData> m_rareData; | 887 OwnPtr<PaintLayerRareData> m_rareData; |
878 }; | 888 }; |
879 | 889 |
880 } // namespace blink | 890 } // namespace blink |
881 | 891 |
882 #ifndef NDEBUG | 892 #ifndef NDEBUG |
883 // Outside the WebCore namespace for ease of invocation from gdb. | 893 // Outside the WebCore namespace for ease of invocation from gdb. |
884 void showLayerTree(const blink::PaintLayer*); | 894 void showLayerTree(const blink::PaintLayer*); |
885 void showLayerTree(const blink::LayoutObject*); | 895 void showLayerTree(const blink::LayoutObject*); |
886 #endif | 896 #endif |
887 | 897 |
888 #endif // Layer_h | 898 #endif // Layer_h |
OLD | NEW |