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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 DontConstrainForMask = 1 << 4, | 291 DontConstrainForMask = 1 << 4, |
292 IncludeCompositedDescendants = 1 << 5, | 292 IncludeCompositedDescendants = 1 << 5, |
293 UseFragmentBoxes = 1 << 6, | 293 UseFragmentBoxes = 1 << 6, |
294 PretendLayerHasOwnBacking = 1 << 7, | 294 PretendLayerHasOwnBacking = 1 << 7, |
295 DefaultCalculateLayerBoundsFlags = IncludeSelfTransform | UseLocalClipR
ectIfPossible | IncludeLayerFilterOutsets | UseFragmentBoxes | 295 DefaultCalculateLayerBoundsFlags = IncludeSelfTransform | UseLocalClipR
ectIfPossible | IncludeLayerFilterOutsets | UseFragmentBoxes |
296 }; | 296 }; |
297 typedef unsigned CalculateLayerBoundsFlags; | 297 typedef unsigned CalculateLayerBoundsFlags; |
298 | 298 |
299 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know
n. | 299 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know
n. |
300 LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFla
gs = 0, const LayoutPoint* offsetFromRoot = 0) const; | 300 LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFla
gs = 0, const LayoutPoint* offsetFromRoot = 0) const; |
301 // Bounding box in the coordinates of this layer. | |
302 LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const; | |
303 // Pixel snapped bounding box relative to the root. | |
304 IntRect absoluteBoundingBox() const; | |
305 | 301 |
306 // Bounds used for layer overlap testing in RenderLayerCompositor. | 302 // Bounds used for layer overlap testing in RenderLayerCompositor. |
307 LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? c
alculateLayerBounds(this) : localBoundingBox(); } | 303 LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? c
alculateLayerBounds(this) : localBoundingBox(); } |
308 | 304 |
309 // If true, this layer's children are included in its bounds for overlap tes
ting. | 305 // If true, this layer's children are included in its bounds for overlap tes
ting. |
310 // We can't rely on the children's positions if this layer has a filter that
could have moved the children's pixels around. | 306 // We can't rely on the children's positions if this layer has a filter that
could have moved the children's pixels around. |
311 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer()
->style()->filter().hasFilterThatMovesPixels(); } | 307 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer()
->style()->filter().hasFilterThatMovesPixels(); } |
312 | 308 |
313 // Can pass offsetFromRoot if known. | 309 // Can pass offsetFromRoot if known. |
314 LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const Layo
utPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBo
undsFlags) const; | 310 LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const Layo
utPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBo
undsFlags) const; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper
ties.offsetFromSquashingLayerOrigin = offset; } | 473 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper
ties.offsetFromSquashingLayerOrigin = offset; } |
478 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert
ies.offsetFromSquashingLayerOrigin; } | 474 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert
ies.offsetFromSquashingLayerOrigin; } |
479 | 475 |
480 bool scrollsOverflow() const; | 476 bool scrollsOverflow() const; |
481 | 477 |
482 bool hasDirectReasonsForCompositing() const { return compositingReasons() &
CompositingReasonComboAllDirectReasons; } | 478 bool hasDirectReasonsForCompositing() const { return compositingReasons() &
CompositingReasonComboAllDirectReasons; } |
483 CompositingReasons styleDeterminedCompositingReasons() const { return compos
itingReasons() & CompositingReasonComboAllStyleDeterminedReasons; } | 479 CompositingReasons styleDeterminedCompositingReasons() const { return compos
itingReasons() & CompositingReasonComboAllStyleDeterminedReasons; } |
484 | 480 |
485 void clearAncestorDependentPropertyCache(); | 481 void clearAncestorDependentPropertyCache(); |
486 | 482 |
| 483 const IntRect& absoluteBoundingBox() { ASSERT(!m_needsToRecomputeBounds); re
turn m_absoluteBoundingBox; } |
| 484 void setAbsoluteBoundingBox(const IntRect&); |
| 485 void clearNeedsToRecomputeBounds(); |
| 486 bool needsToRecomputeBounds() { return m_needsToRecomputeBounds; } |
487 | 487 |
488 private: | 488 private: |
489 class AncestorDependentPropertyCache { | 489 class AncestorDependentPropertyCache { |
490 WTF_MAKE_NONCOPYABLE(AncestorDependentPropertyCache); | 490 WTF_MAKE_NONCOPYABLE(AncestorDependentPropertyCache); |
491 public: | 491 public: |
492 AncestorDependentPropertyCache(); | 492 AncestorDependentPropertyCache(); |
493 | 493 |
494 RenderLayer* ancestorCompositedScrollingLayer() const; | 494 RenderLayer* ancestorCompositedScrollingLayer() const; |
495 void setAncestorCompositedScrollingLayer(RenderLayer*); | 495 void setAncestorCompositedScrollingLayer(RenderLayer*); |
496 | 496 |
497 RenderLayer* scrollParent() const; | 497 RenderLayer* scrollParent() const; |
498 void setScrollParent(RenderLayer*); | 498 void setScrollParent(RenderLayer*); |
499 | 499 |
500 bool ancestorCompositedScrollingLayerDirty() const { return m_ancestorCo
mpositedScrollingLayerDirty; } | 500 bool ancestorCompositedScrollingLayerDirty() const { return m_ancestorCo
mpositedScrollingLayerDirty; } |
501 bool scrollParentDirty() const { return m_scrollParentDirty; } | 501 bool scrollParentDirty() const { return m_scrollParentDirty; } |
502 | 502 |
503 private: | 503 private: |
504 RenderLayer* m_ancestorCompositedScrollingLayer; | 504 RenderLayer* m_ancestorCompositedScrollingLayer; |
505 RenderLayer* m_scrollParent; | 505 RenderLayer* m_scrollParent; |
506 | 506 |
507 bool m_ancestorCompositedScrollingLayerDirty; | 507 bool m_ancestorCompositedScrollingLayerDirty; |
508 bool m_scrollParentDirty; | 508 bool m_scrollParentDirty; |
509 }; | 509 }; |
510 | 510 |
511 void ensureAncestorDependentPropertyCache() const; | 511 void ensureAncestorDependentPropertyCache() const; |
512 | 512 |
| 513 // Bounding box in the coordinates of this layer. |
| 514 LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const; |
| 515 |
513 bool hasOverflowControls() const; | 516 bool hasOverflowControls() const; |
514 | 517 |
515 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } | 518 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } |
516 | 519 |
517 void setAncestorChainHasSelfPaintingLayerDescendant(); | 520 void setAncestorChainHasSelfPaintingLayerDescendant(); |
518 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 521 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
519 | 522 |
520 void setAncestorChainHasOutOfFlowPositionedDescendant(); | 523 void setAncestorChainHasOutOfFlowPositionedDescendant(); |
521 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 524 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
522 | 525 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 unsigned m_has3DTransformedDescendant : 1; | 706 unsigned m_has3DTransformedDescendant : 1; |
704 | 707 |
705 unsigned m_containsDirtyOverlayScrollbars : 1; | 708 unsigned m_containsDirtyOverlayScrollbars : 1; |
706 | 709 |
707 // This is an optimization added for <table>. | 710 // This is an optimization added for <table>. |
708 // Currently cells do not need to update their repaint rectangles when scrol
ling. This also | 711 // Currently cells do not need to update their repaint rectangles when scrol
ling. This also |
709 // saves a lot of time when scrolling on a table. | 712 // saves a lot of time when scrolling on a table. |
710 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; | 713 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; |
711 | 714 |
712 unsigned m_hasFilterInfo : 1; | 715 unsigned m_hasFilterInfo : 1; |
| 716 unsigned m_needsToRecomputeBounds : 1; |
713 | 717 |
714 RenderLayerModelObject* m_renderer; | 718 RenderLayerModelObject* m_renderer; |
715 | 719 |
716 RenderLayer* m_parent; | 720 RenderLayer* m_parent; |
717 RenderLayer* m_previous; | 721 RenderLayer* m_previous; |
718 RenderLayer* m_next; | 722 RenderLayer* m_next; |
719 RenderLayer* m_first; | 723 RenderLayer* m_first; |
720 RenderLayer* m_last; | 724 RenderLayer* m_last; |
721 | 725 |
722 // Our current relative position offset. | 726 // Our current relative position offset. |
723 LayoutSize m_offsetForInFlowPosition; | 727 LayoutSize m_offsetForInFlowPosition; |
724 | 728 |
725 // Our (x,y) coordinates are in our parent layer's coordinate space. | 729 // Our (x,y) coordinates are in our parent layer's coordinate space. |
726 LayoutPoint m_topLeft; | 730 LayoutPoint m_topLeft; |
727 | 731 |
728 // The layer's width/height | 732 // The layer's width/height |
729 IntSize m_layerSize; | 733 IntSize m_layerSize; |
730 | 734 |
731 // Cached normal flow values for absolute positioned elements with static le
ft/top values. | 735 // Cached normal flow values for absolute positioned elements with static le
ft/top values. |
732 LayoutUnit m_staticInlinePosition; | 736 LayoutUnit m_staticInlinePosition; |
733 LayoutUnit m_staticBlockPosition; | 737 LayoutUnit m_staticBlockPosition; |
734 | 738 |
| 739 IntRect m_absoluteBoundingBox; |
| 740 |
735 OwnPtr<TransformationMatrix> m_transform; | 741 OwnPtr<TransformationMatrix> m_transform; |
736 | 742 |
737 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i
s 0 if we are not paginated. | 743 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i
s 0 if we are not paginated. |
738 RenderLayer* m_enclosingPaginationLayer; | 744 RenderLayer* m_enclosingPaginationLayer; |
739 | 745 |
740 // Pointer to the enclosing RenderLayer that establishes the 3d rendering co
ntext in which this layer participates. | 746 // Pointer to the enclosing RenderLayer that establishes the 3d rendering co
ntext in which this layer participates. |
741 // If it 0, it does not participate in a 3d rendering context. | 747 // If it 0, it does not participate in a 3d rendering context. |
742 RenderLayer* m_3dRenderingContextRoot; | 748 RenderLayer* m_3dRenderingContextRoot; |
743 | 749 |
744 // Properties that are computed while updating compositing layers. These val
ues may be dirty/invalid if | 750 // Properties that are computed while updating compositing layers. These val
ues may be dirty/invalid if |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 803 |
798 } // namespace WebCore | 804 } // namespace WebCore |
799 | 805 |
800 #ifndef NDEBUG | 806 #ifndef NDEBUG |
801 // Outside the WebCore namespace for ease of invocation from gdb. | 807 // Outside the WebCore namespace for ease of invocation from gdb. |
802 void showLayerTree(const WebCore::RenderLayer*); | 808 void showLayerTree(const WebCore::RenderLayer*); |
803 void showLayerTree(const WebCore::RenderObject*); | 809 void showLayerTree(const WebCore::RenderObject*); |
804 #endif | 810 #endif |
805 | 811 |
806 #endif // RenderLayer_h | 812 #endif // RenderLayer_h |
OLD | NEW |