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

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

Issue 27246003: Replace check for RenderLayer in RenderLayerModelObject::ensureLayer with ASSERT due to redundant c… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed! Created 7 years, 2 months 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
« no previous file with comments | « Source/core/rendering/RenderLayerModelObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. 7 * Copyright (C) 2010, 2012 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 void RenderLayerModelObject::destroyLayer() 54 void RenderLayerModelObject::destroyLayer()
55 { 55 {
56 ASSERT(!hasLayer()); // Callers should have already called setHasLayer(false ) 56 ASSERT(!hasLayer()); // Callers should have already called setHasLayer(false )
57 ASSERT(m_layer); 57 ASSERT(m_layer);
58 delete m_layer; 58 delete m_layer;
59 m_layer = 0; 59 m_layer = 0;
60 } 60 }
61 61
62 void RenderLayerModelObject::ensureLayer() 62 void RenderLayerModelObject::createLayer()
63 { 63 {
64 if (m_layer) 64 ASSERT(!m_layer);
65 return;
66
67 m_layer = new RenderLayer(this); 65 m_layer = new RenderLayer(this);
68 setHasLayer(true); 66 setHasLayer(true);
69 m_layer->insertOnlyThisLayer(); 67 m_layer->insertOnlyThisLayer();
70 } 68 }
71 69
72 bool RenderLayerModelObject::hasSelfPaintingLayer() const 70 bool RenderLayerModelObject::hasSelfPaintingLayer() const
73 { 71 {
74 return m_layer && m_layer->isSelfPaintingLayer(); 72 return m_layer && m_layer->isSelfPaintingLayer();
75 } 73 }
76 74
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 143
146 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt yle* oldStyle) 144 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt yle* oldStyle)
147 { 145 {
148 RenderObject::styleDidChange(diff, oldStyle); 146 RenderObject::styleDidChange(diff, oldStyle);
149 updateFromStyle(); 147 updateFromStyle();
150 148
151 if (requiresLayer()) { 149 if (requiresLayer()) {
152 if (!layer() && layerCreationAllowedForSubtree()) { 150 if (!layer() && layerCreationAllowedForSubtree()) {
153 if (s_wasFloating && isFloating()) 151 if (s_wasFloating && isFloating())
154 setChildNeedsLayout(); 152 setChildNeedsLayout();
155 ensureLayer(); 153 createLayer();
156 if (parent() && !needsLayout() && containingBlock()) { 154 if (parent() && !needsLayout() && containingBlock()) {
157 layer()->repainter().setRepaintStatus(NeedsFullRepaint); 155 layer()->repainter().setRepaintStatus(NeedsFullRepaint);
158 // There is only one layer to update, it is not worth using |cac hedOffset| since 156 // There is only one layer to update, it is not worth using |cac hedOffset| since
159 // we are not sure the value will be used. 157 // we are not sure the value will be used.
160 layer()->updateLayerPositions(0); 158 layer()->updateLayerPositions(0);
161 } 159 }
162 } 160 }
163 } else if (layer() && layer()->parent()) { 161 } else if (layer() && layer()->parent()) {
164 setHasTransform(false); // Either a transform wasn't specified or the ob ject doesn't support transforms, so just null out the bit. 162 setHasTransform(false); // Either a transform wasn't specified or the ob ject doesn't support transforms, so just null out the bit.
165 setHasReflection(false); 163 setHasReflection(false);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 204 }
207 } 205 }
208 206
209 CompositedLayerMapping* RenderLayerModelObject::compositedLayerMapping() const 207 CompositedLayerMapping* RenderLayerModelObject::compositedLayerMapping() const
210 { 208 {
211 return m_layer ? m_layer->compositedLayerMapping() : 0; 209 return m_layer ? m_layer->compositedLayerMapping() : 0;
212 } 210 }
213 211
214 } // namespace WebCore 212 } // namespace WebCore
215 213
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerModelObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698