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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool hasVisibleBoxDecorations() const; | 199 bool hasVisibleBoxDecorations() const; |
200 // Returns true if this layer has visible content (ignoring any child layers
). | 200 // Returns true if this layer has visible content (ignoring any child layers
). |
201 bool isVisuallyNonEmpty() const; | 201 bool isVisuallyNonEmpty() const; |
202 // True if this layer container renderers that paint. | 202 // True if this layer container renderers that paint. |
203 bool hasNonEmptyChildRenderers() const; | 203 bool hasNonEmptyChildRenderers() const; |
204 | 204 |
205 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but
we hit the same bugs as visible content above. | 205 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but
we hit the same bugs as visible content above. |
206 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. | 206 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. |
207 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } | 207 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } |
208 | 208 |
209 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S
ee above. | |
210 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } | |
211 | |
212 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo
wPositionedDescendant = hasDescendant; } | |
213 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo
sitionedDescendantDirty = dirty; } | |
214 | |
215 void updateIsUnclippedDescendant(); | |
216 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } | |
217 | |
218 // Will ensure that hasNonCompositiedChild are up to date. | 209 // Will ensure that hasNonCompositiedChild are up to date. |
219 void updateScrollingStateAfterCompositingChange(); | 210 void updateScrollingStateAfterCompositingChange(); |
220 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} | 211 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} |
221 bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState
()); return m_hasNonCompositedChild; } | 212 bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState
()); return m_hasNonCompositedChild; } |
222 | 213 |
223 bool usedTransparency() const { return m_usedTransparency; } | 214 bool usedTransparency() const { return m_usedTransparency; } |
224 | 215 |
225 // Gets the nearest enclosing positioned ancestor layer (also includes | 216 // Gets the nearest enclosing positioned ancestor layer (also includes |
226 // the <html> layer and the root layer). | 217 // the <html> layer and the root layer). |
227 RenderLayer* enclosingPositionedAncestor() const; | 218 RenderLayer* enclosingPositionedAncestor() const; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 445 |
455 CompositingReasons styleDeterminedCompositingReasons() const { return m_styl
eDeterminedCompositingReasons; } | 446 CompositingReasons styleDeterminedCompositingReasons() const { return m_styl
eDeterminedCompositingReasons; } |
456 void setStyleDeterminedCompositingReasons(CompositingReasons reasons) { ASSE
RT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m_st
yleDeterminedCompositingReasons = reasons; } | 447 void setStyleDeterminedCompositingReasons(CompositingReasons reasons) { ASSE
RT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m_st
yleDeterminedCompositingReasons = reasons; } |
457 | 448 |
458 class AncestorDependentProperties { | 449 class AncestorDependentProperties { |
459 public: | 450 public: |
460 AncestorDependentProperties() | 451 AncestorDependentProperties() |
461 : opacityAncestor(0) | 452 : opacityAncestor(0) |
462 , transformAncestor(0) | 453 , transformAncestor(0) |
463 , filterAncestor(0) | 454 , filterAncestor(0) |
| 455 , isUnclippedDescendant(false) |
464 { } | 456 { } |
465 | 457 |
466 IntRect clippedAbsoluteBoundingBox; | 458 IntRect clippedAbsoluteBoundingBox; |
467 const RenderLayer* opacityAncestor; | 459 const RenderLayer* opacityAncestor; |
468 const RenderLayer* transformAncestor; | 460 const RenderLayer* transformAncestor; |
469 const RenderLayer* filterAncestor; | 461 const RenderLayer* filterAncestor; |
| 462 unsigned isUnclippedDescendant : 1; |
470 }; | 463 }; |
471 | 464 |
472 void setNeedsToUpdateAncestorDependentProperties(); | 465 void setNeedsToUpdateAncestorDependentProperties(); |
473 bool childNeedsToUpdateAncestorDependantProperties() const { return m_childN
eedsToUpdateAncestorDependantProperties; } | 466 bool childNeedsToUpdateAncestorDependantProperties() const { return m_childN
eedsToUpdateAncestorDependantProperties; } |
474 bool needsToUpdateAncestorDependentProperties() const { return m_needsToUpda
teAncestorDependentProperties; } | 467 bool needsToUpdateAncestorDependentProperties() const { return m_needsToUpda
teAncestorDependentProperties; } |
475 | 468 |
476 void updateAncestorDependentProperties(const AncestorDependentProperties&); | 469 void updateAncestorDependentProperties(const AncestorDependentProperties&); |
477 void clearChildNeedsToUpdateAncestorDependantProperties(); | 470 void clearChildNeedsToUpdateAncestorDependantProperties(); |
478 | 471 |
479 const AncestorDependentProperties& ancestorDependentProperties() const { ASS
ERT(!m_needsToUpdateAncestorDependentProperties); return m_ancestorDependentProp
erties; } | 472 const AncestorDependentProperties& ancestorDependentProperties() const { ASS
ERT(!m_needsToUpdateAncestorDependentProperties); return m_ancestorDependentProp
erties; } |
480 | 473 |
| 474 // FIXME: Remove this function. |
| 475 bool potentiallyStaleIsUnclippedDescendant() const { return m_ancestorDepend
entProperties.isUnclippedDescendant; } |
| 476 |
481 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } | 477 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } |
482 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } | 478 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } |
483 | 479 |
484 CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompo
sitingState()); return m_compositingReasons; } | 480 CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompo
sitingState()); return m_compositingReasons; } |
485 void setCompositingReasons(CompositingReasons, CompositingReasons mask = Com
positingReasonAll); | 481 void setCompositingReasons(CompositingReasons, CompositingReasons mask = Com
positingReasonAll); |
486 | 482 |
487 bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingSt
ate()); return m_hasCompositingDescendant; } | 483 bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingSt
ate()); return m_hasCompositingDescendant; } |
488 void setHasCompositingDescendant(bool b) { m_hasCompositingDescendant = b;
} | 484 void setHasCompositingDescendant(bool b) { m_hasCompositingDescendant = b;
} |
489 | 485 |
490 bool shouldIsolateCompositedDescendants() const { ASSERT(isAllowedToQueryCom
positingState()); return m_shouldIsolateCompositedDescendants; } | 486 bool shouldIsolateCompositedDescendants() const { ASSERT(isAllowedToQueryCom
positingState()); return m_shouldIsolateCompositedDescendants; } |
(...skipping 12 matching lines...) Expand all Loading... |
503 LayoutPoint computeOffsetFromTransformedAncestor() const; | 499 LayoutPoint computeOffsetFromTransformedAncestor() const; |
504 | 500 |
505 void didUpdateNeedsCompositedScrolling(); | 501 void didUpdateNeedsCompositedScrolling(); |
506 | 502 |
507 private: | 503 private: |
508 // Bounding box in the coordinates of this layer. | 504 // Bounding box in the coordinates of this layer. |
509 LayoutRect logicalBoundingBox() const; | 505 LayoutRect logicalBoundingBox() const; |
510 | 506 |
511 bool hasOverflowControls() const; | 507 bool hasOverflowControls() const; |
512 | 508 |
513 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes
cendant = isUnclippedDescendant; } | |
514 | |
515 void setAncestorChainHasSelfPaintingLayerDescendant(); | 509 void setAncestorChainHasSelfPaintingLayerDescendant(); |
516 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 510 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
517 | 511 |
518 void setAncestorChainHasOutOfFlowPositionedDescendant(); | |
519 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
520 | |
521 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&,
PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius); | 512 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&,
PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius); |
522 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); | 513 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); |
523 | 514 |
524 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); | |
525 | |
526 // Returns true if the position changed. | 515 // Returns true if the position changed. |
527 bool updateLayerPosition(); | 516 bool updateLayerPosition(); |
528 | 517 |
529 enum UpdateLayerPositionsAfterScrollFlag { | 518 enum UpdateLayerPositionsAfterScrollFlag { |
530 NoFlag = 0, | 519 NoFlag = 0, |
531 IsOverflowScroll = 1 << 0, | 520 IsOverflowScroll = 1 << 0, |
532 HasSeenViewportConstrainedAncestor = 1 << 1, | 521 HasSeenViewportConstrainedAncestor = 1 << 1, |
533 HasSeenAncestorWithOverflowClip = 1 << 2, | 522 HasSeenAncestorWithOverflowClip = 1 << 2, |
534 HasChangedAncestor = 1 << 3 | 523 HasChangedAncestor = 1 << 3 |
535 }; | 524 }; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // Self-painting layer is an optimization where we avoid the heavy RenderLay
er painting | 619 // Self-painting layer is an optimization where we avoid the heavy RenderLay
er painting |
631 // machinery for a RenderLayer allocated only to handle the overflow clip ca
se. | 620 // machinery for a RenderLayer allocated only to handle the overflow clip ca
se. |
632 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. | 621 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. |
633 unsigned m_isSelfPaintingLayer : 1; | 622 unsigned m_isSelfPaintingLayer : 1; |
634 | 623 |
635 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to | 624 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to |
636 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). | 625 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). |
637 unsigned m_hasSelfPaintingLayerDescendant : 1; | 626 unsigned m_hasSelfPaintingLayerDescendant : 1; |
638 unsigned m_hasSelfPaintingLayerDescendantDirty : 1; | 627 unsigned m_hasSelfPaintingLayerDescendantDirty : 1; |
639 | 628 |
640 unsigned m_hasOutOfFlowPositionedDescendant : 1; | |
641 unsigned m_hasOutOfFlowPositionedDescendantDirty : 1; | |
642 | |
643 unsigned m_isUnclippedDescendant : 1; | |
644 | |
645 const unsigned m_isRootLayer : 1; | 629 const unsigned m_isRootLayer : 1; |
646 | 630 |
647 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp
arent layer, i.e., whether | 631 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp
arent layer, i.e., whether |
648 // we ended up painting this layer or any desce
ndants (and therefore need to | 632 // we ended up painting this layer or any desce
ndants (and therefore need to |
649 // blend). | 633 // blend). |
650 | 634 |
651 unsigned m_visibleContentStatusDirty : 1; | 635 unsigned m_visibleContentStatusDirty : 1; |
652 unsigned m_hasVisibleContent : 1; | 636 unsigned m_hasVisibleContent : 1; |
653 unsigned m_visibleDescendantStatusDirty : 1; | 637 unsigned m_visibleDescendantStatusDirty : 1; |
654 unsigned m_hasVisibleDescendant : 1; | 638 unsigned m_hasVisibleDescendant : 1; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 | 730 |
747 } // namespace WebCore | 731 } // namespace WebCore |
748 | 732 |
749 #ifndef NDEBUG | 733 #ifndef NDEBUG |
750 // Outside the WebCore namespace for ease of invocation from gdb. | 734 // Outside the WebCore namespace for ease of invocation from gdb. |
751 void showLayerTree(const WebCore::RenderLayer*); | 735 void showLayerTree(const WebCore::RenderLayer*); |
752 void showLayerTree(const WebCore::RenderObject*); | 736 void showLayerTree(const WebCore::RenderObject*); |
753 #endif | 737 #endif |
754 | 738 |
755 #endif // RenderLayer_h | 739 #endif // RenderLayer_h |
OLD | NEW |