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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 , m_blendMode(blink::WebBlendModeNormal) | 127 , m_blendMode(blink::WebBlendModeNormal) |
| 128 , m_renderer(renderer) | 128 , m_renderer(renderer) |
| 129 , m_parent(0) | 129 , m_parent(0) |
| 130 , m_previous(0) | 130 , m_previous(0) |
| 131 , m_next(0) | 131 , m_next(0) |
| 132 , m_first(0) | 132 , m_first(0) |
| 133 , m_last(0) | 133 , m_last(0) |
| 134 , m_staticInlinePosition(0) | 134 , m_staticInlinePosition(0) |
| 135 , m_staticBlockPosition(0) | 135 , m_staticBlockPosition(0) |
| 136 , m_enclosingPaginationLayer(0) | 136 , m_enclosingPaginationLayer(0) |
| 137 , m_groupedMapping(0) | |
| 137 , m_repainter(renderer) | 138 , m_repainter(renderer) |
| 138 , m_clipper(renderer) | 139 , m_clipper(renderer) |
| 139 { | 140 { |
| 140 updateStackingNode(); | 141 updateStackingNode(); |
| 141 | 142 |
| 142 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 143 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
| 143 | 144 |
| 144 if (!renderer->firstChild() && renderer->style()) { | 145 if (!renderer->firstChild() && renderer->style()) { |
| 145 m_visibleContentStatusDirty = false; | 146 m_visibleContentStatusDirty = false; |
| 146 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; | 147 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 return curr; | 1104 return curr; |
| 1104 } | 1105 } |
| 1105 | 1106 |
| 1106 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1107 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) |
| 1107 { | 1108 { |
| 1108 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); | 1109 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); |
| 1109 } | 1110 } |
| 1110 | 1111 |
| 1111 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint | 1112 // 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 | 1113 // 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 some call sites of this functi on actually mean to use | 1114 // the includeSelf option. It is very likely that we don't even want either of t hese functions; A layer |
| 1114 // enclosingCompositingLayerForRepaint(). | 1115 // should be told explicitly which GraphicsLayer is the repaintContainer for a R enderLayer, and |
| 1116 // any other use cases should probably have an API between the non-compositing a nd compositing sides of code. | |
| 1115 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 1117 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const |
| 1116 { | 1118 { |
| 1117 if (includeSelf && hasCompositedLayerMapping()) | 1119 if (includeSelf && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking) |
| 1118 return const_cast<RenderLayer*>(this); | 1120 return const_cast<RenderLayer*>(this); |
| 1119 | 1121 |
| 1120 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { | 1122 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { |
| 1121 if (curr->hasCompositedLayerMapping()) | 1123 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking) |
| 1122 return const_cast<RenderLayer*>(curr); | 1124 return const_cast<RenderLayer*>(curr); |
| 1123 } | 1125 } |
| 1124 | 1126 |
| 1125 return 0; | 1127 return 0; |
| 1126 } | 1128 } |
| 1127 | 1129 |
| 1128 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const | 1130 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const |
| 1129 { | 1131 { |
| 1130 if (includeSelf && compositingState() == PaintsIntoOwnBacking) | 1132 if (includeSelf && (compositingState() == PaintsIntoOwnBacking || compositin gState() == PaintsIntoGroupedBacking)) |
| 1131 return const_cast<RenderLayer*>(this); | 1133 return const_cast<RenderLayer*>(this); |
| 1132 | 1134 |
| 1133 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { | 1135 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { |
| 1134 if (curr->compositingState() == PaintsIntoOwnBacking) | 1136 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin gState() == PaintsIntoGroupedBacking) |
| 1135 return const_cast<RenderLayer*>(curr); | 1137 return const_cast<RenderLayer*>(curr); |
| 1136 } | 1138 } |
| 1137 | 1139 |
| 1138 return 0; | 1140 return 0; |
| 1139 } | 1141 } |
| 1140 | 1142 |
| 1141 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const | 1143 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const |
| 1142 { | 1144 { |
| 1143 if (!acceleratedCompositingForOverflowScrollEnabled()) | 1145 if (!acceleratedCompositingForOverflowScrollEnabled()) |
| 1144 return 0; | 1146 return 0; |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1877 return false; | 1879 return false; |
| 1878 } | 1880 } |
| 1879 | 1881 |
| 1880 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag s paintFlags) | 1882 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag s paintFlags) |
| 1881 { | 1883 { |
| 1882 return layer->renderer()->isRoot() && (paintFlags & PaintLayerPaintingRootBa ckgroundOnly); | 1884 return layer->renderer()->isRoot() && (paintFlags & PaintLayerPaintingRootBa ckgroundOnly); |
| 1883 } | 1885 } |
| 1884 | 1886 |
| 1885 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 1887 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 1886 { | 1888 { |
| 1887 if (compositingState() != NotComposited) { | 1889 if (compositingState() != NotComposited && compositingState() != PaintsIntoG roupedBacking) { |
| 1888 // The updatingControlTints() painting pass goes through compositing lay ers, | 1890 // The updatingControlTints() painting pass goes through compositing lay ers, |
| 1889 // but we need to ensure that we don't cache clip rects computed with th e wrong root in this case. | 1891 // but we need to ensure that we don't cache clip rects computed with th e wrong root in this case. |
| 1890 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai ntBehaviorFlattenCompositingLayers)) { | 1892 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai ntBehaviorFlattenCompositingLayers)) { |
| 1891 paintFlags |= PaintLayerTemporaryClipRects; | 1893 paintFlags |= PaintLayerTemporaryClipRects; |
| 1892 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor() | 1894 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor() |
| 1893 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle ction) | 1895 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle ction) |
| 1894 && !paintForFixedRootBackground(this, paintFlags)) { | 1896 && !paintForFixedRootBackground(this, paintFlags)) { |
| 1895 // If this RenderLayer should paint into its own backing, that will be done via CompositedLayerMapping::paintIntoLayer(). | 1897 // If this RenderLayer should paint into its own backing, that will be done via CompositedLayerMapping::paintIntoLayer(). |
| 1896 return; | 1898 return; |
| 1897 } | 1899 } |
| (...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3629 unionBounds.moveBy(ancestorRelOffset); | 3631 unionBounds.moveBy(ancestorRelOffset); |
| 3630 | 3632 |
| 3631 return pixelSnappedIntRect(unionBounds); | 3633 return pixelSnappedIntRect(unionBounds); |
| 3632 } | 3634 } |
| 3633 | 3635 |
| 3634 CompositingState RenderLayer::compositingState() const | 3636 CompositingState RenderLayer::compositingState() const |
| 3635 { | 3637 { |
| 3636 // This is computed procedurally so there is no redundant state variable tha t | 3638 // This is computed procedurally so there is no redundant state variable tha t |
| 3637 // can get out of sync from the real actual compositing state. | 3639 // can get out of sync from the real actual compositing state. |
| 3638 | 3640 |
| 3641 if (m_groupedMapping) { | |
| 3642 ASSERT(compositor()->isLayerSquashingEnabled()); | |
| 3643 ASSERT(!m_compositedLayerMapping); | |
| 3644 return PaintsIntoGroupedBacking; | |
| 3645 } | |
| 3646 | |
| 3639 if (!m_compositedLayerMapping) | 3647 if (!m_compositedLayerMapping) |
| 3640 return NotComposited; | 3648 return NotComposited; |
| 3641 | 3649 |
| 3642 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) | 3650 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) |
| 3643 return HasOwnBackingButPaintsIntoAncestor; | 3651 return HasOwnBackingButPaintsIntoAncestor; |
| 3644 | 3652 |
| 3645 ASSERT(m_compositedLayerMapping); | 3653 ASSERT(m_compositedLayerMapping); |
| 3646 return PaintsIntoOwnBacking; | 3654 return PaintsIntoOwnBacking; |
| 3647 } | 3655 } |
| 3648 | 3656 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3980 bool didPaintWithFilters = false; | 3988 bool didPaintWithFilters = false; |
| 3981 | 3989 |
| 3982 if (paintsWithFilters()) | 3990 if (paintsWithFilters()) |
| 3983 didPaintWithFilters = true; | 3991 didPaintWithFilters = true; |
| 3984 updateFilters(oldStyle, renderer()->style()); | 3992 updateFilters(oldStyle, renderer()->style()); |
| 3985 | 3993 |
| 3986 const RenderStyle* newStyle = renderer()->style(); | 3994 const RenderStyle* newStyle = renderer()->style(); |
| 3987 if (compositor()->updateLayerCompositingState(this) | 3995 if (compositor()->updateLayerCompositingState(this) |
| 3988 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 3996 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 3989 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 3997 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 3990 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) | 3998 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) { |
| 3991 compositor()->setCompositingLayersNeedRebuild(); | 3999 compositor()->setCompositingLayersNeedRebuild(); |
| 3992 else if (hasCompositedLayerMapping()) | 4000 } else if (compositingState() == PaintsIntoOwnBacking || compositingState() == HasOwnBackingButPaintsIntoAncestor) { |
| 4001 ASSERT(hasCompositedLayerMapping()); | |
| 3993 compositedLayerMapping()->updateGraphicsLayerGeometry(); | 4002 compositedLayerMapping()->updateGraphicsLayerGeometry(); |
| 4003 } else if (compositingState() == PaintsIntoGroupedBacking) { | |
| 4004 ASSERT(compositor()->isLayerSquashingEnabled()); | |
| 4005 ASSERT(groupedMapping()); | |
| 4006 // FIXME: double-check that updateGraphicsLayerGeometry is not necessary (well the squashing portion is what might be needed? but probably not)... | |
|
Ian Vollick
2013/12/02 21:17:05
Hmm. It'd be handy if we had up-to-date geometry f
| |
| 4007 // FIXME: do we need to take any action here for a squashed layer? | |
| 4008 } | |
| 3994 } | 4009 } |
| 3995 | 4010 |
| 3996 bool RenderLayer::scrollsOverflow() const | 4011 bool RenderLayer::scrollsOverflow() const |
| 3997 { | 4012 { |
| 3998 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4013 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) |
| 3999 return scrollableArea->scrollsOverflow(); | 4014 return scrollableArea->scrollsOverflow(); |
| 4000 | 4015 |
| 4001 return false; | 4016 return false; |
| 4002 } | 4017 } |
| 4003 | 4018 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4160 } | 4175 } |
| 4161 } | 4176 } |
| 4162 | 4177 |
| 4163 void showLayerTree(const WebCore::RenderObject* renderer) | 4178 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4164 { | 4179 { |
| 4165 if (!renderer) | 4180 if (!renderer) |
| 4166 return; | 4181 return; |
| 4167 showLayerTree(renderer->enclosingLayer()); | 4182 showLayerTree(renderer->enclosingLayer()); |
| 4168 } | 4183 } |
| 4169 #endif | 4184 #endif |
| OLD | NEW |