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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 , m_blendMode(blink::WebBlendModeNormal) | 126 , m_blendMode(blink::WebBlendModeNormal) |
127 , m_renderer(renderer) | 127 , m_renderer(renderer) |
128 , m_parent(0) | 128 , m_parent(0) |
129 , m_previous(0) | 129 , m_previous(0) |
130 , m_next(0) | 130 , m_next(0) |
131 , m_first(0) | 131 , m_first(0) |
132 , m_last(0) | 132 , m_last(0) |
133 , m_staticInlinePosition(0) | 133 , m_staticInlinePosition(0) |
134 , m_staticBlockPosition(0) | 134 , m_staticBlockPosition(0) |
135 , m_enclosingPaginationLayer(0) | 135 , m_enclosingPaginationLayer(0) |
| 136 , m_groupedMapping(0) |
136 , m_repainter(renderer) | 137 , m_repainter(renderer) |
137 , m_clipper(renderer) | 138 , m_clipper(renderer) |
138 { | 139 { |
139 updateStackingNode(); | 140 updateStackingNode(); |
140 | 141 |
141 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 142 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
142 | 143 |
143 if (!renderer->firstChild() && renderer->style()) { | 144 if (!renderer->firstChild() && renderer->style()) { |
144 m_visibleContentStatusDirty = false; | 145 m_visibleContentStatusDirty = false; |
145 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; | 146 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 return curr; | 1103 return curr; |
1103 } | 1104 } |
1104 | 1105 |
1105 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1106 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) |
1106 { | 1107 { |
1107 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer-
>stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest
orStackingContainerNode()->layer() : 0); | 1108 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer-
>stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest
orStackingContainerNode()->layer() : 0); |
1108 } | 1109 } |
1109 | 1110 |
1110 // FIXME: having two different functions named enclosingCompositingLayer and enc
losingCompositingLayerForRepaint | 1111 // 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 | 1112 // 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 | 1113 // the includeSelf option. It is very likely that we don't even want either of t
hese functions; A layer |
1113 // enclosingCompositingLayerForRepaint(). | 1114 // should be told explicitly which GraphicsLayer is the repaintContainer for a R
enderLayer, and |
| 1115 // any other use cases should probably have an API between the non-compositing a
nd compositing sides of code. |
1114 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 1116 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const |
1115 { | 1117 { |
1116 if (includeSelf && hasCompositedLayerMapping()) | 1118 if (includeSelf && compositingState() != NotComposited && compositingState()
!= PaintsIntoGroupedBacking) |
1117 return const_cast<RenderLayer*>(this); | 1119 return const_cast<RenderLayer*>(this); |
1118 | 1120 |
1119 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1121 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { |
1120 if (curr->hasCompositedLayerMapping()) | 1122 if (curr->compositingState() != NotComposited && curr->compositingState(
) != PaintsIntoGroupedBacking) |
1121 return const_cast<RenderLayer*>(curr); | 1123 return const_cast<RenderLayer*>(curr); |
1122 } | 1124 } |
1123 | 1125 |
1124 return 0; | 1126 return 0; |
1125 } | 1127 } |
1126 | 1128 |
1127 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf)
const | 1129 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf)
const |
1128 { | 1130 { |
1129 if (includeSelf && compositingState() == PaintsIntoOwnBacking) | 1131 if (includeSelf && (compositingState() == PaintsIntoOwnBacking || compositin
gState() == PaintsIntoGroupedBacking)) |
1130 return const_cast<RenderLayer*>(this); | 1132 return const_cast<RenderLayer*>(this); |
1131 | 1133 |
1132 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1134 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { |
1133 if (curr->compositingState() == PaintsIntoOwnBacking) | 1135 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin
gState() == PaintsIntoGroupedBacking) |
1134 return const_cast<RenderLayer*>(curr); | 1136 return const_cast<RenderLayer*>(curr); |
1135 } | 1137 } |
1136 | 1138 |
1137 return 0; | 1139 return 0; |
1138 } | 1140 } |
1139 | 1141 |
1140 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const | 1142 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const |
1141 { | 1143 { |
1142 if (!acceleratedCompositingForOverflowScrollEnabled()) | 1144 if (!acceleratedCompositingForOverflowScrollEnabled()) |
1143 return 0; | 1145 return 0; |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 return false; | 1878 return false; |
1877 } | 1879 } |
1878 | 1880 |
1879 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag
s paintFlags) | 1881 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag
s paintFlags) |
1880 { | 1882 { |
1881 return layer->renderer()->isRoot() && (paintFlags & PaintLayerPaintingRootBa
ckgroundOnly); | 1883 return layer->renderer()->isRoot() && (paintFlags & PaintLayerPaintingRootBa
ckgroundOnly); |
1882 } | 1884 } |
1883 | 1885 |
1884 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 1886 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
1885 { | 1887 { |
1886 if (compositingState() != NotComposited) { | 1888 if (compositingState() != NotComposited && compositingState() != PaintsIntoG
roupedBacking) { |
1887 // The updatingControlTints() painting pass goes through compositing lay
ers, | 1889 // The updatingControlTints() painting pass goes through compositing lay
ers, |
1888 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. | 1890 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. |
1889 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) { | 1891 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) { |
1890 paintFlags |= PaintLayerTemporaryClipRects; | 1892 paintFlags |= PaintLayerTemporaryClipRects; |
1891 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor() | 1893 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor() |
1892 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction) | 1894 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction) |
1893 && !paintForFixedRootBackground(this, paintFlags)) { | 1895 && !paintForFixedRootBackground(this, paintFlags)) { |
1894 // If this RenderLayer should paint into its own backing, that will
be done via CompositedLayerMapping::paintIntoLayer(). | 1896 // If this RenderLayer should paint into its own backing, that will
be done via CompositedLayerMapping::paintIntoLayer(). |
1895 return; | 1897 return; |
1896 } | 1898 } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 if (!hasSelfPaintingLayerDescendant()) | 2219 if (!hasSelfPaintingLayerDescendant()) |
2218 return; | 2220 return; |
2219 | 2221 |
2220 #if !ASSERT_DISABLED | 2222 #if !ASSERT_DISABLED |
2221 LayerListMutationDetector mutationChecker(m_stackingNode.get()); | 2223 LayerListMutationDetector mutationChecker(m_stackingNode.get()); |
2222 #endif | 2224 #endif |
2223 | 2225 |
2224 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); | 2226 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); |
2225 while (RenderLayerStackingNode* child = iterator.next()) { | 2227 while (RenderLayerStackingNode* child = iterator.next()) { |
2226 RenderLayer* childLayer = child->layer(); | 2228 RenderLayer* childLayer = child->layer(); |
| 2229 |
| 2230 // Squashed RenderLayers should not paint into their ancestor. |
| 2231 if (childLayer->compositingState() == PaintsIntoGroupedBacking) |
| 2232 continue; |
| 2233 |
2227 if (!childLayer->isPaginated()) | 2234 if (!childLayer->isPaginated()) |
2228 childLayer->paintLayer(context, paintingInfo, paintFlags); | 2235 childLayer->paintLayer(context, paintingInfo, paintFlags); |
2229 else | 2236 else |
2230 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); | 2237 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); |
2231 } | 2238 } |
2232 } | 2239 } |
2233 | 2240 |
2234 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, | 2241 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, |
2235 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba
rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint
* offsetFromRoot, | 2242 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba
rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint
* offsetFromRoot, |
2236 const LayoutRect* layerBoundingBox) | 2243 const LayoutRect* layerBoundingBox) |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3628 unionBounds.moveBy(ancestorRelOffset); | 3635 unionBounds.moveBy(ancestorRelOffset); |
3629 | 3636 |
3630 return pixelSnappedIntRect(unionBounds); | 3637 return pixelSnappedIntRect(unionBounds); |
3631 } | 3638 } |
3632 | 3639 |
3633 CompositingState RenderLayer::compositingState() const | 3640 CompositingState RenderLayer::compositingState() const |
3634 { | 3641 { |
3635 // This is computed procedurally so there is no redundant state variable tha
t | 3642 // This is computed procedurally so there is no redundant state variable tha
t |
3636 // can get out of sync from the real actual compositing state. | 3643 // can get out of sync from the real actual compositing state. |
3637 | 3644 |
| 3645 if (m_groupedMapping) { |
| 3646 ASSERT(compositor()->isLayerSquashingEnabled()); |
| 3647 ASSERT(!m_compositedLayerMapping); |
| 3648 return PaintsIntoGroupedBacking; |
| 3649 } |
| 3650 |
3638 if (!m_compositedLayerMapping) | 3651 if (!m_compositedLayerMapping) |
3639 return NotComposited; | 3652 return NotComposited; |
3640 | 3653 |
3641 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit
edAncestor()) | 3654 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit
edAncestor()) |
3642 return HasOwnBackingButPaintsIntoAncestor; | 3655 return HasOwnBackingButPaintsIntoAncestor; |
3643 | 3656 |
3644 ASSERT(m_compositedLayerMapping); | 3657 ASSERT(m_compositedLayerMapping); |
3645 return PaintsIntoOwnBacking; | 3658 return PaintsIntoOwnBacking; |
3646 } | 3659 } |
3647 | 3660 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 | 3999 |
3987 if (paintsWithFilters()) | 4000 if (paintsWithFilters()) |
3988 didPaintWithFilters = true; | 4001 didPaintWithFilters = true; |
3989 updateFilters(oldStyle, renderer()->style()); | 4002 updateFilters(oldStyle, renderer()->style()); |
3990 | 4003 |
3991 const RenderStyle* newStyle = renderer()->style(); | 4004 const RenderStyle* newStyle = renderer()->style(); |
3992 if (compositor()->updateLayerCompositingState(this) | 4005 if (compositor()->updateLayerCompositingState(this) |
3993 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 4006 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
3994 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 4007 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
3995 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW
ithFilters) | 4008 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW
ithFilters) |
3996 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) | 4009 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) { |
3997 compositor()->setCompositingLayersNeedRebuild(); | 4010 compositor()->setCompositingLayersNeedRebuild(); |
3998 else if (hasCompositedLayerMapping()) | 4011 } else if (compositingState() == PaintsIntoOwnBacking || compositingState()
== HasOwnBackingButPaintsIntoAncestor) { |
| 4012 ASSERT(hasCompositedLayerMapping()); |
3999 compositedLayerMapping()->updateGraphicsLayerGeometry(); | 4013 compositedLayerMapping()->updateGraphicsLayerGeometry(); |
| 4014 } else if (compositingState() == PaintsIntoGroupedBacking) { |
| 4015 ASSERT(compositor()->isLayerSquashingEnabled()); |
| 4016 ASSERT(groupedMapping()); |
| 4017 // updateGraphicsLayerGeometry() is called to update the squashingLayer
in case its size/position has changed. |
| 4018 // FIXME: Make sure to create a layout test that covers this scenario. |
| 4019 // FIXME: It is not expected that any other layers on the compositedLaye
rMapping would change. we should |
| 4020 // be able to just update the squashing layer only and save a lot of com
putation. |
| 4021 groupedMapping()->updateGraphicsLayerGeometry(); |
| 4022 } |
4000 } | 4023 } |
4001 | 4024 |
4002 bool RenderLayer::scrollsOverflow() const | 4025 bool RenderLayer::scrollsOverflow() const |
4003 { | 4026 { |
4004 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4027 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) |
4005 return scrollableArea->scrollsOverflow(); | 4028 return scrollableArea->scrollsOverflow(); |
4006 | 4029 |
4007 return false; | 4030 return false; |
4008 } | 4031 } |
4009 | 4032 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4165 } | 4188 } |
4166 } | 4189 } |
4167 | 4190 |
4168 void showLayerTree(const WebCore::RenderObject* renderer) | 4191 void showLayerTree(const WebCore::RenderObject* renderer) |
4169 { | 4192 { |
4170 if (!renderer) | 4193 if (!renderer) |
4171 return; | 4194 return; |
4172 showLayerTree(renderer->enclosingLayer()); | 4195 showLayerTree(renderer->enclosingLayer()); |
4173 } | 4196 } |
4174 #endif | 4197 #endif |
OLD | NEW |