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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 | 226 |
227 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } | 227 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } |
228 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan
t = hasDescendant; } | 228 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan
t = hasDescendant; } |
229 void updateHasUnclippedDescendant(); | 229 void updateHasUnclippedDescendant(); |
230 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } | 230 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } |
231 | 231 |
232 // Will ensure that hasUnclippedDescendant and hasNonCompositiedChild are up
to date. | 232 // Will ensure that hasUnclippedDescendant and hasNonCompositiedChild are up
to date. |
233 void updateScrollingStateAfterCompositingChange(); | 233 void updateScrollingStateAfterCompositingChange(); |
234 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} | 234 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} |
235 bool hasNonCompositedChild() const { return m_compositingProperties.hasNonCo
mpositedChild; } | 235 bool hasNonCompositedChild() const { return compositingProperties().hasNonCo
mpositedChild; } |
236 | 236 |
237 bool usedTransparency() const { return m_usedTransparency; } | 237 bool usedTransparency() const { return m_usedTransparency; } |
238 | 238 |
239 // Gets the nearest enclosing positioned ancestor layer (also includes | 239 // Gets the nearest enclosing positioned ancestor layer (also includes |
240 // the <html> layer and the root layer). | 240 // the <html> layer and the root layer). |
241 RenderLayer* enclosingPositionedAncestor() const; | 241 RenderLayer* enclosingPositionedAncestor() const; |
242 | 242 |
243 RenderLayer* enclosingOverflowClipLayer(IncludeSelfOrNot = IncludeSelf) cons
t; | 243 RenderLayer* enclosingOverflowClipLayer(IncludeSelfOrNot = IncludeSelf) cons
t; |
244 | 244 |
245 // Enclosing compositing layer; if includeSelf is true, may return this. | 245 // Enclosing compositing layer; if includeSelf is true, may return this. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 NotCompositedForNoVisibleContent, | 421 NotCompositedForNoVisibleContent, |
422 NotCompositedForUnscrollableAncestors, | 422 NotCompositedForUnscrollableAncestors, |
423 NumNotCompositedReasons, | 423 NumNotCompositedReasons, |
424 | 424 |
425 // This is the number of bits used to store the viewport constrained not
composited | 425 // This is the number of bits used to store the viewport constrained not
composited |
426 // reasons. We define this constant since sizeof won't return the number
of bits, and we | 426 // reasons. We define this constant since sizeof won't return the number
of bits, and we |
427 // shouldn't duplicate the constant. | 427 // shouldn't duplicate the constant. |
428 ViewportConstrainedNotCompositedReasonBits = 3 | 428 ViewportConstrainedNotCompositedReasonBits = 3 |
429 }; | 429 }; |
430 | 430 |
431 void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotComposi
tedReason reason) { m_compositingProperties.viewportConstrainedNotCompositedReas
on = reason; } | 431 void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotComposi
tedReason reason) { compositingProperties().viewportConstrainedNotCompositedReas
on = reason; } |
432 ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReaso
n() const { return static_cast<ViewportConstrainedNotCompositedReason>(m_composi
tingProperties.viewportConstrainedNotCompositedReason); } | 432 ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReaso
n() const { return static_cast<ViewportConstrainedNotCompositedReason>(compositi
ngProperties().viewportConstrainedNotCompositedReason); } |
433 | 433 |
434 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen
derFlowThread(); } | 434 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen
derFlowThread(); } |
435 | 435 |
436 bool scrollsWithRespectTo(const RenderLayer*) const; | 436 bool scrollsWithRespectTo(const RenderLayer*) const; |
437 | 437 |
438 void addLayerHitTestRects(LayerHitTestRects&) const; | 438 void addLayerHitTestRects(LayerHitTestRects&) const; |
439 | 439 |
440 // Compute rects only for this layer | 440 // Compute rects only for this layer |
441 void computeSelfHitTestRects(LayerHitTestRects&) const; | 441 void computeSelfHitTestRects(LayerHitTestRects&) const; |
442 | 442 |
(...skipping 11 matching lines...) Expand all Loading... |
454 RenderLayerModelObject* layerRenderer = renderer(); | 454 RenderLayerModelObject* layerRenderer = renderer(); |
455 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); | 455 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); |
456 } | 456 } |
457 | 457 |
458 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; | 458 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags)
; |
459 | 459 |
460 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; | 460 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; |
461 | 461 |
462 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; } | 462 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; } |
463 | 463 |
464 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper
ties.offsetFromSquashingLayerOrigin = offset; } | 464 void setOffsetFromSquashingLayerOrigin(IntSize offset) { compositingProperti
es().offsetFromSquashingLayerOrigin = offset; } |
465 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert
ies.offsetFromSquashingLayerOrigin; } | 465 IntSize offsetFromSquashingLayerOrigin() const { return compositingPropertie
s().offsetFromSquashingLayerOrigin; } |
466 | 466 |
467 bool scrollsOverflow() const; | 467 bool scrollsOverflow() const; |
468 | 468 |
469 bool hasDirectReasonsForCompositing() const { return compositingReasons() &
CompositingReasonComboAllDirectReasons; } | 469 bool hasDirectReasonsForCompositing() const { return compositingReasons() &
CompositingReasonComboAllDirectReasons; } |
470 CompositingReasons styleDeterminedCompositingReasons() const { return compos
itingReasons() & CompositingReasonComboAllStyleDeterminedReasons; } | 470 |
| 471 CompositingReasons styleDeterminedCompositingReasons() const { return m_styl
eDeterminedCompositingReasons; } |
| 472 void setStyleDeterminedCompositingReasons(CompositingReasons reasons) { ASSE
RT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m_st
yleDeterminedCompositingReasons = reasons; } |
471 | 473 |
472 class AncestorDependentProperties { | 474 class AncestorDependentProperties { |
473 public: | 475 public: |
474 AncestorDependentProperties() | 476 AncestorDependentProperties() |
475 : opacityAncestor(0) | 477 : opacityAncestor(0) |
476 , transformAncestor(0) | 478 , transformAncestor(0) |
477 , filterAncestor(0) | 479 , filterAncestor(0) |
478 { } | 480 { } |
479 | 481 |
480 IntRect clippedAbsoluteBoundingBox; | 482 IntRect clippedAbsoluteBoundingBox; |
481 const RenderLayer* opacityAncestor; | 483 const RenderLayer* opacityAncestor; |
482 const RenderLayer* transformAncestor; | 484 const RenderLayer* transformAncestor; |
483 const RenderLayer* filterAncestor; | 485 const RenderLayer* filterAncestor; |
484 }; | 486 }; |
485 | 487 |
486 void setNeedsToUpdateAncestorDependentProperties(); | 488 void setNeedsToUpdateAncestorDependentProperties(); |
487 bool childNeedsToUpdateAncestorDependantProperties() const { return m_childN
eedsToUpdateAncestorDependantProperties; } | 489 bool childNeedsToUpdateAncestorDependantProperties() const { return m_childN
eedsToUpdateAncestorDependantProperties; } |
488 bool needsToUpdateAncestorDependentProperties() const { return m_needsToUpda
teAncestorDependentProperties; } | 490 bool needsToUpdateAncestorDependentProperties() const { return m_needsToUpda
teAncestorDependentProperties; } |
489 | 491 |
490 void updateAncestorDependentProperties(const AncestorDependentProperties&); | 492 void updateAncestorDependentProperties(const AncestorDependentProperties&); |
491 void clearChildNeedsToUpdateAncestorDependantProperties(); | 493 void clearChildNeedsToUpdateAncestorDependantProperties(); |
492 | 494 |
493 const AncestorDependentProperties& ancestorDependentProperties() const { ASS
ERT(!m_needsToUpdateAncestorDependentProperties); return m_ancestorDependentProp
erties; } | 495 const AncestorDependentProperties& ancestorDependentProperties() const { ASS
ERT(!m_needsToUpdateAncestorDependentProperties); return m_ancestorDependentProp
erties; } |
494 | 496 |
495 bool lostGroupedMapping() const { return m_compositingProperties.lostGrouped
Mapping; } | 497 bool lostGroupedMapping() const { return compositingProperties().lostGrouped
Mapping; } |
496 void setLostGroupedMapping(bool b) { m_compositingProperties.lostGroupedMapp
ing = b; } | 498 void setLostGroupedMapping(bool b) { compositingProperties().lostGroupedMapp
ing = b; } |
497 | 499 |
498 CompositingReasons compositingReasons() const { return m_compositingProperti
es.compositingReasons; } | 500 CompositingReasons compositingReasons() const { return compositingProperties
().compositingReasons; } |
499 void setCompositingReasons(CompositingReasons, CompositingReasons mask = Com
positingReasonAll); | 501 void setCompositingReasons(CompositingReasons, CompositingReasons mask = Com
positingReasonAll); |
500 | 502 |
501 bool hasCompositingDescendant() const { return m_compositingProperties.hasCo
mpositingDescendant; } | 503 bool hasCompositingDescendant() const { return compositingProperties().hasCo
mpositingDescendant; } |
502 void setHasCompositingDescendant(bool b) { m_compositingProperties.hasCompo
sitingDescendant = b; } | 504 void setHasCompositingDescendant(bool b) { compositingProperties().hasCompo
sitingDescendant = b; } |
503 | 505 |
504 bool shouldIsolateCompositedDescendants() const { return m_compositingProper
ties.shouldIsolateCompositedDescendants; } | 506 bool shouldIsolateCompositedDescendants() const { return compositingProperti
es().shouldIsolateCompositedDescendants; } |
505 void setShouldIsolateCompositedDescendants(bool b) { m_compositingPropertie
s.shouldIsolateCompositedDescendants = b; } | 507 void setShouldIsolateCompositedDescendants(bool b) { compositingProperties(
).shouldIsolateCompositedDescendants = b; } |
| 508 |
| 509 bool suppressingCompositedLayerCreation() const { return compositingProperti
es().suppressingCompositedLayerCreation; } |
| 510 void setSuppressingCompositedLayerCreation(bool b) { compositingProperties()
.suppressingCompositedLayerCreation = b; } |
506 | 511 |
507 void updateDescendantDependentFlags(); | 512 void updateDescendantDependentFlags(); |
508 | 513 |
509 void updateOrRemoveFilterEffectRenderer(); | 514 void updateOrRemoveFilterEffectRenderer(); |
510 | 515 |
511 void updateSelfPaintingLayer(); | 516 void updateSelfPaintingLayer(); |
512 | 517 |
513 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay
erFlags); | 518 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay
erFlags); |
514 | 519 |
515 RenderLayer* enclosingTransformedAncestor() const; | 520 RenderLayer* enclosingTransformedAncestor() const; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 716 |
712 // Cached normal flow values for absolute positioned elements with static le
ft/top values. | 717 // Cached normal flow values for absolute positioned elements with static le
ft/top values. |
713 LayoutUnit m_staticInlinePosition; | 718 LayoutUnit m_staticInlinePosition; |
714 LayoutUnit m_staticBlockPosition; | 719 LayoutUnit m_staticBlockPosition; |
715 | 720 |
716 OwnPtr<TransformationMatrix> m_transform; | 721 OwnPtr<TransformationMatrix> m_transform; |
717 | 722 |
718 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i
s 0 if we are not paginated. | 723 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i
s 0 if we are not paginated. |
719 RenderLayer* m_enclosingPaginationLayer; | 724 RenderLayer* m_enclosingPaginationLayer; |
720 | 725 |
| 726 // These compositing reasons are updated whenever style changes, not while u
pdating compositing layers. |
| 727 // They should not be used to infer the compositing state of this layer. |
| 728 CompositingReasons m_styleDeterminedCompositingReasons; |
| 729 |
721 // Properties that are computed while updating compositing layers. These val
ues may be dirty/invalid if | 730 // Properties that are computed while updating compositing layers. These val
ues may be dirty/invalid if |
722 // compositing status is not up-to-date before using them. | 731 // compositing status is not up-to-date before using them. |
723 struct CompositingProperties { | 732 struct CompositingProperties { |
724 CompositingProperties() | 733 CompositingProperties() |
725 : hasCompositingDescendant(false) | 734 : hasCompositingDescendant(false) |
726 , hasNonCompositedChild(false) | 735 , hasNonCompositedChild(false) |
727 , shouldIsolateCompositedDescendants(false) | 736 , shouldIsolateCompositedDescendants(false) |
728 , lostGroupedMapping(false) | 737 , lostGroupedMapping(false) |
| 738 , suppressingCompositedLayerCreation(false) |
729 , viewportConstrainedNotCompositedReason(NoNotCompositedReason) | 739 , viewportConstrainedNotCompositedReason(NoNotCompositedReason) |
730 , compositingReasons(CompositingReasonNone) | 740 , compositingReasons(CompositingReasonNone) |
731 { } | 741 { } |
732 | 742 |
733 // Used only while determining what layers should be composited. Applies
to the tree of z-order lists. | 743 // Used only while determining what layers should be composited. Applies
to the tree of z-order lists. |
734 bool hasCompositingDescendant : 1; | 744 bool hasCompositingDescendant : 1; |
735 | 745 |
736 // Applies to the real render layer tree (i.e., the tree determined by t
he layer's parent and children and | 746 // Applies to the real render layer tree (i.e., the tree determined by t
he layer's parent and children and |
737 // as opposed to the tree formed by the z-order and normal flow lists). | 747 // as opposed to the tree formed by the z-order and normal flow lists). |
738 bool hasNonCompositedChild : 1; | 748 bool hasNonCompositedChild : 1; |
739 | 749 |
740 // Should be for stacking contexts having unisolated blending descendant
s. | 750 // Should be for stacking contexts having unisolated blending descendant
s. |
741 bool shouldIsolateCompositedDescendants : 1; | 751 bool shouldIsolateCompositedDescendants : 1; |
742 | 752 |
743 // True if this render layer just lost its grouped mapping due to the Co
mpositedLayerMapping being destroyed, | 753 // True if this render layer just lost its grouped mapping due to the Co
mpositedLayerMapping being destroyed, |
744 // and we don't yet know to what graphics layer this RenderLayer will be
assigned. | 754 // and we don't yet know to what graphics layer this RenderLayer will be
assigned. |
745 bool lostGroupedMapping : 1; | 755 bool lostGroupedMapping : 1; |
746 | 756 |
| 757 // Whether this render layer is trying to avoid becoming composited, if
possible. |
| 758 bool suppressingCompositedLayerCreation : 1; |
| 759 |
747 // The reason, if any exists, that a fixed-position layer is chosen not
to be composited. | 760 // The reason, if any exists, that a fixed-position layer is chosen not
to be composited. |
748 unsigned viewportConstrainedNotCompositedReason : ViewportConstrainedNot
CompositedReasonBits; | 761 unsigned viewportConstrainedNotCompositedReason : ViewportConstrainedNot
CompositedReasonBits; |
749 | 762 |
750 // Once computed, indicates all that a layer needs to become composited
using the CompositingReasons enum bitfield. | 763 // Once computed, indicates all that a layer needs to become composited
using the CompositingReasons enum bitfield. |
751 CompositingReasons compositingReasons; | 764 CompositingReasons compositingReasons; |
752 | 765 |
753 // Used for invalidating this layer's contents on the squashing Graphics
Layer. | 766 // Used for invalidating this layer's contents on the squashing Graphics
Layer. |
754 IntSize offsetFromSquashingLayerOrigin; | 767 IntSize offsetFromSquashingLayerOrigin; |
755 }; | 768 }; |
756 | 769 |
| 770 CompositingProperties& compositingProperties() { ASSERT(isAllowedToQueryComp
ositingState()); return m_compositingProperties; } |
| 771 const CompositingProperties& compositingProperties() const { ASSERT(isAllowe
dToQueryCompositingState()); return m_compositingProperties; } |
| 772 |
757 AncestorDependentProperties m_ancestorDependentProperties; | 773 AncestorDependentProperties m_ancestorDependentProperties; |
758 | 774 |
759 CompositingProperties m_compositingProperties; | 775 CompositingProperties m_compositingProperties; |
760 | 776 |
761 IntRect m_blockSelectionGapsBounds; | 777 IntRect m_blockSelectionGapsBounds; |
762 | 778 |
763 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; | 779 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; |
764 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; | 780 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; |
765 | 781 |
766 CompositedLayerMapping* m_groupedMapping; | 782 CompositedLayerMapping* m_groupedMapping; |
767 | 783 |
768 RenderLayerRepainter m_repainter; | 784 RenderLayerRepainter m_repainter; |
769 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? | 785 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? |
770 OwnPtr<RenderLayerStackingNode> m_stackingNode; | 786 OwnPtr<RenderLayerStackingNode> m_stackingNode; |
771 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; | 787 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; |
772 RenderLayerBlendInfo m_blendInfo; | 788 RenderLayerBlendInfo m_blendInfo; |
773 | 789 |
774 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. | 790 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. |
775 }; | 791 }; |
776 | 792 |
777 } // namespace WebCore | 793 } // namespace WebCore |
778 | 794 |
779 #ifndef NDEBUG | 795 #ifndef NDEBUG |
780 // Outside the WebCore namespace for ease of invocation from gdb. | 796 // Outside the WebCore namespace for ease of invocation from gdb. |
781 void showLayerTree(const WebCore::RenderLayer*); | 797 void showLayerTree(const WebCore::RenderLayer*); |
782 void showLayerTree(const WebCore::RenderObject*); | 798 void showLayerTree(const WebCore::RenderObject*); |
783 #endif | 799 #endif |
784 | 800 |
785 #endif // RenderLayer_h | 801 #endif // RenderLayer_h |
OLD | NEW |