| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 if (!hasSelfPaintingLayerDescendant()) | 2220 if (!hasSelfPaintingLayerDescendant()) |
| 2219 return; | 2221 return; |
| 2220 | 2222 |
| 2221 #if !ASSERT_DISABLED | 2223 #if !ASSERT_DISABLED |
| 2222 LayerListMutationDetector mutationChecker(m_stackingNode.get()); | 2224 LayerListMutationDetector mutationChecker(m_stackingNode.get()); |
| 2223 #endif | 2225 #endif |
| 2224 | 2226 |
| 2225 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); | 2227 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); |
| 2226 while (RenderLayerStackingNode* child = iterator.next()) { | 2228 while (RenderLayerStackingNode* child = iterator.next()) { |
| 2227 RenderLayer* childLayer = child->layer(); | 2229 RenderLayer* childLayer = child->layer(); |
| 2230 |
| 2231 // Squashed RenderLayers should not paint into their ancestor. |
| 2232 if (childLayer->compositingState() == PaintsIntoGroupedBacking) |
| 2233 continue; |
| 2234 |
| 2228 if (!childLayer->isPaginated()) | 2235 if (!childLayer->isPaginated()) |
| 2229 childLayer->paintLayer(context, paintingInfo, paintFlags); | 2236 childLayer->paintLayer(context, paintingInfo, paintFlags); |
| 2230 else | 2237 else |
| 2231 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); | 2238 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); |
| 2232 } | 2239 } |
| 2233 } | 2240 } |
| 2234 | 2241 |
| 2235 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, | 2242 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, |
| 2236 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba
rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint
* offsetFromRoot, | 2243 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba
rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint
* offsetFromRoot, |
| 2237 const LayoutRect* layerBoundingBox) | 2244 const LayoutRect* layerBoundingBox) |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 unionBounds.moveBy(ancestorRelOffset); | 3636 unionBounds.moveBy(ancestorRelOffset); |
| 3630 | 3637 |
| 3631 return pixelSnappedIntRect(unionBounds); | 3638 return pixelSnappedIntRect(unionBounds); |
| 3632 } | 3639 } |
| 3633 | 3640 |
| 3634 CompositingState RenderLayer::compositingState() const | 3641 CompositingState RenderLayer::compositingState() const |
| 3635 { | 3642 { |
| 3636 // This is computed procedurally so there is no redundant state variable tha
t | 3643 // 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. | 3644 // can get out of sync from the real actual compositing state. |
| 3638 | 3645 |
| 3646 if (m_groupedMapping) { |
| 3647 ASSERT(compositor()->isLayerSquashingEnabled()); |
| 3648 ASSERT(!m_compositedLayerMapping); |
| 3649 return PaintsIntoGroupedBacking; |
| 3650 } |
| 3651 |
| 3639 if (!m_compositedLayerMapping) | 3652 if (!m_compositedLayerMapping) |
| 3640 return NotComposited; | 3653 return NotComposited; |
| 3641 | 3654 |
| 3642 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit
edAncestor()) | 3655 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit
edAncestor()) |
| 3643 return HasOwnBackingButPaintsIntoAncestor; | 3656 return HasOwnBackingButPaintsIntoAncestor; |
| 3644 | 3657 |
| 3645 ASSERT(m_compositedLayerMapping); | 3658 ASSERT(m_compositedLayerMapping); |
| 3646 return PaintsIntoOwnBacking; | 3659 return PaintsIntoOwnBacking; |
| 3647 } | 3660 } |
| 3648 | 3661 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 | 4000 |
| 3988 if (paintsWithFilters()) | 4001 if (paintsWithFilters()) |
| 3989 didPaintWithFilters = true; | 4002 didPaintWithFilters = true; |
| 3990 updateFilters(oldStyle, renderer()->style()); | 4003 updateFilters(oldStyle, renderer()->style()); |
| 3991 | 4004 |
| 3992 const RenderStyle* newStyle = renderer()->style(); | 4005 const RenderStyle* newStyle = renderer()->style(); |
| 3993 if (compositor()->updateLayerCompositingState(this) | 4006 if (compositor()->updateLayerCompositingState(this) |
| 3994 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 4007 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 3995 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 4008 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 3996 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW
ithFilters) | 4009 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW
ithFilters) |
| 3997 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) | 4010 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) { |
| 3998 compositor()->setCompositingLayersNeedRebuild(); | 4011 compositor()->setCompositingLayersNeedRebuild(); |
| 3999 else if (hasCompositedLayerMapping()) | 4012 } else if (compositingState() == PaintsIntoOwnBacking || compositingState()
== HasOwnBackingButPaintsIntoAncestor) { |
| 4013 ASSERT(hasCompositedLayerMapping()); |
| 4000 compositedLayerMapping()->updateGraphicsLayerGeometry(); | 4014 compositedLayerMapping()->updateGraphicsLayerGeometry(); |
| 4015 } else if (compositingState() == PaintsIntoGroupedBacking) { |
| 4016 ASSERT(compositor()->isLayerSquashingEnabled()); |
| 4017 ASSERT(groupedMapping()); |
| 4018 // FIXME: double-check that updateGraphicsLayerGeometry is not necessary
(well the squashing portion is what might be needed? but probably not)... |
| 4019 // FIXME: do we need to take any action here for a squashed layer? |
| 4020 } |
| 4001 } | 4021 } |
| 4002 | 4022 |
| 4003 bool RenderLayer::scrollsOverflow() const | 4023 bool RenderLayer::scrollsOverflow() const |
| 4004 { | 4024 { |
| 4005 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4025 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) |
| 4006 return scrollableArea->scrollsOverflow(); | 4026 return scrollableArea->scrollsOverflow(); |
| 4007 | 4027 |
| 4008 return false; | 4028 return false; |
| 4009 } | 4029 } |
| 4010 | 4030 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4167 } | 4187 } |
| 4168 } | 4188 } |
| 4169 | 4189 |
| 4170 void showLayerTree(const WebCore::RenderObject* renderer) | 4190 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4171 { | 4191 { |
| 4172 if (!renderer) | 4192 if (!renderer) |
| 4173 return; | 4193 return; |
| 4174 showLayerTree(renderer->enclosingLayer()); | 4194 showLayerTree(renderer->enclosingLayer()); |
| 4175 } | 4195 } |
| 4176 #endif | 4196 #endif |
| OLD | NEW |