Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 88863002: Land layer squashing behind a flag (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed feedback Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
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
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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3990 4003
3991 if (paintsWithFilters()) 4004 if (paintsWithFilters())
3992 didPaintWithFilters = true; 4005 didPaintWithFilters = true;
3993 updateFilters(oldStyle, renderer()->style()); 4006 updateFilters(oldStyle, renderer()->style());
3994 4007
3995 const RenderStyle* newStyle = renderer()->style(); 4008 const RenderStyle* newStyle = renderer()->style();
3996 if (compositor()->updateLayerCompositingState(this) 4009 if (compositor()->updateLayerCompositingState(this)
3997 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 4010 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
3998 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 4011 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
3999 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters) 4012 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)
4000 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) 4013 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) {
4001 compositor()->setCompositingLayersNeedRebuild(); 4014 compositor()->setCompositingLayersNeedRebuild();
4002 else if (hasCompositedLayerMapping()) 4015 } else if (compositingState() == PaintsIntoOwnBacking || compositingState() == HasOwnBackingButPaintsIntoAncestor) {
4016 ASSERT(hasCompositedLayerMapping());
4003 compositedLayerMapping()->updateGraphicsLayerGeometry(); 4017 compositedLayerMapping()->updateGraphicsLayerGeometry();
4018 } else if (compositingState() == PaintsIntoGroupedBacking) {
4019 ASSERT(compositor()->isLayerSquashingEnabled());
4020 ASSERT(groupedMapping());
4021 // FIXME: double-check that updateGraphicsLayerGeometry is not necessary (well the squashing portion is what might be needed? but probably not)...
Ian Vollick 2013/12/07 02:44:42 I think we do want to update the geometry here. Th
shawnsingh 2013/12/11 18:50:34 (a) if the squashing layer is affected by m_graphi
4022 // FIXME: do we need to take any action here for a squashed layer?
4023 }
4004 } 4024 }
4005 4025
4006 bool RenderLayer::scrollsOverflow() const 4026 bool RenderLayer::scrollsOverflow() const
4007 { 4027 {
4008 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) 4028 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea())
4009 return scrollableArea->scrollsOverflow(); 4029 return scrollableArea->scrollsOverflow();
4010 4030
4011 return false; 4031 return false;
4012 } 4032 }
4013 4033
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 } 4190 }
4171 } 4191 }
4172 4192
4173 void showLayerTree(const WebCore::RenderObject* renderer) 4193 void showLayerTree(const WebCore::RenderObject* renderer)
4174 { 4194 {
4175 if (!renderer) 4195 if (!renderer)
4176 return; 4196 return;
4177 showLayerTree(renderer->enclosingLayer()); 4197 showLayerTree(renderer->enclosingLayer());
4178 } 4198 }
4179 #endif 4199 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698