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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 m_enclosingPaginationLayer = 0; | 281 m_enclosingPaginationLayer = 0; |
| 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 // Layers are positioned in the space of the composited layer they paint int o, so we only clear | |
| 292 // IsCompositingUpdateRoot when we reach a layer that paints into its own ba cking. | |
| 291 bool isUpdateRoot = (flags & IsCompositingUpdateRoot); | 293 bool isUpdateRoot = (flags & IsCompositingUpdateRoot); |
| 292 if (compositedLayerMapping()) | 294 if (compositingState() == PaintsIntoOwnBacking) |
| 293 flags &= ~IsCompositingUpdateRoot; | 295 flags &= ~IsCompositingUpdateRoot; |
| 294 | 296 |
| 295 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { | 297 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { |
| 296 updatePagination(); | 298 updatePagination(); |
| 297 flags |= UpdatePagination; | 299 flags |= UpdatePagination; |
| 298 } | 300 } |
| 299 | 301 |
| 300 if (renderer()->hasColumns()) | 302 if (renderer()->hasColumns()) |
| 301 flags |= UpdatePagination; | 303 flags |= UpdatePagination; |
| 302 | 304 |
| 303 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 305 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 304 child->updateLayerPositions(geometryMap, flags); | 306 child->updateLayerPositions(geometryMap, flags); |
| 305 | 307 |
| 306 if ((flags & UpdateCompositingLayers) && compositedLayerMapping()) { | 308 if ((flags & UpdateCompositingLayers) && compositingState() == PaintsIntoOwn Backing) { |
| 307 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly; | 309 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly; |
| 308 if (flags & NeedsFullRepaintInBacking) | 310 if (flags & NeedsFullRepaintInBacking) |
| 309 updateFlags |= CompositedLayerMapping::NeedsFullRepaint; | 311 updateFlags |= CompositedLayerMapping::NeedsFullRepaint; |
| 310 if (isUpdateRoot) | 312 if (isUpdateRoot) |
| 311 updateFlags |= CompositedLayerMapping::IsUpdateRoot; | 313 updateFlags |= CompositedLayerMapping::IsUpdateRoot; |
| 312 compositedLayerMapping()->updateAfterLayout(updateFlags); | 314 compositedLayerMapping()->updateAfterLayout(updateFlags); |
| 313 } | 315 } |
| 314 | 316 |
| 315 if (geometryMap) | 317 if (geometryMap) |
| 316 geometryMap->popMappingsToAncestor(parent()); | 318 geometryMap->popMappingsToAncestor(parent()); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 | 530 |
| 529 bool hadBlendMode = m_blendMode != BlendModeNormal; | 531 bool hadBlendMode = m_blendMode != BlendModeNormal; |
| 530 BlendMode newBlendMode = renderer()->style()->blendMode(); | 532 BlendMode newBlendMode = renderer()->style()->blendMode(); |
| 531 if (newBlendMode != m_blendMode) { | 533 if (newBlendMode != m_blendMode) { |
| 532 m_blendMode = newBlendMode; | 534 m_blendMode = newBlendMode; |
| 533 | 535 |
| 534 // Only update the flag if a blend mode is set or unset. | 536 // Only update the flag if a blend mode is set or unset. |
| 535 if (!hadBlendMode || !hasBlendMode()) | 537 if (!hadBlendMode || !hasBlendMode()) |
| 536 dirtyAncestorChainBlendedDescendantStatus(); | 538 dirtyAncestorChainBlendedDescendantStatus(); |
| 537 | 539 |
| 538 if (compositedLayerMapping()) | 540 // The compositor can only apply one blend mode per composited layer. |
| 541 if (compositingState() == PaintsIntoOwnBacking) | |
| 539 compositedLayerMapping()->setBlendMode(newBlendMode); | 542 compositedLayerMapping()->setBlendMode(newBlendMode); |
| 540 } | 543 } |
| 541 } | 544 } |
| 542 | 545 |
| 543 void RenderLayer::updateTransform() | 546 void RenderLayer::updateTransform() |
| 544 { | 547 { |
| 545 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, | 548 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, |
| 546 // so check style too. | 549 // so check style too. |
| 547 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); | 550 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); |
| 548 bool had3DTransform = has3DTransform(); | 551 bool had3DTransform = has3DTransform(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 { | 638 { |
| 636 const Settings* settings = renderer()->document().settings(); | 639 const Settings* settings = renderer()->document().settings(); |
| 637 return settings && settings->regionBasedColumnsEnabled(); | 640 return settings && settings->regionBasedColumnsEnabled(); |
| 638 } | 641 } |
| 639 | 642 |
| 640 void RenderLayer::updatePagination() | 643 void RenderLayer::updatePagination() |
| 641 { | 644 { |
| 642 m_isPaginated = false; | 645 m_isPaginated = false; |
| 643 m_enclosingPaginationLayer = 0; | 646 m_enclosingPaginationLayer = 0; |
| 644 | 647 |
| 645 if (compositedLayerMapping() || !parent()) | 648 if (compositingState() == PaintsIntoOwnBacking || !parent()) |
|
shawnsingh
2013/11/05 10:20:27
I'm really not sure about this one. If you feel c
| |
| 646 return; // FIXME: We will have to deal with paginated compositing layers someday. | 649 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. | 650 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. |
| 648 | 651 |
| 649 // The main difference between the paginated booleans for the old column cod e and the new column code | 652 // 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 | 653 // 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 | 654 // 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 | 655 // "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 | 656 // 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 | 657 // 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. | 658 // to that layer easily. |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 if (positionedParent->renderer()->hasOverflowClip()) { | 989 if (positionedParent->renderer()->hasOverflowClip()) { |
| 987 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset(); | 990 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset(); |
| 988 localPoint -= offset; | 991 localPoint -= offset; |
| 989 } | 992 } |
| 990 | 993 |
| 991 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { | 994 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { |
| 992 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer())); | 995 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer())); |
| 993 localPoint += offset; | 996 localPoint += offset; |
| 994 } | 997 } |
| 995 } else if (parent()) { | 998 } else if (parent()) { |
| 996 if (compositedLayerMapping()) { | 999 // Rationale: composited layers need to be positioned in their correct c olumn. If we've been squashed into another layer, |
| 1000 // it will already be positioned into the column-correct location. If we also adjust our position, we'll be double | |
| 1001 // compensating. | |
| 1002 if (compositingState() == PaintsIntoOwnBacking) { | |
|
shawnsingh
2013/11/05 10:20:27
What about HasOwnBackingButPaintsIntoAncestor ?
Ian Vollick
2013/11/08 03:35:12
That was the point I was trying to address with th
| |
| 997 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. | 1003 // 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. | 1004 // They won't split across columns properly. |
| 999 LayoutSize columnOffset; | 1005 LayoutSize columnOffset; |
| 1000 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns()) | 1006 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns()) |
| 1001 renderer()->view()->adjustForColumns(columnOffset, localPoint); | 1007 renderer()->view()->adjustForColumns(columnOffset, localPoint); |
| 1002 else | 1008 else |
| 1003 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ; | 1009 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ; |
| 1004 | 1010 |
| 1005 localPoint += columnOffset; | 1011 localPoint += columnOffset; |
| 1006 } | 1012 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1106 { | 1112 { |
| 1107 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); | 1113 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); |
| 1108 } | 1114 } |
| 1109 | 1115 |
| 1110 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint | 1116 // 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 | 1117 // 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 | 1118 // the includeSelf option. It is very likely that some call sites of this functi on actually mean to use |
| 1113 // enclosingCompositingLayerForRepaint(). | 1119 // enclosingCompositingLayerForRepaint(). |
| 1114 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 1120 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const |
| 1115 { | 1121 { |
| 1116 if (includeSelf && compositedLayerMapping()) | 1122 if (includeSelf && compositingState() != NotComposited) |
| 1117 return const_cast<RenderLayer*>(this); | 1123 return const_cast<RenderLayer*>(this); |
| 1118 | 1124 |
| 1119 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { | 1125 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { |
| 1120 if (curr->compositedLayerMapping()) | 1126 if (curr->compositingState() != NotComposited) |
| 1121 return const_cast<RenderLayer*>(curr); | 1127 return const_cast<RenderLayer*>(curr); |
| 1122 } | 1128 } |
| 1123 | 1129 |
| 1124 return 0; | 1130 return 0; |
| 1125 } | 1131 } |
| 1126 | 1132 |
| 1127 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const | 1133 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const |
| 1128 { | 1134 { |
| 1129 if (includeSelf && compositingState() == PaintsIntoOwnBacking) | 1135 if (includeSelf && compositingState() == PaintsIntoOwnBacking) |
| 1130 return const_cast<RenderLayer*>(this); | 1136 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()) { | 1190 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { |
| 1185 RenderLayerModelObject* renderer = curr->renderer(); | 1191 RenderLayerModelObject* renderer = curr->renderer(); |
| 1186 if (renderer->style()->hasFilterOutsets()) | 1192 if (renderer->style()->hasFilterOutsets()) |
| 1187 return true; | 1193 return true; |
| 1188 } | 1194 } |
| 1189 return false; | 1195 return false; |
| 1190 } | 1196 } |
| 1191 | 1197 |
| 1192 RenderLayer* RenderLayer::clippingRootForPainting() const | 1198 RenderLayer* RenderLayer::clippingRootForPainting() const |
| 1193 { | 1199 { |
| 1194 if (compositedLayerMapping()) | 1200 if (compositingState() == PaintsIntoOwnBacking) |
|
shawnsingh
2013/11/05 10:20:27
Should this also include HasOwnBackingButPaintsInt
| |
| 1195 return const_cast<RenderLayer*>(this); | 1201 return const_cast<RenderLayer*>(this); |
| 1196 | 1202 |
| 1197 const RenderLayer* current = this; | 1203 const RenderLayer* current = this; |
| 1198 while (current) { | 1204 while (current) { |
| 1199 if (current->isRootLayer()) | 1205 if (current->isRootLayer()) |
| 1200 return const_cast<RenderLayer*>(current); | 1206 return const_cast<RenderLayer*>(current); |
| 1201 | 1207 |
| 1202 current = compositingContainer(current); | 1208 current = compositingContainer(current); |
| 1203 ASSERT(current); | 1209 ASSERT(current); |
| 1204 if (current->transform() | 1210 if (current->transform() |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1223 bool RenderLayer::isTransparent() const | 1229 bool RenderLayer::isTransparent() const |
| 1224 { | 1230 { |
| 1225 if (renderer()->node() && renderer()->node()->isSVGElement()) | 1231 if (renderer()->node() && renderer()->node()->isSVGElement()) |
| 1226 return false; | 1232 return false; |
| 1227 | 1233 |
| 1228 return renderer()->isTransparent() || renderer()->hasMask(); | 1234 return renderer()->isTransparent() || renderer()->hasMask(); |
| 1229 } | 1235 } |
| 1230 | 1236 |
| 1231 RenderLayer* RenderLayer::transparentPaintingAncestor() | 1237 RenderLayer* RenderLayer::transparentPaintingAncestor() |
| 1232 { | 1238 { |
| 1233 if (compositedLayerMapping()) | 1239 // The compositor will handle applying opacity for true composited layers. |
| 1240 // If we squish into a layer that is not transparent, we won't be able to | |
| 1241 // rely on it to do this. | |
| 1242 if (compositingState() == PaintsIntoOwnBacking) | |
|
shawnsingh
2013/11/05 10:20:27
Again, I think we need to include HasOwnBackingbut
| |
| 1234 return 0; | 1243 return 0; |
| 1235 | 1244 |
| 1236 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { | 1245 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { |
| 1237 if (curr->compositedLayerMapping()) | 1246 if (curr->compositingState() == PaintsIntoOwnBacking) |
| 1238 return 0; | 1247 return 0; |
| 1239 if (curr->isTransparent()) | 1248 if (curr->isTransparent()) |
| 1240 return curr; | 1249 return curr; |
| 1241 } | 1250 } |
| 1242 return 0; | 1251 return 0; |
| 1243 } | 1252 } |
| 1244 | 1253 |
| 1245 enum TransparencyClipBoxBehavior { | 1254 enum TransparencyClipBoxBehavior { |
| 1246 PaintingTransparencyClipBox, | 1255 PaintingTransparencyClipBox, |
| 1247 HitTestingTransparencyClipBox | 1256 HitTestingTransparencyClipBox |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1763 void RenderLayer::updateScrollableArea() | 1772 void RenderLayer::updateScrollableArea() |
| 1764 { | 1773 { |
| 1765 if (requiresScrollableArea()) | 1774 if (requiresScrollableArea()) |
| 1766 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox())); | 1775 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox())); |
| 1767 else | 1776 else |
| 1768 m_scrollableArea = nullptr; | 1777 m_scrollableArea = nullptr; |
| 1769 } | 1778 } |
| 1770 | 1779 |
| 1771 PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const | 1780 PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const |
| 1772 { | 1781 { |
| 1773 if (CompositedLayerMapping* mapping = compositedLayerMapping()) | 1782 if (compositingState() == PaintsIntoOwnBacking) |
|
shawnsingh
2013/11/05 10:20:27
So yeah, the theme of my review - did you remember
| |
| 1774 return mapping->collectTrackedRepaintRects(); | 1783 return compositedLayerMapping()->collectTrackedRepaintRects(); |
| 1775 return nullptr; | 1784 return nullptr; |
| 1776 } | 1785 } |
| 1777 | 1786 |
| 1778 bool RenderLayer::hasOverflowControls() const | 1787 bool RenderLayer::hasOverflowControls() const |
| 1779 { | 1788 { |
| 1780 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1789 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); |
| 1781 } | 1790 } |
| 1782 | 1791 |
| 1783 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags) | 1792 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags) |
| 1784 { | 1793 { |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3582 } | 3591 } |
| 3583 } | 3592 } |
| 3584 | 3593 |
| 3585 // FIXME: should probably just pass 'flags' down to descendants. | 3594 // FIXME: should probably just pass 'flags' down to descendants. |
| 3586 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); | 3595 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); |
| 3587 | 3596 |
| 3588 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); | 3597 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
| 3589 | 3598 |
| 3590 if (m_reflectionInfo) { | 3599 if (m_reflectionInfo) { |
| 3591 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer(); | 3600 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer(); |
| 3592 if (!reflectionLayer->compositedLayerMapping()) { | 3601 // If the reflection layer paints either into its compositing ancestor |
| 3602 // or is not composited all, we have to consider its effect on our bound s. | |
| 3603 if (reflectionLayer->compositingState() != PaintsIntoOwnBacking) { | |
| 3593 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags); | 3604 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags); |
| 3594 unionBounds.unite(childUnionBounds); | 3605 unionBounds.unite(childUnionBounds); |
| 3595 } | 3606 } |
| 3596 } | 3607 } |
| 3597 | 3608 |
| 3598 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size())); | 3609 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size())); |
| 3599 | 3610 |
| 3600 #if !ASSERT_DISABLED | 3611 #if !ASSERT_DISABLED |
| 3601 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); | 3612 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); |
| 3602 #endif | 3613 #endif |
| 3603 | 3614 |
| 3604 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own | |
| 3605 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute. | |
| 3606 // This applies to all z-order lists below. | |
| 3607 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; | 3615 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; |
| 3608 while (RenderLayerStackingNode* node = iterator.next()) { | 3616 while (RenderLayerStackingNode* node = iterator.next()) { |
| 3609 if (flags & IncludeCompositedDescendants || !node->layer()->compositedLa yerMapping()) { | 3617 if (flags & IncludeCompositedDescendants || node->layer()->compositingSt ate() != PaintsIntoOwnBacking) { |
|
shawnsingh
2013/11/05 10:20:27
This was another place where I put a FIXME because
Ian Vollick
2013/11/08 03:35:12
Sure. I've reinstated the FIXME and matched the ex
| |
| 3610 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags); | 3618 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags); |
| 3611 unionBounds.unite(childUnionBounds); | 3619 unionBounds.unite(childUnionBounds); |
| 3612 } | 3620 } |
| 3613 } | 3621 } |
| 3614 | 3622 |
| 3615 // FIXME: We can optimize the size of the composited layers, by not enlargin g | 3623 // FIXME: We can optimize the size of the composited layers, by not enlargin g |
| 3616 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. | 3624 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. |
| 3617 // https://bugs.webkit.org/show_bug.cgi?id=81239 | 3625 // https://bugs.webkit.org/show_bug.cgi?id=81239 |
| 3618 if (flags & IncludeLayerFilterOutsets) | 3626 if (flags & IncludeLayerFilterOutsets) |
| 3619 renderer->style()->filterOutsets().expandRect(unionBounds); | 3627 renderer->style()->filterOutsets().expandRect(unionBounds); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 3642 if (!m_compositedLayerMapping) | 3650 if (!m_compositedLayerMapping) |
| 3643 return NotComposited; | 3651 return NotComposited; |
| 3644 | 3652 |
| 3645 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) | 3653 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) |
| 3646 return HasOwnBackingButPaintsIntoAncestor; | 3654 return HasOwnBackingButPaintsIntoAncestor; |
| 3647 | 3655 |
| 3648 ASSERT(m_compositedLayerMapping); | 3656 ASSERT(m_compositedLayerMapping); |
| 3649 return PaintsIntoOwnBacking; | 3657 return PaintsIntoOwnBacking; |
| 3650 } | 3658 } |
| 3651 | 3659 |
| 3652 CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping() | 3660 CompositedLayerMappingPtr RenderLayer::ensureCompositedLayerMapping() |
| 3653 { | 3661 { |
| 3654 if (!m_compositedLayerMapping) { | 3662 if (!m_compositedLayerMapping) { |
| 3655 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this)); | 3663 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this)); |
| 3656 compositor()->layerBecameComposited(this); | 3664 compositor()->layerBecameComposited(this); |
| 3657 | 3665 |
| 3658 updateOrRemoveFilterEffectRenderer(); | 3666 updateOrRemoveFilterEffectRenderer(); |
| 3659 | 3667 |
| 3660 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | 3668 if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
| 3661 compositedLayerMapping()->setBlendMode(m_blendMode); | 3669 compositedLayerMapping()->setBlendMode(m_blendMode); |
| 3662 } | 3670 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3729 || listBackgroundIsKnownToBeOpaqueInRect(m_stackingNode->normalFlowList( ), localRect); | 3737 || listBackgroundIsKnownToBeOpaqueInRect(m_stackingNode->normalFlowList( ), localRect); |
| 3730 } | 3738 } |
| 3731 | 3739 |
| 3732 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer StackingNode*>* list, const LayoutRect& localRect) const | 3740 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer StackingNode*>* list, const LayoutRect& localRect) const |
| 3733 { | 3741 { |
| 3734 if (!list || list->isEmpty()) | 3742 if (!list || list->isEmpty()) |
| 3735 return false; | 3743 return false; |
| 3736 | 3744 |
| 3737 for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->r begin(); iter != list->rend(); ++iter) { | 3745 for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->r begin(); iter != list->rend(); ++iter) { |
| 3738 const RenderLayer* childLayer = (*iter)->layer(); | 3746 const RenderLayer* childLayer = (*iter)->layer(); |
| 3739 if (childLayer->compositedLayerMapping()) | 3747 if (childLayer->compositingState() == PaintsIntoOwnBacking) |
| 3740 continue; | 3748 continue; |
| 3741 | 3749 |
| 3742 if (!childLayer->canUseConvertToLayerCoords()) | 3750 if (!childLayer->canUseConvertToLayerCoords()) |
| 3743 continue; | 3751 continue; |
| 3744 | 3752 |
| 3745 LayoutPoint childOffset; | 3753 LayoutPoint childOffset; |
| 3746 LayoutRect childLocalRect(localRect); | 3754 LayoutRect childLocalRect(localRect); |
| 3747 childLayer->convertToLayerCoords(this, childOffset); | 3755 childLayer->convertToLayerCoords(this, childOffset); |
| 3748 childLocalRect.moveBy(-childOffset); | 3756 childLocalRect.moveBy(-childOffset); |
| 3749 | 3757 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3902 | 3910 |
| 3903 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const | 3911 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const |
| 3904 { | 3912 { |
| 3905 ASSERT(newStyle); | 3913 ASSERT(newStyle); |
| 3906 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip()); | 3914 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip()); |
| 3907 } | 3915 } |
| 3908 | 3916 |
| 3909 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const | 3917 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const |
| 3910 { | 3918 { |
| 3911 ASSERT(newStyle); | 3919 ASSERT(newStyle); |
| 3912 return !compositedLayerMapping() && oldStyle && (oldStyle->overflowX() != ne wStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->layer() ->hasCompositingDescendant(); | 3920 return compositingState() == NotComposited && oldStyle && (oldStyle->overflo wX() != newStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode( )->layer()->hasCompositingDescendant(); |
| 3913 } | 3921 } |
| 3914 | 3922 |
| 3915 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const | 3923 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const |
| 3916 { | 3924 { |
| 3917 if (!hasOrHadFilters(oldStyle, newStyle)) | 3925 if (!hasOrHadFilters(oldStyle, newStyle)) |
| 3918 return false; | 3926 return false; |
| 3919 | 3927 |
| 3920 if (renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer (), CSSPropertyWebkitFilter)) { | 3928 if (renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer (), CSSPropertyWebkitFilter)) { |
| 3921 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers. | 3929 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers. |
| 3922 // All of the layers above us should have been promoted to compositing l ayers already. | 3930 // All of the layers above us should have been promoted to compositing l ayers already. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3946 } | 3954 } |
| 3947 | 3955 |
| 3948 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) | 3956 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) |
| 3949 { | 3957 { |
| 3950 if (!hasOrHadFilters(oldStyle, newStyle)) | 3958 if (!hasOrHadFilters(oldStyle, newStyle)) |
| 3951 return; | 3959 return; |
| 3952 | 3960 |
| 3953 updateOrRemoveFilterClients(); | 3961 updateOrRemoveFilterClients(); |
| 3954 // During an accelerated animation, both WebKit and the compositor animate p roperties. | 3962 // During an accelerated animation, both WebKit and the compositor animate p roperties. |
| 3955 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. | 3963 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. |
| 3956 bool shouldUpdateFilters = compositedLayerMapping() && !renderer()->animatio n().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter) ; | 3964 bool shouldUpdateFilters = compositingState() == PaintsIntoOwnBacking && !re nderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPro pertyWebkitFilter); |
| 3957 if (shouldUpdateFilters) | 3965 if (shouldUpdateFilters) |
| 3958 compositedLayerMapping()->updateFilters(renderer()->style()); | 3966 compositedLayerMapping()->updateFilters(renderer()->style()); |
| 3959 updateOrRemoveFilterEffectRenderer(); | 3967 updateOrRemoveFilterEffectRenderer(); |
| 3960 } | 3968 } |
| 3961 | 3969 |
| 3962 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) | 3970 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
| 3963 { | 3971 { |
| 3964 m_stackingNode->updateIsNormalFlowOnly(); | 3972 m_stackingNode->updateIsNormalFlowOnly(); |
| 3965 | 3973 |
| 3966 if (m_scrollableArea) | 3974 if (m_scrollableArea) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3985 if (paintsWithFilters()) | 3993 if (paintsWithFilters()) |
| 3986 didPaintWithFilters = true; | 3994 didPaintWithFilters = true; |
| 3987 updateFilters(oldStyle, renderer()->style()); | 3995 updateFilters(oldStyle, renderer()->style()); |
| 3988 | 3996 |
| 3989 const RenderStyle* newStyle = renderer()->style(); | 3997 const RenderStyle* newStyle = renderer()->style(); |
| 3990 if (compositor()->updateLayerCompositingState(this) | 3998 if (compositor()->updateLayerCompositingState(this) |
| 3991 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 3999 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 3992 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 4000 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 3993 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) | 4001 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) |
| 3994 compositor()->setCompositingLayersNeedRebuild(); | 4002 compositor()->setCompositingLayersNeedRebuild(); |
| 3995 else if (compositedLayerMapping()) | 4003 else if (compositingState() == PaintsIntoOwnBacking) |
|
shawnsingh
2013/11/05 10:20:27
I'm pretty sure we would need HasOwnBackingButPain
| |
| 3996 compositedLayerMapping()->updateGraphicsLayerGeometry(); | 4004 compositedLayerMapping()->updateGraphicsLayerGeometry(); |
| 3997 } | 4005 } |
| 3998 | 4006 |
| 3999 bool RenderLayer::scrollsOverflow() const | 4007 bool RenderLayer::scrollsOverflow() const |
| 4000 { | 4008 { |
| 4001 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4009 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) |
| 4002 return scrollableArea->scrollsOverflow(); | 4010 return scrollableArea->scrollsOverflow(); |
| 4003 | 4011 |
| 4004 return false; | 4012 return false; |
| 4005 } | 4013 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4163 } | 4171 } |
| 4164 } | 4172 } |
| 4165 | 4173 |
| 4166 void showLayerTree(const WebCore::RenderObject* renderer) | 4174 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4167 { | 4175 { |
| 4168 if (!renderer) | 4176 if (!renderer) |
| 4169 return; | 4177 return; |
| 4170 showLayerTree(renderer->enclosingLayer()); | 4178 showLayerTree(renderer->enclosingLayer()); |
| 4171 } | 4179 } |
| 4172 #endif | 4180 #endif |
| OLD | NEW |