Chromium Code Reviews| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 } | 282 } |
| 283 | 283 |
| 284 repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint); | 284 repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint); |
| 285 | 285 |
| 286 // Go ahead and update the reflection's position and size. | 286 // Go ahead and update the reflection's position and size. |
| 287 if (m_reflectionInfo) | 287 if (m_reflectionInfo) |
| 288 m_reflectionInfo->reflection()->layout(); | 288 m_reflectionInfo->reflection()->layout(); |
| 289 | 289 |
| 290 // Clear the IsCompositingUpdateRoot flag once we've found the first composi ting layer in this update. | 290 // Clear the IsCompositingUpdateRoot flag once we've found the first composi ting layer in this update. |
| 291 bool isUpdateRoot = (flags & IsCompositingUpdateRoot); | 291 bool isUpdateRoot = (flags & IsCompositingUpdateRoot); |
| 292 if (compositedLayerMapping()) | 292 if (hasCompositedLayerMapping()) |
| 293 flags &= ~IsCompositingUpdateRoot; | 293 flags &= ~IsCompositingUpdateRoot; |
| 294 | 294 |
| 295 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { | 295 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { |
| 296 updatePagination(); | 296 updatePagination(); |
| 297 flags |= UpdatePagination; | 297 flags |= UpdatePagination; |
| 298 } | 298 } |
| 299 | 299 |
| 300 if (renderer()->hasColumns()) | 300 if (renderer()->hasColumns()) |
| 301 flags |= UpdatePagination; | 301 flags |= UpdatePagination; |
| 302 | 302 |
| 303 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 303 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 304 child->updateLayerPositions(geometryMap, flags); | 304 child->updateLayerPositions(geometryMap, flags); |
| 305 | 305 |
| 306 if ((flags & UpdateCompositingLayers) && compositedLayerMapping()) { | 306 if ((flags & UpdateCompositingLayers) && hasCompositedLayerMapping()) { |
| 307 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly; | 307 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly; |
| 308 if (flags & NeedsFullRepaintInBacking) | 308 if (flags & NeedsFullRepaintInBacking) |
| 309 updateFlags |= CompositedLayerMapping::NeedsFullRepaint; | 309 updateFlags |= CompositedLayerMapping::NeedsFullRepaint; |
| 310 if (isUpdateRoot) | 310 if (isUpdateRoot) |
| 311 updateFlags |= CompositedLayerMapping::IsUpdateRoot; | 311 updateFlags |= CompositedLayerMapping::IsUpdateRoot; |
| 312 compositedLayerMapping()->updateAfterLayout(updateFlags); | 312 compositedLayerMapping()->updateAfterLayout(updateFlags); |
| 313 } | 313 } |
| 314 | 314 |
| 315 if (geometryMap) | 315 if (geometryMap) |
| 316 geometryMap->popMappingsToAncestor(parent()); | 316 geometryMap->popMappingsToAncestor(parent()); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 | 528 |
| 529 bool hadBlendMode = m_blendMode != BlendModeNormal; | 529 bool hadBlendMode = m_blendMode != BlendModeNormal; |
| 530 BlendMode newBlendMode = renderer()->style()->blendMode(); | 530 BlendMode newBlendMode = renderer()->style()->blendMode(); |
| 531 if (newBlendMode != m_blendMode) { | 531 if (newBlendMode != m_blendMode) { |
| 532 m_blendMode = newBlendMode; | 532 m_blendMode = newBlendMode; |
| 533 | 533 |
| 534 // Only update the flag if a blend mode is set or unset. | 534 // Only update the flag if a blend mode is set or unset. |
| 535 if (!hadBlendMode || !hasBlendMode()) | 535 if (!hadBlendMode || !hasBlendMode()) |
| 536 dirtyAncestorChainBlendedDescendantStatus(); | 536 dirtyAncestorChainBlendedDescendantStatus(); |
| 537 | 537 |
| 538 if (compositedLayerMapping()) | 538 // The compositor can only apply one blend mode per composited layer. |
| 539 if (compositingState() == PaintsIntoOwnBacking) | |
|
shawnsingh
2013/11/12 09:55:50
Wouldn't blend-mode still work for a layer that pa
Ian Vollick
2013/11/14 04:12:47
It's my impression that the paints-into-ancestor m
| |
| 539 compositedLayerMapping()->setBlendMode(newBlendMode); | 540 compositedLayerMapping()->setBlendMode(newBlendMode); |
| 540 } | 541 } |
| 541 } | 542 } |
| 542 | 543 |
| 543 void RenderLayer::updateTransform() | 544 void RenderLayer::updateTransform() |
| 544 { | 545 { |
| 545 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, | 546 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, |
| 546 // so check style too. | 547 // so check style too. |
| 547 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); | 548 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); |
| 548 bool had3DTransform = has3DTransform(); | 549 bool had3DTransform = has3DTransform(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 { | 636 { |
| 636 const Settings* settings = renderer()->document().settings(); | 637 const Settings* settings = renderer()->document().settings(); |
| 637 return settings && settings->regionBasedColumnsEnabled(); | 638 return settings && settings->regionBasedColumnsEnabled(); |
| 638 } | 639 } |
| 639 | 640 |
| 640 void RenderLayer::updatePagination() | 641 void RenderLayer::updatePagination() |
| 641 { | 642 { |
| 642 m_isPaginated = false; | 643 m_isPaginated = false; |
| 643 m_enclosingPaginationLayer = 0; | 644 m_enclosingPaginationLayer = 0; |
| 644 | 645 |
| 645 if (compositedLayerMapping() || !parent()) | 646 // If this layer is composited and paints into its own backing, it will be p laced in its |
| 647 // correct position via CompositedLayerMapping::updateGraphicsLayerGeometry. If this layer | |
| 648 // is not composited or paints into another backing, we'll have to update pa gination so | |
| 649 // that it gets positioned correctly within the layer in which it is painted . | |
| 650 if (compositingState() == PaintsIntoOwnBacking || !parent()) | |
| 646 return; // FIXME: We will have to deal with paginated compositing layers someday. | 651 return; // FIXME: We will have to deal with paginated compositing layers someday. |
| 647 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. | 652 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. |
| 648 | 653 |
| 649 // The main difference between the paginated booleans for the old column cod e and the new column code | 654 // The main difference between the paginated booleans for the old column cod e and the new column code |
| 650 // is that each paginated layer has to paint on its own with the new code. T here is no | 655 // is that each paginated layer has to paint on its own with the new code. T here is no |
| 651 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on | 656 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on |
| 652 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and | 657 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and |
| 653 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant | 658 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant |
| 654 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back | 659 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back |
| 655 // to that layer easily. | 660 // to that layer easily. |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 if (positionedParent->renderer()->hasOverflowClip()) { | 991 if (positionedParent->renderer()->hasOverflowClip()) { |
| 987 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset(); | 992 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset(); |
| 988 localPoint -= offset; | 993 localPoint -= offset; |
| 989 } | 994 } |
| 990 | 995 |
| 991 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { | 996 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { |
| 992 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer())); | 997 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer())); |
| 993 localPoint += offset; | 998 localPoint += offset; |
| 994 } | 999 } |
| 995 } else if (parent()) { | 1000 } else if (parent()) { |
| 996 if (compositedLayerMapping()) { | 1001 // Rationale: composited layers need to be positioned in their correct c olumn. If we've been squashed into another layer, |
| 1002 // or paint into another composited layer, we will already be positioned into the column-correct location. If we also | |
| 1003 // adjust our position, we'll be double compensating. | |
| 1004 if (compositingState() == PaintsIntoOwnBacking) { | |
|
shawnsingh
2013/11/12 09:55:50
I think this will break for a scenario where a lay
Ian Vollick
2013/11/14 04:12:47
I think a layer that paints-into-ancestor would it
| |
| 997 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. | 1005 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. |
| 998 // They won't split across columns properly. | 1006 // They won't split across columns properly. |
| 999 LayoutSize columnOffset; | 1007 LayoutSize columnOffset; |
| 1000 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns()) | 1008 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns()) |
| 1001 renderer()->view()->adjustForColumns(columnOffset, localPoint); | 1009 renderer()->view()->adjustForColumns(columnOffset, localPoint); |
| 1002 else | 1010 else |
| 1003 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ; | 1011 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ; |
| 1004 | 1012 |
| 1005 localPoint += columnOffset; | 1013 localPoint += columnOffset; |
| 1006 } | 1014 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1106 { | 1114 { |
| 1107 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); | 1115 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); |
| 1108 } | 1116 } |
| 1109 | 1117 |
| 1110 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint | 1118 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint |
| 1111 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with | 1119 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with |
| 1112 // the includeSelf option. It is very likely that some call sites of this functi on actually mean to use | 1120 // the includeSelf option. It is very likely that some call sites of this functi on actually mean to use |
| 1113 // enclosingCompositingLayerForRepaint(). | 1121 // enclosingCompositingLayerForRepaint(). |
| 1114 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 1122 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const |
| 1115 { | 1123 { |
| 1116 if (includeSelf && compositedLayerMapping()) | 1124 if (includeSelf && hasCompositedLayerMapping()) |
| 1117 return const_cast<RenderLayer*>(this); | 1125 return const_cast<RenderLayer*>(this); |
| 1118 | 1126 |
| 1119 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { | 1127 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { |
| 1120 if (curr->compositedLayerMapping()) | 1128 if (curr->hasCompositedLayerMapping()) |
| 1121 return const_cast<RenderLayer*>(curr); | 1129 return const_cast<RenderLayer*>(curr); |
| 1122 } | 1130 } |
| 1123 | 1131 |
| 1124 return 0; | 1132 return 0; |
| 1125 } | 1133 } |
| 1126 | 1134 |
| 1127 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const | 1135 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const |
| 1128 { | 1136 { |
| 1129 if (includeSelf && compositingState() == PaintsIntoOwnBacking) | 1137 if (includeSelf && compositingState() == PaintsIntoOwnBacking) |
| 1130 return const_cast<RenderLayer*>(this); | 1138 return const_cast<RenderLayer*>(this); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { | 1192 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { |
| 1185 RenderLayerModelObject* renderer = curr->renderer(); | 1193 RenderLayerModelObject* renderer = curr->renderer(); |
| 1186 if (renderer->style()->hasFilterOutsets()) | 1194 if (renderer->style()->hasFilterOutsets()) |
| 1187 return true; | 1195 return true; |
| 1188 } | 1196 } |
| 1189 return false; | 1197 return false; |
| 1190 } | 1198 } |
| 1191 | 1199 |
| 1192 RenderLayer* RenderLayer::clippingRootForPainting() const | 1200 RenderLayer* RenderLayer::clippingRootForPainting() const |
| 1193 { | 1201 { |
| 1194 if (compositedLayerMapping()) | 1202 // The compositor will handle clipping (via GraphicsLayers), but only for |
| 1203 // those layers that own a backing. All other layers (those that are, say, | |
| 1204 // squashed or paint into another backing) must handle their clipping in | |
| 1205 // software as they paint into their associated compositing ancestor for | |
| 1206 // repaint. | |
| 1207 if (compositingState() == PaintsIntoOwnBacking) | |
|
shawnsingh
2013/11/12 09:55:50
red flag in comment - "only for layers that own a
Ian Vollick
2013/11/14 04:12:47
VWhen I say "own a backing", I mean owns a mapping
| |
| 1195 return const_cast<RenderLayer*>(this); | 1208 return const_cast<RenderLayer*>(this); |
| 1196 | 1209 |
| 1197 const RenderLayer* current = this; | 1210 const RenderLayer* current = this; |
| 1198 while (current) { | 1211 while (current) { |
| 1199 if (current->isRootLayer()) | 1212 if (current->isRootLayer()) |
| 1200 return const_cast<RenderLayer*>(current); | 1213 return const_cast<RenderLayer*>(current); |
| 1201 | 1214 |
| 1202 current = compositingContainer(current); | 1215 current = compositingContainer(current); |
| 1203 ASSERT(current); | 1216 ASSERT(current); |
| 1204 if (current->transform() | 1217 if (current->transform() |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1223 bool RenderLayer::isTransparent() const | 1236 bool RenderLayer::isTransparent() const |
| 1224 { | 1237 { |
| 1225 if (renderer()->node() && renderer()->node()->isSVGElement()) | 1238 if (renderer()->node() && renderer()->node()->isSVGElement()) |
| 1226 return false; | 1239 return false; |
| 1227 | 1240 |
| 1228 return renderer()->isTransparent() || renderer()->hasMask(); | 1241 return renderer()->isTransparent() || renderer()->hasMask(); |
| 1229 } | 1242 } |
| 1230 | 1243 |
| 1231 RenderLayer* RenderLayer::transparentPaintingAncestor() | 1244 RenderLayer* RenderLayer::transparentPaintingAncestor() |
| 1232 { | 1245 { |
| 1233 if (compositedLayerMapping()) | 1246 // The compositor will handle applying opacity for true composited layers. |
| 1247 // If we squish into a layer that is not transparent, or we paint into anoth er | |
| 1248 // layer's backing we won't be able to rely on the compositor to do this; we | |
| 1249 // must handle our transparency in software as we paint into our ancestor | |
| 1250 // compositing layer for repaint. | |
| 1251 if (compositingState() == PaintsIntoOwnBacking) | |
|
shawnsingh
2013/11/12 09:55:50
This seems like something we should make a layout
| |
| 1234 return 0; | 1252 return 0; |
| 1235 | 1253 |
| 1236 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { | 1254 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { |
| 1237 if (curr->compositedLayerMapping()) | 1255 if (curr->compositingState() == PaintsIntoOwnBacking) |
| 1238 return 0; | 1256 return 0; |
| 1239 if (curr->isTransparent()) | 1257 if (curr->isTransparent()) |
| 1240 return curr; | 1258 return curr; |
| 1241 } | 1259 } |
| 1242 return 0; | 1260 return 0; |
| 1243 } | 1261 } |
| 1244 | 1262 |
| 1245 enum TransparencyClipBoxBehavior { | 1263 enum TransparencyClipBoxBehavior { |
| 1246 PaintingTransparencyClipBox, | 1264 PaintingTransparencyClipBox, |
| 1247 HitTestingTransparencyClipBox | 1265 HitTestingTransparencyClipBox |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1757 void RenderLayer::updateScrollableArea() | 1775 void RenderLayer::updateScrollableArea() |
| 1758 { | 1776 { |
| 1759 if (requiresScrollableArea()) | 1777 if (requiresScrollableArea()) |
| 1760 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox())); | 1778 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox())); |
| 1761 else | 1779 else |
| 1762 m_scrollableArea = nullptr; | 1780 m_scrollableArea = nullptr; |
| 1763 } | 1781 } |
| 1764 | 1782 |
| 1765 PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const | 1783 PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const |
| 1766 { | 1784 { |
| 1767 if (CompositedLayerMapping* mapping = compositedLayerMapping()) | 1785 if (hasCompositedLayerMapping()) |
| 1768 return mapping->collectTrackedRepaintRects(); | 1786 return compositedLayerMapping()->collectTrackedRepaintRects(); |
| 1769 return nullptr; | 1787 return nullptr; |
| 1770 } | 1788 } |
| 1771 | 1789 |
| 1772 bool RenderLayer::hasOverflowControls() const | 1790 bool RenderLayer::hasOverflowControls() const |
| 1773 { | 1791 { |
| 1774 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1792 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); |
| 1775 } | 1793 } |
| 1776 | 1794 |
| 1777 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags) | 1795 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags) |
| 1778 { | 1796 { |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3576 } | 3594 } |
| 3577 } | 3595 } |
| 3578 | 3596 |
| 3579 // FIXME: should probably just pass 'flags' down to descendants. | 3597 // FIXME: should probably just pass 'flags' down to descendants. |
| 3580 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); | 3598 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); |
| 3581 | 3599 |
| 3582 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); | 3600 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
| 3583 | 3601 |
| 3584 if (m_reflectionInfo) { | 3602 if (m_reflectionInfo) { |
| 3585 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer(); | 3603 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer(); |
| 3586 if (!reflectionLayer->compositedLayerMapping()) { | 3604 if (!reflectionLayer->hasCompositedLayerMapping()) { |
|
Ian Vollick
2013/11/14 04:12:47
I should mention that my assumption (which I shoul
| |
| 3587 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags); | 3605 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags); |
| 3588 unionBounds.unite(childUnionBounds); | 3606 unionBounds.unite(childUnionBounds); |
| 3589 } | 3607 } |
| 3590 } | 3608 } |
| 3591 | 3609 |
| 3592 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size())); | 3610 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size())); |
| 3593 | 3611 |
| 3594 #if !ASSERT_DISABLED | 3612 #if !ASSERT_DISABLED |
| 3595 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); | 3613 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); |
| 3596 #endif | 3614 #endif |
| 3597 | 3615 |
| 3598 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own | 3616 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own |
| 3599 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute. | 3617 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute. |
| 3600 // This applies to all z-order lists below. | 3618 // This applies to all z-order lists below. |
| 3601 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; | 3619 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; |
| 3602 while (RenderLayerStackingNode* node = iterator.next()) { | 3620 while (RenderLayerStackingNode* node = iterator.next()) { |
| 3603 if (flags & IncludeCompositedDescendants || !node->layer()->compositedLa yerMapping()) { | 3621 if (flags & IncludeCompositedDescendants || node->layer()->compositingSt ate() != PaintsIntoOwnBacking) { |
|
shawnsingh
2013/11/12 09:55:50
Can we get a layout test for this? I had made thi
Ian Vollick
2013/11/14 04:12:47
Actually, this is hit by a layout test: transforms
| |
| 3604 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags); | 3622 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags); |
| 3605 unionBounds.unite(childUnionBounds); | 3623 unionBounds.unite(childUnionBounds); |
| 3606 } | 3624 } |
| 3607 } | 3625 } |
| 3608 | 3626 |
| 3609 // FIXME: We can optimize the size of the composited layers, by not enlargin g | 3627 // FIXME: We can optimize the size of the composited layers, by not enlargin g |
| 3610 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. | 3628 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. |
| 3611 // https://bugs.webkit.org/show_bug.cgi?id=81239 | 3629 // https://bugs.webkit.org/show_bug.cgi?id=81239 |
| 3612 if (flags & IncludeLayerFilterOutsets) | 3630 if (flags & IncludeLayerFilterOutsets) |
| 3613 renderer->style()->filterOutsets().expandRect(unionBounds); | 3631 renderer->style()->filterOutsets().expandRect(unionBounds); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 3636 if (!m_compositedLayerMapping) | 3654 if (!m_compositedLayerMapping) |
| 3637 return NotComposited; | 3655 return NotComposited; |
| 3638 | 3656 |
| 3639 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) | 3657 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) |
| 3640 return HasOwnBackingButPaintsIntoAncestor; | 3658 return HasOwnBackingButPaintsIntoAncestor; |
| 3641 | 3659 |
| 3642 ASSERT(m_compositedLayerMapping); | 3660 ASSERT(m_compositedLayerMapping); |
| 3643 return PaintsIntoOwnBacking; | 3661 return PaintsIntoOwnBacking; |
| 3644 } | 3662 } |
| 3645 | 3663 |
| 3646 CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping() | 3664 CompositedLayerMappingPtr RenderLayer::ensureCompositedLayerMapping() |
| 3647 { | 3665 { |
| 3648 if (!m_compositedLayerMapping) { | 3666 if (!m_compositedLayerMapping) { |
| 3649 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this)); | 3667 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this)); |
| 3650 compositor()->layerBecameComposited(this); | 3668 compositor()->layerBecameComposited(this); |
| 3651 | 3669 |
| 3652 updateOrRemoveFilterEffectRenderer(); | 3670 updateOrRemoveFilterEffectRenderer(); |
| 3653 | 3671 |
| 3654 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | 3672 if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
| 3655 compositedLayerMapping()->setBlendMode(m_blendMode); | 3673 compositedLayerMapping()->setBlendMode(m_blendMode); |
| 3656 } | 3674 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3723 || listBackgroundIsKnownToBeOpaqueInRect(m_stackingNode->normalFlowList( ), localRect); | 3741 || listBackgroundIsKnownToBeOpaqueInRect(m_stackingNode->normalFlowList( ), localRect); |
| 3724 } | 3742 } |
| 3725 | 3743 |
| 3726 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer StackingNode*>* list, const LayoutRect& localRect) const | 3744 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer StackingNode*>* list, const LayoutRect& localRect) const |
| 3727 { | 3745 { |
| 3728 if (!list || list->isEmpty()) | 3746 if (!list || list->isEmpty()) |
| 3729 return false; | 3747 return false; |
| 3730 | 3748 |
| 3731 for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->r begin(); iter != list->rend(); ++iter) { | 3749 for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->r begin(); iter != list->rend(); ++iter) { |
| 3732 const RenderLayer* childLayer = (*iter)->layer(); | 3750 const RenderLayer* childLayer = (*iter)->layer(); |
| 3733 if (childLayer->compositedLayerMapping()) | 3751 // We skip layers that paint into their own backing (they do not affect the |
| 3752 // opaqueness of us). | |
| 3753 if (childLayer->compositingState() == PaintsIntoOwnBacking) | |
| 3734 continue; | 3754 continue; |
| 3735 | 3755 |
| 3736 if (!childLayer->canUseConvertToLayerCoords()) | 3756 if (!childLayer->canUseConvertToLayerCoords()) |
| 3737 continue; | 3757 continue; |
| 3738 | 3758 |
| 3739 LayoutPoint childOffset; | 3759 LayoutPoint childOffset; |
| 3740 LayoutRect childLocalRect(localRect); | 3760 LayoutRect childLocalRect(localRect); |
| 3741 childLayer->convertToLayerCoords(this, childOffset); | 3761 childLayer->convertToLayerCoords(this, childOffset); |
| 3742 childLocalRect.moveBy(-childOffset); | 3762 childLocalRect.moveBy(-childOffset); |
| 3743 | 3763 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3896 | 3916 |
| 3897 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const | 3917 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const |
| 3898 { | 3918 { |
| 3899 ASSERT(newStyle); | 3919 ASSERT(newStyle); |
| 3900 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip()); | 3920 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip()); |
| 3901 } | 3921 } |
| 3902 | 3922 |
| 3903 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const | 3923 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const |
| 3904 { | 3924 { |
| 3905 ASSERT(newStyle); | 3925 ASSERT(newStyle); |
| 3906 return !compositedLayerMapping() && oldStyle && (oldStyle->overflowX() != ne wStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->layer() ->hasCompositingDescendant(); | 3926 return !hasCompositedLayerMapping() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->laye r()->hasCompositingDescendant(); |
| 3907 } | 3927 } |
| 3908 | 3928 |
| 3909 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const | 3929 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const |
| 3910 { | 3930 { |
| 3911 if (!hasOrHadFilters(oldStyle, newStyle)) | 3931 if (!hasOrHadFilters(oldStyle, newStyle)) |
| 3912 return false; | 3932 return false; |
| 3913 | 3933 |
| 3914 if (renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer (), CSSPropertyWebkitFilter)) { | 3934 if (renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer (), CSSPropertyWebkitFilter)) { |
| 3915 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers. | 3935 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers. |
| 3916 // All of the layers above us should have been promoted to compositing l ayers already. | 3936 // All of the layers above us should have been promoted to compositing l ayers already. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3940 } | 3960 } |
| 3941 | 3961 |
| 3942 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) | 3962 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) |
| 3943 { | 3963 { |
| 3944 if (!hasOrHadFilters(oldStyle, newStyle)) | 3964 if (!hasOrHadFilters(oldStyle, newStyle)) |
| 3945 return; | 3965 return; |
| 3946 | 3966 |
| 3947 updateOrRemoveFilterClients(); | 3967 updateOrRemoveFilterClients(); |
| 3948 // During an accelerated animation, both WebKit and the compositor animate p roperties. | 3968 // During an accelerated animation, both WebKit and the compositor animate p roperties. |
| 3949 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. | 3969 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. |
| 3950 bool shouldUpdateFilters = compositedLayerMapping() && !renderer()->animatio n().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter) ; | 3970 bool shouldUpdateFilters = compositingState() == PaintsIntoOwnBacking && !re nderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPro pertyWebkitFilter); |
| 3951 if (shouldUpdateFilters) | 3971 if (shouldUpdateFilters) |
| 3952 compositedLayerMapping()->updateFilters(renderer()->style()); | 3972 compositedLayerMapping()->updateFilters(renderer()->style()); |
| 3953 updateOrRemoveFilterEffectRenderer(); | 3973 updateOrRemoveFilterEffectRenderer(); |
| 3954 } | 3974 } |
| 3955 | 3975 |
| 3956 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) | 3976 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
| 3957 { | 3977 { |
| 3958 m_stackingNode->updateIsNormalFlowOnly(); | 3978 m_stackingNode->updateIsNormalFlowOnly(); |
| 3959 | 3979 |
| 3960 if (m_scrollableArea) | 3980 if (m_scrollableArea) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3979 if (paintsWithFilters()) | 3999 if (paintsWithFilters()) |
| 3980 didPaintWithFilters = true; | 4000 didPaintWithFilters = true; |
| 3981 updateFilters(oldStyle, renderer()->style()); | 4001 updateFilters(oldStyle, renderer()->style()); |
| 3982 | 4002 |
| 3983 const RenderStyle* newStyle = renderer()->style(); | 4003 const RenderStyle* newStyle = renderer()->style(); |
| 3984 if (compositor()->updateLayerCompositingState(this) | 4004 if (compositor()->updateLayerCompositingState(this) |
| 3985 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 4005 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 3986 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 4006 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 3987 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) | 4007 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) |
| 3988 compositor()->setCompositingLayersNeedRebuild(); | 4008 compositor()->setCompositingLayersNeedRebuild(); |
| 3989 else if (compositedLayerMapping()) | 4009 else if (hasCompositedLayerMapping()) |
| 3990 compositedLayerMapping()->updateGraphicsLayerGeometry(); | 4010 compositedLayerMapping()->updateGraphicsLayerGeometry(); |
| 3991 } | 4011 } |
| 3992 | 4012 |
| 3993 bool RenderLayer::scrollsOverflow() const | 4013 bool RenderLayer::scrollsOverflow() const |
| 3994 { | 4014 { |
| 3995 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4015 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) |
| 3996 return scrollableArea->scrollsOverflow(); | 4016 return scrollableArea->scrollsOverflow(); |
| 3997 | 4017 |
| 3998 return false; | 4018 return false; |
| 3999 } | 4019 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4157 } | 4177 } |
| 4158 } | 4178 } |
| 4159 | 4179 |
| 4160 void showLayerTree(const WebCore::RenderObject* renderer) | 4180 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4161 { | 4181 { |
| 4162 if (!renderer) | 4182 if (!renderer) |
| 4163 return; | 4183 return; |
| 4164 showLayerTree(renderer->enclosingLayer()); | 4184 showLayerTree(renderer->enclosingLayer()); |
| 4165 } | 4185 } |
| 4166 #endif | 4186 #endif |
| OLD | NEW |