OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 if (paintBehavior & PaintBehaviorFlattenCompositingLayers) { | 603 if (paintBehavior & PaintBehaviorFlattenCompositingLayers) { |
604 TransformationMatrix matrix = *m_transform; | 604 TransformationMatrix matrix = *m_transform; |
605 makeMatrixRenderable(matrix, false /* flatten 3d */); | 605 makeMatrixRenderable(matrix, false /* flatten 3d */); |
606 return matrix; | 606 return matrix; |
607 } | 607 } |
608 | 608 |
609 return *m_transform; | 609 return *m_transform; |
610 } | 610 } |
611 | 611 |
| 612 RenderLayer* RenderLayer::enclosingOverflowClipLayer(IncludeSelfOrNot includeSel
f) const |
| 613 { |
| 614 const RenderLayer* layer = (includeSelf == IncludeSelf) ? this : parent(); |
| 615 while (layer) { |
| 616 if (layer->renderer()->hasOverflowClip()) |
| 617 return const_cast<RenderLayer*>(layer); |
| 618 |
| 619 layer = layer->parent(); |
| 620 } |
| 621 return 0; |
| 622 } |
| 623 |
612 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) | 624 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) |
613 { | 625 { |
614 RenderView* view = renderer->view(); | 626 RenderView* view = renderer->view(); |
615 RenderLayerModelObject* prevBlock = renderer; | 627 RenderLayerModelObject* prevBlock = renderer; |
616 RenderBlock* containingBlock; | 628 RenderBlock* containingBlock; |
617 for (containingBlock = renderer->containingBlock(); | 629 for (containingBlock = renderer->containingBlock(); |
618 containingBlock && containingBlock != view && containingBlock != ancest
orColumnsRenderer; | 630 containingBlock && containingBlock != view && containingBlock != ancest
orColumnsRenderer; |
619 containingBlock = containingBlock->containingBlock()) | 631 containingBlock = containingBlock->containingBlock()) |
620 prevBlock = containingBlock; | 632 prevBlock = containingBlock; |
621 | 633 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1110 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) |
1099 { | 1111 { |
1100 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer-
>stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest
orStackingContainerNode()->layer() : 0); | 1112 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer-
>stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest
orStackingContainerNode()->layer() : 0); |
1101 } | 1113 } |
1102 | 1114 |
1103 // FIXME: having two different functions named enclosingCompositingLayer and enc
losingCompositingLayerForRepaint | 1115 // FIXME: having two different functions named enclosingCompositingLayer and enc
losingCompositingLayerForRepaint |
1104 // is error-prone and misleading for reading code that uses these functions - es
pecially compounded with | 1116 // is error-prone and misleading for reading code that uses these functions - es
pecially compounded with |
1105 // the includeSelf option. It is very likely that we don't even want either of t
hese functions; A layer | 1117 // the includeSelf option. It is very likely that we don't even want either of t
hese functions; A layer |
1106 // should be told explicitly which GraphicsLayer is the repaintContainer for a R
enderLayer, and | 1118 // should be told explicitly which GraphicsLayer is the repaintContainer for a R
enderLayer, and |
1107 // any other use cases should probably have an API between the non-compositing a
nd compositing sides of code. | 1119 // any other use cases should probably have an API between the non-compositing a
nd compositing sides of code. |
1108 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 1120 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf
) const |
1109 { | 1121 { |
1110 if (includeSelf && compositingState() != NotComposited && compositingState()
!= PaintsIntoGroupedBacking) | 1122 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c
ompositingState() != PaintsIntoGroupedBacking) |
1111 return const_cast<RenderLayer*>(this); | 1123 return const_cast<RenderLayer*>(this); |
1112 | 1124 |
1113 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1125 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { |
1114 if (curr->compositingState() != NotComposited && curr->compositingState(
) != PaintsIntoGroupedBacking) | 1126 if (curr->compositingState() != NotComposited && curr->compositingState(
) != PaintsIntoGroupedBacking) |
1115 return const_cast<RenderLayer*>(curr); | 1127 return const_cast<RenderLayer*>(curr); |
1116 } | 1128 } |
1117 | 1129 |
1118 return 0; | 1130 return 0; |
1119 } | 1131 } |
1120 | 1132 |
1121 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf)
const | 1133 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i
ncludeSelf) const |
1122 { | 1134 { |
1123 if (includeSelf && (compositingState() == PaintsIntoOwnBacking || compositin
gState() == PaintsIntoGroupedBacking)) | 1135 if ((includeSelf == IncludeSelf) && (compositingState() == PaintsIntoOwnBack
ing || compositingState() == PaintsIntoGroupedBacking)) |
1124 return const_cast<RenderLayer*>(this); | 1136 return const_cast<RenderLayer*>(this); |
1125 | 1137 |
1126 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1138 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { |
1127 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin
gState() == PaintsIntoGroupedBacking) | 1139 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin
gState() == PaintsIntoGroupedBacking) |
1128 return const_cast<RenderLayer*>(curr); | 1140 return const_cast<RenderLayer*>(curr); |
1129 } | 1141 } |
1130 | 1142 |
1131 return 0; | 1143 return 0; |
1132 } | 1144 } |
1133 | 1145 |
(...skipping 21 matching lines...) Expand all Loading... |
1155 return 0; | 1167 return 0; |
1156 | 1168 |
1157 for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancesto
rLayer; ancestorLayer = ancestorLayer->parent()) { | 1169 for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancesto
rLayer; ancestorLayer = ancestorLayer->parent()) { |
1158 if (ancestorLayer->scrollsOverflow()) | 1170 if (ancestorLayer->scrollsOverflow()) |
1159 return ancestorLayer; | 1171 return ancestorLayer; |
1160 } | 1172 } |
1161 | 1173 |
1162 return 0; | 1174 return 0; |
1163 } | 1175 } |
1164 | 1176 |
1165 RenderLayer* RenderLayer::enclosingFilterLayer(bool includeSelf) const | 1177 RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) con
st |
1166 { | 1178 { |
1167 const RenderLayer* curr = includeSelf ? this : parent(); | 1179 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent(); |
1168 for (; curr; curr = curr->parent()) { | 1180 for (; curr; curr = curr->parent()) { |
1169 if (curr->requiresFullLayerImageForFilters()) | 1181 if (curr->requiresFullLayerImageForFilters()) |
1170 return const_cast<RenderLayer*>(curr); | 1182 return const_cast<RenderLayer*>(curr); |
1171 } | 1183 } |
1172 | 1184 |
1173 return 0; | 1185 return 0; |
1174 } | 1186 } |
1175 | 1187 |
1176 bool RenderLayer::hasAncestorWithFilterOutsets() const | 1188 bool RenderLayer::hasAncestorWithFilterOutsets() const |
1177 { | 1189 { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 return scrollParent; | 1716 return scrollParent; |
1705 } | 1717 } |
1706 | 1718 |
1707 RenderLayer* RenderLayer::clipParent() const | 1719 RenderLayer* RenderLayer::clipParent() const |
1708 { | 1720 { |
1709 const bool needsAncestorClip = compositor()->clippedByAncestor(this); | 1721 const bool needsAncestorClip = compositor()->clippedByAncestor(this); |
1710 | 1722 |
1711 RenderLayer* clipParent = 0; | 1723 RenderLayer* clipParent = 0; |
1712 if ((compositingReasons() & CompositingReasonOutOfFlowClipping) && !needsAnc
estorClip) { | 1724 if ((compositingReasons() & CompositingReasonOutOfFlowClipping) && !needsAnc
estorClip) { |
1713 if (RenderObject* containingBlock = renderer()->containingBlock()) | 1725 if (RenderObject* containingBlock = renderer()->containingBlock()) |
1714 clipParent = containingBlock->enclosingLayer()->enclosingCompositing
Layer(true); | 1726 clipParent = containingBlock->enclosingLayer()->enclosingCompositing
Layer(); |
1715 } | 1727 } |
1716 | 1728 |
1717 return clipParent; | 1729 return clipParent; |
1718 } | 1730 } |
1719 | 1731 |
1720 void RenderLayer::didUpdateNeedsCompositedScrolling() | 1732 void RenderLayer::didUpdateNeedsCompositedScrolling() |
1721 { | 1733 { |
1722 m_stackingNode->updateIsNormalFlowOnly(); | 1734 m_stackingNode->updateIsNormalFlowOnly(); |
1723 updateSelfPaintingLayer(); | 1735 updateSelfPaintingLayer(); |
1724 | 1736 |
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3496 | 3508 |
3497 // FIXME: Descendants that are composited should not necessarily be skipped,
if they don't paint into their own | 3509 // FIXME: Descendants that are composited should not necessarily be skipped,
if they don't paint into their own |
3498 // separate backing. Instead, they ought to contribute to the bounds of the
layer we're trying to compute. | 3510 // separate backing. Instead, they ought to contribute to the bounds of the
layer we're trying to compute. |
3499 // This applies to all z-order lists below. | 3511 // This applies to all z-order lists below. |
3500 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren)
; | 3512 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren)
; |
3501 while (RenderLayerStackingNode* node = iterator.next()) { | 3513 while (RenderLayerStackingNode* node = iterator.next()) { |
3502 // Node's compositing ancestor may have changed its draw content status | 3514 // Node's compositing ancestor may have changed its draw content status |
3503 // prior to updating its bounds. The requires-own-backing-store-for-ance
stor-reasons | 3515 // prior to updating its bounds. The requires-own-backing-store-for-ance
stor-reasons |
3504 // could be stale. Refresh them now. | 3516 // could be stale. Refresh them now. |
3505 if (node->layer()->hasCompositedLayerMapping()) { | 3517 if (node->layer()->hasCompositedLayerMapping()) { |
3506 RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCom
positingLayer(false); | 3518 RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCom
positingLayer(ExcludeSelf); |
3507 node->layer()->compositedLayerMapping()->updateRequiresOwnBackingSto
reForAncestorReasons(enclosingCompositingLayer); | 3519 node->layer()->compositedLayerMapping()->updateRequiresOwnBackingSto
reForAncestorReasons(enclosingCompositingLayer); |
3508 } | 3520 } |
3509 | 3521 |
3510 if (flags & IncludeCompositedDescendants || !node->layer()->hasComposite
dLayerMapping()) { | 3522 if (flags & IncludeCompositedDescendants || !node->layer()->hasComposite
dLayerMapping()) { |
3511 LayoutRect childUnionBounds = node->layer()->calculateLayerBounds(th
is, 0, descendantFlags); | 3523 LayoutRect childUnionBounds = node->layer()->calculateLayerBounds(th
is, 0, descendantFlags); |
3512 unionBounds.unite(childUnionBounds); | 3524 unionBounds.unite(childUnionBounds); |
3513 } | 3525 } |
3514 } | 3526 } |
3515 | 3527 |
3516 // FIXME: We can optimize the size of the composited layers, by not enlargin
g | 3528 // FIXME: We can optimize the size of the composited layers, by not enlargin
g |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4086 } | 4098 } |
4087 } | 4099 } |
4088 | 4100 |
4089 void showLayerTree(const WebCore::RenderObject* renderer) | 4101 void showLayerTree(const WebCore::RenderObject* renderer) |
4090 { | 4102 { |
4091 if (!renderer) | 4103 if (!renderer) |
4092 return; | 4104 return; |
4093 showLayerTree(renderer->enclosingLayer()); | 4105 showLayerTree(renderer->enclosingLayer()); |
4094 } | 4106 } |
4095 #endif | 4107 #endif |
OLD | NEW |