| 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(bool includeSelf) const |
| 613 { |
| 614 const RenderLayer* layer = 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1118 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) |
| 1107 { | 1119 { |
| 1108 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer-
>stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest
orStackingContainerNode()->layer() : 0); | 1120 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer-
>stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest
orStackingContainerNode()->layer() : 0); |
| 1109 } | 1121 } |
| 1110 | 1122 |
| 1111 // FIXME: having two different functions named enclosingCompositingLayer and enc
losingCompositingLayerForRepaint | 1123 // FIXME: having two different functions named enclosingCompositingLayer and enc
losingCompositingLayerForRepaint |
| 1112 // is error-prone and misleading for reading code that uses these functions - es
pecially compounded with | 1124 // is error-prone and misleading for reading code that uses these functions - es
pecially compounded with |
| 1113 // the includeSelf option. It is very likely that we don't even want either of t
hese functions; A layer | 1125 // the includeSelf option. It is very likely that we don't even want either of t
hese functions; A layer |
| 1114 // should be told explicitly which GraphicsLayer is the repaintContainer for a R
enderLayer, and | 1126 // should be told explicitly which GraphicsLayer is the repaintContainer for a R
enderLayer, and |
| 1115 // any other use cases should probably have an API between the non-compositing a
nd compositing sides of code. | 1127 // any other use cases should probably have an API between the non-compositing a
nd compositing sides of code. |
| 1116 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 1128 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf
) const |
| 1117 { | 1129 { |
| 1118 if (includeSelf && compositingState() != NotComposited && compositingState()
!= PaintsIntoGroupedBacking) | 1130 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c
ompositingState() != PaintsIntoGroupedBacking) |
| 1119 return const_cast<RenderLayer*>(this); | 1131 return const_cast<RenderLayer*>(this); |
| 1120 | 1132 |
| 1121 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1133 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { |
| 1122 if (curr->compositingState() != NotComposited && curr->compositingState(
) != PaintsIntoGroupedBacking) | 1134 if (curr->compositingState() != NotComposited && curr->compositingState(
) != PaintsIntoGroupedBacking) |
| 1123 return const_cast<RenderLayer*>(curr); | 1135 return const_cast<RenderLayer*>(curr); |
| 1124 } | 1136 } |
| 1125 | 1137 |
| 1126 return 0; | 1138 return 0; |
| 1127 } | 1139 } |
| 1128 | 1140 |
| 1129 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf)
const | 1141 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i
ncludeSelf) const |
| 1130 { | 1142 { |
| 1131 if (includeSelf && (compositingState() == PaintsIntoOwnBacking || compositin
gState() == PaintsIntoGroupedBacking)) | 1143 if ((includeSelf == IncludeSelf) && (compositingState() == PaintsIntoOwnBack
ing || compositingState() == PaintsIntoGroupedBacking)) |
| 1132 return const_cast<RenderLayer*>(this); | 1144 return const_cast<RenderLayer*>(this); |
| 1133 | 1145 |
| 1134 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1146 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { |
| 1135 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin
gState() == PaintsIntoGroupedBacking) | 1147 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin
gState() == PaintsIntoGroupedBacking) |
| 1136 return const_cast<RenderLayer*>(curr); | 1148 return const_cast<RenderLayer*>(curr); |
| 1137 } | 1149 } |
| 1138 | 1150 |
| 1139 return 0; | 1151 return 0; |
| 1140 } | 1152 } |
| 1141 | 1153 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1163 return 0; | 1175 return 0; |
| 1164 | 1176 |
| 1165 for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancesto
rLayer; ancestorLayer = ancestorLayer->parent()) { | 1177 for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancesto
rLayer; ancestorLayer = ancestorLayer->parent()) { |
| 1166 if (ancestorLayer->scrollsOverflow()) | 1178 if (ancestorLayer->scrollsOverflow()) |
| 1167 return ancestorLayer; | 1179 return ancestorLayer; |
| 1168 } | 1180 } |
| 1169 | 1181 |
| 1170 return 0; | 1182 return 0; |
| 1171 } | 1183 } |
| 1172 | 1184 |
| 1173 RenderLayer* RenderLayer::enclosingFilterLayer(bool includeSelf) const | 1185 RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) con
st |
| 1174 { | 1186 { |
| 1175 const RenderLayer* curr = includeSelf ? this : parent(); | 1187 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent(); |
| 1176 for (; curr; curr = curr->parent()) { | 1188 for (; curr; curr = curr->parent()) { |
| 1177 if (curr->requiresFullLayerImageForFilters()) | 1189 if (curr->requiresFullLayerImageForFilters()) |
| 1178 return const_cast<RenderLayer*>(curr); | 1190 return const_cast<RenderLayer*>(curr); |
| 1179 } | 1191 } |
| 1180 | 1192 |
| 1181 return 0; | 1193 return 0; |
| 1182 } | 1194 } |
| 1183 | 1195 |
| 1184 bool RenderLayer::hasAncestorWithFilterOutsets() const | 1196 bool RenderLayer::hasAncestorWithFilterOutsets() const |
| 1185 { | 1197 { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 return scrollParent; | 1724 return scrollParent; |
| 1713 } | 1725 } |
| 1714 | 1726 |
| 1715 RenderLayer* RenderLayer::clipParent() const | 1727 RenderLayer* RenderLayer::clipParent() const |
| 1716 { | 1728 { |
| 1717 const bool needsAncestorClip = compositor()->clippedByAncestor(this); | 1729 const bool needsAncestorClip = compositor()->clippedByAncestor(this); |
| 1718 | 1730 |
| 1719 RenderLayer* clipParent = 0; | 1731 RenderLayer* clipParent = 0; |
| 1720 if ((compositingReasons() & CompositingReasonOutOfFlowClipping) && !needsAnc
estorClip) { | 1732 if ((compositingReasons() & CompositingReasonOutOfFlowClipping) && !needsAnc
estorClip) { |
| 1721 if (RenderObject* containingBlock = renderer()->containingBlock()) | 1733 if (RenderObject* containingBlock = renderer()->containingBlock()) |
| 1722 clipParent = containingBlock->enclosingLayer()->enclosingCompositing
Layer(true); | 1734 clipParent = containingBlock->enclosingLayer()->enclosingCompositing
Layer(); |
| 1723 } | 1735 } |
| 1724 | 1736 |
| 1725 return clipParent; | 1737 return clipParent; |
| 1726 } | 1738 } |
| 1727 | 1739 |
| 1728 void RenderLayer::didUpdateNeedsCompositedScrolling() | 1740 void RenderLayer::didUpdateNeedsCompositedScrolling() |
| 1729 { | 1741 { |
| 1730 m_stackingNode->updateIsNormalFlowOnly(); | 1742 m_stackingNode->updateIsNormalFlowOnly(); |
| 1731 updateSelfPaintingLayer(); | 1743 updateSelfPaintingLayer(); |
| 1732 | 1744 |
| (...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 | 3518 |
| 3507 // FIXME: Descendants that are composited should not necessarily be skipped,
if they don't paint into their own | 3519 // FIXME: Descendants that are composited should not necessarily be skipped,
if they don't paint into their own |
| 3508 // separate backing. Instead, they ought to contribute to the bounds of the
layer we're trying to compute. | 3520 // separate backing. Instead, they ought to contribute to the bounds of the
layer we're trying to compute. |
| 3509 // This applies to all z-order lists below. | 3521 // This applies to all z-order lists below. |
| 3510 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren)
; | 3522 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren)
; |
| 3511 while (RenderLayerStackingNode* node = iterator.next()) { | 3523 while (RenderLayerStackingNode* node = iterator.next()) { |
| 3512 // Node's compositing ancestor may have changed its draw content status | 3524 // Node's compositing ancestor may have changed its draw content status |
| 3513 // prior to updating its bounds. The requires-own-backing-store-for-ance
stor-reasons | 3525 // prior to updating its bounds. The requires-own-backing-store-for-ance
stor-reasons |
| 3514 // could be stale. Refresh them now. | 3526 // could be stale. Refresh them now. |
| 3515 if (node->layer()->hasCompositedLayerMapping()) { | 3527 if (node->layer()->hasCompositedLayerMapping()) { |
| 3516 RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCom
positingLayer(false); | 3528 RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCom
positingLayer(ExcludeSelf); |
| 3517 node->layer()->compositedLayerMapping()->updateRequiresOwnBackingSto
reForAncestorReasons(enclosingCompositingLayer); | 3529 node->layer()->compositedLayerMapping()->updateRequiresOwnBackingSto
reForAncestorReasons(enclosingCompositingLayer); |
| 3518 } | 3530 } |
| 3519 | 3531 |
| 3520 if (flags & IncludeCompositedDescendants || !node->layer()->hasComposite
dLayerMapping()) { | 3532 if (flags & IncludeCompositedDescendants || !node->layer()->hasComposite
dLayerMapping()) { |
| 3521 LayoutRect childUnionBounds = node->layer()->calculateLayerBounds(th
is, 0, descendantFlags); | 3533 LayoutRect childUnionBounds = node->layer()->calculateLayerBounds(th
is, 0, descendantFlags); |
| 3522 unionBounds.unite(childUnionBounds); | 3534 unionBounds.unite(childUnionBounds); |
| 3523 } | 3535 } |
| 3524 } | 3536 } |
| 3525 | 3537 |
| 3526 // FIXME: We can optimize the size of the composited layers, by not enlargin
g | 3538 // 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... |
| 4096 } | 4108 } |
| 4097 } | 4109 } |
| 4098 | 4110 |
| 4099 void showLayerTree(const WebCore::RenderObject* renderer) | 4111 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4100 { | 4112 { |
| 4101 if (!renderer) | 4113 if (!renderer) |
| 4102 return; | 4114 return; |
| 4103 showLayerTree(renderer->enclosingLayer()); | 4115 showLayerTree(renderer->enclosingLayer()); |
| 4104 } | 4116 } |
| 4105 #endif | 4117 #endif |
| OLD | NEW |