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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 */ | 43 */ |
44 | 44 |
45 #ifndef RenderLayer_h | 45 #ifndef RenderLayer_h |
46 #define RenderLayer_h | 46 #define RenderLayer_h |
47 | 47 |
48 #include "core/rendering/CompositedLayerMappingPtr.h" | 48 #include "core/rendering/CompositedLayerMappingPtr.h" |
49 #include "core/rendering/CompositingReasons.h" | 49 #include "core/rendering/CompositingReasons.h" |
50 #include "core/rendering/LayerPaintingInfo.h" | 50 #include "core/rendering/LayerPaintingInfo.h" |
51 #include "core/rendering/PaintInfo.h" | 51 #include "core/rendering/PaintInfo.h" |
52 #include "core/rendering/RenderBox.h" | 52 #include "core/rendering/RenderBox.h" |
| 53 #include "core/rendering/RenderLayerBlendInfo.h" |
53 #include "core/rendering/RenderLayerClipper.h" | 54 #include "core/rendering/RenderLayerClipper.h" |
54 #include "core/rendering/RenderLayerFilterInfo.h" | 55 #include "core/rendering/RenderLayerFilterInfo.h" |
55 #include "core/rendering/RenderLayerReflectionInfo.h" | 56 #include "core/rendering/RenderLayerReflectionInfo.h" |
56 #include "core/rendering/RenderLayerRepainter.h" | 57 #include "core/rendering/RenderLayerRepainter.h" |
57 #include "core/rendering/RenderLayerScrollableArea.h" | 58 #include "core/rendering/RenderLayerScrollableArea.h" |
58 #include "core/rendering/RenderLayerStackingNode.h" | 59 #include "core/rendering/RenderLayerStackingNode.h" |
59 #include "core/rendering/RenderLayerStackingNodeIterator.h" | 60 #include "core/rendering/RenderLayerStackingNodeIterator.h" |
60 #include "wtf/OwnPtr.h" | 61 #include "wtf/OwnPtr.h" |
61 | 62 |
62 namespace WebCore { | 63 namespace WebCore { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLay
erPositionsFlags); | 161 void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLay
erPositionsFlags); |
161 | 162 |
162 void updateLayerPositionsAfterOverflowScroll(); | 163 void updateLayerPositionsAfterOverflowScroll(); |
163 void updateLayerPositionsAfterDocumentScroll(); | 164 void updateLayerPositionsAfterDocumentScroll(); |
164 | 165 |
165 bool isPaginated() const { return m_isPaginated; } | 166 bool isPaginated() const { return m_isPaginated; } |
166 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination
Layer; } | 167 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination
Layer; } |
167 | 168 |
168 void updateTransform(); | 169 void updateTransform(); |
169 | 170 |
170 void updateBlendMode(); | |
171 | |
172 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow
Position; } | 171 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow
Position; } |
173 | 172 |
174 void addBlockSelectionGapsBounds(const LayoutRect&); | 173 void addBlockSelectionGapsBounds(const LayoutRect&); |
175 void clearBlockSelectionGapsBounds(); | 174 void clearBlockSelectionGapsBounds(); |
176 void repaintBlockSelectionGaps(); | 175 void repaintBlockSelectionGaps(); |
177 bool hasBlockSelectionGapBounds() const; | 176 bool hasBlockSelectionGapBounds() const; |
178 | 177 |
179 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } | 178 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } |
180 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } | 179 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } |
181 | 180 |
(...skipping 17 matching lines...) Expand all Loading... |
199 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but
we hit the same bugs as visible content above. | 198 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but
we hit the same bugs as visible content above. |
200 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. | 199 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. |
201 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } | 200 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } |
202 | 201 |
203 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S
ee above. | 202 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S
ee above. |
204 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } | 203 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } |
205 | 204 |
206 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo
wPositionedDescendant = hasDescendant; } | 205 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo
wPositionedDescendant = hasDescendant; } |
207 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo
sitionedDescendantDirty = dirty; } | 206 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo
sitionedDescendantDirty = dirty; } |
208 | 207 |
209 bool childLayerHasBlendMode() const { ASSERT(!m_childLayerHasBlendModeStatus
Dirty); return m_childLayerHasBlendMode; } | |
210 | |
211 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } | 208 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } |
212 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan
t = hasDescendant; } | 209 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan
t = hasDescendant; } |
213 void updateHasUnclippedDescendant(); | 210 void updateHasUnclippedDescendant(); |
214 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } | 211 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } |
215 | 212 |
216 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} | 213 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} |
217 void updateHasVisibleNonLayerContent(); | 214 void updateHasVisibleNonLayerContent(); |
218 | 215 |
219 // Gets the nearest enclosing positioned ancestor layer (also includes | 216 // Gets the nearest enclosing positioned ancestor layer (also includes |
220 // the <html> layer and the root layer). | 217 // the <html> layer and the root layer). |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Returns true if the layer has a -webkit-perspective. | 326 // Returns true if the layer has a -webkit-perspective. |
330 // Note that this transform has the perspective-origin baked in. | 327 // Note that this transform has the perspective-origin baked in. |
331 TransformationMatrix perspectiveTransform() const; | 328 TransformationMatrix perspectiveTransform() const; |
332 FloatPoint perspectiveOrigin() const; | 329 FloatPoint perspectiveOrigin() const; |
333 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } | 330 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } |
334 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } | 331 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } |
335 | 332 |
336 void filterNeedsRepaint(); | 333 void filterNeedsRepaint(); |
337 bool hasFilter() const { return renderer()->hasFilter(); } | 334 bool hasFilter() const { return renderer()->hasFilter(); } |
338 | 335 |
339 bool hasBlendMode() const; | 336 bool paintsWithBlendMode() const { return m_blendInfo.hasBlendMode() && comp
ositingState() != PaintsIntoOwnBacking; } |
340 bool paintsWithBlendMode() const { return hasBlendMode() && compositingState
() != PaintsIntoOwnBacking; } | |
341 | 337 |
342 void* operator new(size_t); | 338 void* operator new(size_t); |
343 // Only safe to call from RenderLayerModelObject::destroyLayer() | 339 // Only safe to call from RenderLayerModelObject::destroyLayer() |
344 void operator delete(void*); | 340 void operator delete(void*); |
345 | 341 |
346 CompositingState compositingState() const; | 342 CompositingState compositingState() const; |
347 | 343 |
348 CompositedLayerMappingPtr compositedLayerMapping() const { return m_composit
edLayerMapping.get(); } | 344 CompositedLayerMappingPtr compositedLayerMapping() const { return m_composit
edLayerMapping.get(); } |
349 CompositedLayerMappingPtr ensureCompositedLayerMapping(); | 345 CompositedLayerMappingPtr ensureCompositedLayerMapping(); |
350 | 346 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 // RenderObject::canContainFixedPositionedObject() should probably be us
ed | 432 // RenderObject::canContainFixedPositionedObject() should probably be us
ed |
437 // instead. | 433 // instead. |
438 RenderLayerModelObject* layerRenderer = renderer(); | 434 RenderLayerModelObject* layerRenderer = renderer(); |
439 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); | 435 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); |
440 } | 436 } |
441 | 437 |
442 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; | 438 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; |
443 | 439 |
444 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; | 440 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; |
445 | 441 |
| 442 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; } |
| 443 |
446 private: | 444 private: |
447 bool hasOverflowControls() const; | 445 bool hasOverflowControls() const; |
448 | 446 |
449 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } | 447 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } |
450 | 448 |
451 void setAncestorChainHasSelfPaintingLayerDescendant(); | 449 void setAncestorChainHasSelfPaintingLayerDescendant(); |
452 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 450 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
453 | 451 |
454 void setAncestorChainHasOutOfFlowPositionedDescendant(); | 452 void setAncestorChainHasOutOfFlowPositionedDescendant(); |
455 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 453 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 bool requiresScrollableArea() const { return renderBox(); } | 558 bool requiresScrollableArea() const { return renderBox(); } |
561 void updateScrollableArea(); | 559 void updateScrollableArea(); |
562 | 560 |
563 // Returns true our scrollable area is in the FrameView's collection of scro
llable areas. This can | 561 // Returns true our scrollable area is in the FrameView's collection of scro
llable areas. This can |
564 // only happen if we're both scrollable, and we do in fact overflow. | 562 // only happen if we're both scrollable, and we do in fact overflow. |
565 bool scrollsOverflow() const; | 563 bool scrollsOverflow() const; |
566 | 564 |
567 void dirtyAncestorChainVisibleDescendantStatus(); | 565 void dirtyAncestorChainVisibleDescendantStatus(); |
568 void setAncestorChainHasVisibleDescendant(); | 566 void setAncestorChainHasVisibleDescendant(); |
569 | 567 |
570 void dirtyAncestorChainBlendedDescendantStatus(); | |
571 void setAncestorChainBlendedDescendant(); | |
572 | |
573 void updateDescendantDependentFlags(); | 568 void updateDescendantDependentFlags(); |
574 | 569 |
575 // This flag is computed by RenderLayerCompositor, which knows more about 3d
hierarchies than we do. | 570 // This flag is computed by RenderLayerCompositor, which knows more about 3d
hierarchies than we do. |
576 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant =
b; } | 571 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant =
b; } |
577 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } | 572 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } |
578 | 573 |
579 void dirty3DTransformedDescendantStatus(); | 574 void dirty3DTransformedDescendantStatus(); |
580 // Both updates the status, and returns true if descendants of this have 3d. | 575 // Both updates the status, and returns true if descendants of this have 3d. |
581 bool update3DTransformedDescendantStatus(); | 576 bool update3DTransformedDescendantStatus(); |
582 | 577 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 unsigned m_hasUnclippedDescendant : 1; | 621 unsigned m_hasUnclippedDescendant : 1; |
627 | 622 |
628 unsigned m_isUnclippedDescendant : 1; | 623 unsigned m_isUnclippedDescendant : 1; |
629 | 624 |
630 const unsigned m_isRootLayer : 1; | 625 const unsigned m_isRootLayer : 1; |
631 | 626 |
632 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp
arent layer, i.e., whether | 627 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp
arent layer, i.e., whether |
633 // we ended up painting this layer or any desce
ndants (and therefore need to | 628 // we ended up painting this layer or any desce
ndants (and therefore need to |
634 // blend). | 629 // blend). |
635 | 630 |
636 unsigned m_childLayerHasBlendMode : 1; | |
637 unsigned m_childLayerHasBlendModeStatusDirty : 1; | |
638 | |
639 unsigned m_visibleContentStatusDirty : 1; | 631 unsigned m_visibleContentStatusDirty : 1; |
640 unsigned m_hasVisibleContent : 1; | 632 unsigned m_hasVisibleContent : 1; |
641 unsigned m_visibleDescendantStatusDirty : 1; | 633 unsigned m_visibleDescendantStatusDirty : 1; |
642 unsigned m_hasVisibleDescendant : 1; | 634 unsigned m_hasVisibleDescendant : 1; |
643 | 635 |
644 unsigned m_hasVisibleNonLayerContent : 1; | 636 unsigned m_hasVisibleNonLayerContent : 1; |
645 | 637 |
646 unsigned m_isPaginated : 1; // If we think this layer is split by a multi-co
lumn ancestor, then this bit will be set. | 638 unsigned m_isPaginated : 1; // If we think this layer is split by a multi-co
lumn ancestor, then this bit will be set. |
647 | 639 |
648 unsigned m_3DTransformedDescendantStatusDirty : 1; | 640 unsigned m_3DTransformedDescendantStatusDirty : 1; |
649 // Set on a stacking context layer that has 3D descendants anywhere | 641 // Set on a stacking context layer that has 3D descendants anywhere |
650 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. | 642 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. |
651 unsigned m_has3DTransformedDescendant : 1; | 643 unsigned m_has3DTransformedDescendant : 1; |
652 | 644 |
653 unsigned m_containsDirtyOverlayScrollbars : 1; | 645 unsigned m_containsDirtyOverlayScrollbars : 1; |
654 | 646 |
655 // This is an optimization added for <table>. | 647 // This is an optimization added for <table>. |
656 // Currently cells do not need to update their repaint rectangles when scrol
ling. This also | 648 // Currently cells do not need to update their repaint rectangles when scrol
ling. This also |
657 // saves a lot of time when scrolling on a table. | 649 // saves a lot of time when scrolling on a table. |
658 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; | 650 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; |
659 | 651 |
660 unsigned m_hasFilterInfo : 1; | 652 unsigned m_hasFilterInfo : 1; |
661 | 653 |
662 blink::WebBlendMode m_blendMode; | |
663 | |
664 RenderLayerModelObject* m_renderer; | 654 RenderLayerModelObject* m_renderer; |
665 | 655 |
666 RenderLayer* m_parent; | 656 RenderLayer* m_parent; |
667 RenderLayer* m_previous; | 657 RenderLayer* m_previous; |
668 RenderLayer* m_next; | 658 RenderLayer* m_next; |
669 RenderLayer* m_first; | 659 RenderLayer* m_first; |
670 RenderLayer* m_last; | 660 RenderLayer* m_last; |
671 | 661 |
672 // Our current relative position offset. | 662 // Our current relative position offset. |
673 LayoutSize m_offsetForInFlowPosition; | 663 LayoutSize m_offsetForInFlowPosition; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 713 |
724 IntRect m_blockSelectionGapsBounds; | 714 IntRect m_blockSelectionGapsBounds; |
725 | 715 |
726 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; | 716 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; |
727 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; | 717 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; |
728 | 718 |
729 RenderLayerRepainter m_repainter; | 719 RenderLayerRepainter m_repainter; |
730 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? | 720 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? |
731 OwnPtr<RenderLayerStackingNode> m_stackingNode; | 721 OwnPtr<RenderLayerStackingNode> m_stackingNode; |
732 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; | 722 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; |
| 723 RenderLayerBlendInfo m_blendInfo; |
733 }; | 724 }; |
734 | 725 |
735 } // namespace WebCore | 726 } // namespace WebCore |
736 | 727 |
737 #ifndef NDEBUG | 728 #ifndef NDEBUG |
738 // Outside the WebCore namespace for ease of invocation from gdb. | 729 // Outside the WebCore namespace for ease of invocation from gdb. |
739 void showLayerTree(const WebCore::RenderLayer*); | 730 void showLayerTree(const WebCore::RenderLayer*); |
740 void showLayerTree(const WebCore::RenderObject*); | 731 void showLayerTree(const WebCore::RenderObject*); |
741 #endif | 732 #endif |
742 | 733 |
743 #endif // RenderLayer_h | 734 #endif // RenderLayer_h |
OLD | NEW |