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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 * version of this file under any of the LGPL, the MPL or the GPL. | 42 * version of this file under any of the LGPL, the MPL or the GPL. |
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/RenderBox.h" | 51 #include "core/rendering/RenderBox.h" |
| 52 #include "core/rendering/RenderLayerBlendInfo.h" |
52 #include "core/rendering/RenderLayerClipper.h" | 53 #include "core/rendering/RenderLayerClipper.h" |
53 #include "core/rendering/RenderLayerFilterInfo.h" | 54 #include "core/rendering/RenderLayerFilterInfo.h" |
54 #include "core/rendering/RenderLayerReflectionInfo.h" | 55 #include "core/rendering/RenderLayerReflectionInfo.h" |
55 #include "core/rendering/RenderLayerRepainter.h" | 56 #include "core/rendering/RenderLayerRepainter.h" |
56 #include "core/rendering/RenderLayerScrollableArea.h" | 57 #include "core/rendering/RenderLayerScrollableArea.h" |
57 #include "core/rendering/RenderLayerStackingNode.h" | 58 #include "core/rendering/RenderLayerStackingNode.h" |
58 #include "core/rendering/RenderLayerStackingNodeIterator.h" | 59 #include "core/rendering/RenderLayerStackingNodeIterator.h" |
59 #include "wtf/OwnPtr.h" | 60 #include "wtf/OwnPtr.h" |
60 | 61 |
61 namespace WebCore { | 62 namespace WebCore { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLay
erPositionsFlags); | 156 void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLay
erPositionsFlags); |
156 | 157 |
157 void updateLayerPositionsAfterOverflowScroll(); | 158 void updateLayerPositionsAfterOverflowScroll(); |
158 void updateLayerPositionsAfterDocumentScroll(); | 159 void updateLayerPositionsAfterDocumentScroll(); |
159 | 160 |
160 bool isPaginated() const { return m_isPaginated; } | 161 bool isPaginated() const { return m_isPaginated; } |
161 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination
Layer; } | 162 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination
Layer; } |
162 | 163 |
163 void updateTransform(); | 164 void updateTransform(); |
164 | 165 |
165 void updateBlendMode(); | |
166 | |
167 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow
Position; } | 166 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow
Position; } |
168 | 167 |
169 void addBlockSelectionGapsBounds(const LayoutRect&); | 168 void addBlockSelectionGapsBounds(const LayoutRect&); |
170 void clearBlockSelectionGapsBounds(); | 169 void clearBlockSelectionGapsBounds(); |
171 void repaintBlockSelectionGaps(); | 170 void repaintBlockSelectionGaps(); |
172 bool hasBlockSelectionGapBounds() const; | 171 bool hasBlockSelectionGapBounds() const; |
173 | 172 |
174 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } | 173 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } |
175 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } | 174 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } |
176 | 175 |
(...skipping 17 matching lines...) Expand all Loading... |
194 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but
we hit the same bugs as visible content above. | 193 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but
we hit the same bugs as visible content above. |
195 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. | 194 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. |
196 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } | 195 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } |
197 | 196 |
198 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S
ee above. | 197 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S
ee above. |
199 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } | 198 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } |
200 | 199 |
201 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo
wPositionedDescendant = hasDescendant; } | 200 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo
wPositionedDescendant = hasDescendant; } |
202 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo
sitionedDescendantDirty = dirty; } | 201 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo
sitionedDescendantDirty = dirty; } |
203 | 202 |
204 bool childLayerHasBlendMode() const { ASSERT(!m_childLayerHasBlendModeStatus
Dirty); return m_childLayerHasBlendMode; } | |
205 | |
206 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } | 203 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } |
207 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan
t = hasDescendant; } | 204 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan
t = hasDescendant; } |
208 void updateHasUnclippedDescendant(); | 205 void updateHasUnclippedDescendant(); |
209 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } | 206 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } |
210 | 207 |
211 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} | 208 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} |
212 void updateHasVisibleNonLayerContent(); | 209 void updateHasVisibleNonLayerContent(); |
213 | 210 |
214 // Gets the nearest enclosing positioned ancestor layer (also includes | 211 // Gets the nearest enclosing positioned ancestor layer (also includes |
215 // the <html> layer and the root layer). | 212 // the <html> layer and the root layer). |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Returns true if the layer has a -webkit-perspective. | 307 // Returns true if the layer has a -webkit-perspective. |
311 // Note that this transform has the perspective-origin baked in. | 308 // Note that this transform has the perspective-origin baked in. |
312 TransformationMatrix perspectiveTransform() const; | 309 TransformationMatrix perspectiveTransform() const; |
313 FloatPoint perspectiveOrigin() const; | 310 FloatPoint perspectiveOrigin() const; |
314 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } | 311 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } |
315 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } | 312 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } |
316 | 313 |
317 void filterNeedsRepaint(); | 314 void filterNeedsRepaint(); |
318 bool hasFilter() const { return renderer()->hasFilter(); } | 315 bool hasFilter() const { return renderer()->hasFilter(); } |
319 | 316 |
320 bool hasBlendMode() const; | 317 bool paintsWithBlendMode() const { return m_blendInfo.hasBlendMode() && comp
ositingState() != PaintsIntoOwnBacking; } |
321 bool paintsWithBlendMode() const { return hasBlendMode() && compositingState
() != PaintsIntoOwnBacking; } | |
322 | 318 |
323 void* operator new(size_t); | 319 void* operator new(size_t); |
324 // Only safe to call from RenderLayerModelObject::destroyLayer() | 320 // Only safe to call from RenderLayerModelObject::destroyLayer() |
325 void operator delete(void*); | 321 void operator delete(void*); |
326 | 322 |
327 CompositingState compositingState() const; | 323 CompositingState compositingState() const; |
328 | 324 |
329 CompositedLayerMappingPtr compositedLayerMapping() const { return m_composit
edLayerMapping.get(); } | 325 CompositedLayerMappingPtr compositedLayerMapping() const { return m_composit
edLayerMapping.get(); } |
330 CompositedLayerMappingPtr ensureCompositedLayerMapping(); | 326 CompositedLayerMappingPtr ensureCompositedLayerMapping(); |
331 | 327 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // RenderObject::canContainFixedPositionedObject() should probably be us
ed | 418 // RenderObject::canContainFixedPositionedObject() should probably be us
ed |
423 // instead. | 419 // instead. |
424 RenderLayerModelObject* layerRenderer = renderer(); | 420 RenderLayerModelObject* layerRenderer = renderer(); |
425 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); | 421 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); |
426 } | 422 } |
427 | 423 |
428 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; | 424 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; |
429 | 425 |
430 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; | 426 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; |
431 | 427 |
| 428 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; } |
| 429 |
432 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper
ties.offsetFromSquashingLayerOrigin = offset; } | 430 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper
ties.offsetFromSquashingLayerOrigin = offset; } |
433 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert
ies.offsetFromSquashingLayerOrigin; } | 431 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert
ies.offsetFromSquashingLayerOrigin; } |
434 | 432 |
435 private: | 433 private: |
436 bool hasOverflowControls() const; | 434 bool hasOverflowControls() const; |
437 | 435 |
438 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } | 436 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } |
439 | 437 |
440 void setAncestorChainHasSelfPaintingLayerDescendant(); | 438 void setAncestorChainHasSelfPaintingLayerDescendant(); |
441 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 439 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 bool requiresScrollableArea() const { return renderBox(); } | 548 bool requiresScrollableArea() const { return renderBox(); } |
551 void updateScrollableArea(); | 549 void updateScrollableArea(); |
552 | 550 |
553 // Returns true our scrollable area is in the FrameView's collection of scro
llable areas. This can | 551 // Returns true our scrollable area is in the FrameView's collection of scro
llable areas. This can |
554 // only happen if we're both scrollable, and we do in fact overflow. | 552 // only happen if we're both scrollable, and we do in fact overflow. |
555 bool scrollsOverflow() const; | 553 bool scrollsOverflow() const; |
556 | 554 |
557 void dirtyAncestorChainVisibleDescendantStatus(); | 555 void dirtyAncestorChainVisibleDescendantStatus(); |
558 void setAncestorChainHasVisibleDescendant(); | 556 void setAncestorChainHasVisibleDescendant(); |
559 | 557 |
560 void dirtyAncestorChainBlendedDescendantStatus(); | |
561 void setAncestorChainBlendedDescendant(); | |
562 | |
563 void updateDescendantDependentFlags(); | 558 void updateDescendantDependentFlags(); |
564 | 559 |
565 // This flag is computed by RenderLayerCompositor, which knows more about 3d
hierarchies than we do. | 560 // This flag is computed by RenderLayerCompositor, which knows more about 3d
hierarchies than we do. |
566 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant =
b; } | 561 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant =
b; } |
567 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } | 562 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } |
568 | 563 |
569 void dirty3DTransformedDescendantStatus(); | 564 void dirty3DTransformedDescendantStatus(); |
570 // Both updates the status, and returns true if descendants of this have 3d. | 565 // Both updates the status, and returns true if descendants of this have 3d. |
571 bool update3DTransformedDescendantStatus(); | 566 bool update3DTransformedDescendantStatus(); |
572 | 567 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 unsigned m_hasUnclippedDescendant : 1; | 611 unsigned m_hasUnclippedDescendant : 1; |
617 | 612 |
618 unsigned m_isUnclippedDescendant : 1; | 613 unsigned m_isUnclippedDescendant : 1; |
619 | 614 |
620 const unsigned m_isRootLayer : 1; | 615 const unsigned m_isRootLayer : 1; |
621 | 616 |
622 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp
arent layer, i.e., whether | 617 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp
arent layer, i.e., whether |
623 // we ended up painting this layer or any desce
ndants (and therefore need to | 618 // we ended up painting this layer or any desce
ndants (and therefore need to |
624 // blend). | 619 // blend). |
625 | 620 |
626 unsigned m_childLayerHasBlendMode : 1; | |
627 unsigned m_childLayerHasBlendModeStatusDirty : 1; | |
628 | |
629 unsigned m_visibleContentStatusDirty : 1; | 621 unsigned m_visibleContentStatusDirty : 1; |
630 unsigned m_hasVisibleContent : 1; | 622 unsigned m_hasVisibleContent : 1; |
631 unsigned m_visibleDescendantStatusDirty : 1; | 623 unsigned m_visibleDescendantStatusDirty : 1; |
632 unsigned m_hasVisibleDescendant : 1; | 624 unsigned m_hasVisibleDescendant : 1; |
633 | 625 |
634 unsigned m_hasVisibleNonLayerContent : 1; | 626 unsigned m_hasVisibleNonLayerContent : 1; |
635 | 627 |
636 unsigned m_isPaginated : 1; // If we think this layer is split by a multi-co
lumn ancestor, then this bit will be set. | 628 unsigned m_isPaginated : 1; // If we think this layer is split by a multi-co
lumn ancestor, then this bit will be set. |
637 | 629 |
638 unsigned m_3DTransformedDescendantStatusDirty : 1; | 630 unsigned m_3DTransformedDescendantStatusDirty : 1; |
639 // Set on a stacking context layer that has 3D descendants anywhere | 631 // Set on a stacking context layer that has 3D descendants anywhere |
640 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. | 632 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. |
641 unsigned m_has3DTransformedDescendant : 1; | 633 unsigned m_has3DTransformedDescendant : 1; |
642 | 634 |
643 unsigned m_containsDirtyOverlayScrollbars : 1; | 635 unsigned m_containsDirtyOverlayScrollbars : 1; |
644 | 636 |
645 // This is an optimization added for <table>. | 637 // This is an optimization added for <table>. |
646 // Currently cells do not need to update their repaint rectangles when scrol
ling. This also | 638 // Currently cells do not need to update their repaint rectangles when scrol
ling. This also |
647 // saves a lot of time when scrolling on a table. | 639 // saves a lot of time when scrolling on a table. |
648 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; | 640 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; |
649 | 641 |
650 unsigned m_hasFilterInfo : 1; | 642 unsigned m_hasFilterInfo : 1; |
651 | 643 |
652 blink::WebBlendMode m_blendMode; | |
653 | |
654 RenderLayerModelObject* m_renderer; | 644 RenderLayerModelObject* m_renderer; |
655 | 645 |
656 RenderLayer* m_parent; | 646 RenderLayer* m_parent; |
657 RenderLayer* m_previous; | 647 RenderLayer* m_previous; |
658 RenderLayer* m_next; | 648 RenderLayer* m_next; |
659 RenderLayer* m_first; | 649 RenderLayer* m_first; |
660 RenderLayer* m_last; | 650 RenderLayer* m_last; |
661 | 651 |
662 // Our current relative position offset. | 652 // Our current relative position offset. |
663 LayoutSize m_offsetForInFlowPosition; | 653 LayoutSize m_offsetForInFlowPosition; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 | 712 |
723 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; | 713 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; |
724 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; | 714 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; |
725 | 715 |
726 CompositedLayerMapping* m_groupedMapping; | 716 CompositedLayerMapping* m_groupedMapping; |
727 | 717 |
728 RenderLayerRepainter m_repainter; | 718 RenderLayerRepainter m_repainter; |
729 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? | 719 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? |
730 OwnPtr<RenderLayerStackingNode> m_stackingNode; | 720 OwnPtr<RenderLayerStackingNode> m_stackingNode; |
731 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; | 721 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; |
| 722 RenderLayerBlendInfo m_blendInfo; |
732 }; | 723 }; |
733 | 724 |
734 } // namespace WebCore | 725 } // namespace WebCore |
735 | 726 |
736 #ifndef NDEBUG | 727 #ifndef NDEBUG |
737 // Outside the WebCore namespace for ease of invocation from gdb. | 728 // Outside the WebCore namespace for ease of invocation from gdb. |
738 void showLayerTree(const WebCore::RenderLayer*); | 729 void showLayerTree(const WebCore::RenderLayer*); |
739 void showLayerTree(const WebCore::RenderObject*); | 730 void showLayerTree(const WebCore::RenderObject*); |
740 #endif | 731 #endif |
741 | 732 |
742 #endif // RenderLayer_h | 733 #endif // RenderLayer_h |
OLD | NEW |