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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp

Issue 2748103015: Replace ASSERT with DCHECK in core/layout/<sub dirs> (Closed)
Patch Set: Rebase with latest Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 28 matching lines...) Expand all
39 m_invalidationMask(0), 39 m_invalidationMask(0),
40 m_registered(false), 40 m_registered(false),
41 m_isInvalidating(false) {} 41 m_isInvalidating(false) {}
42 42
43 LayoutSVGResourceContainer::~LayoutSVGResourceContainer() {} 43 LayoutSVGResourceContainer::~LayoutSVGResourceContainer() {}
44 44
45 void LayoutSVGResourceContainer::layout() { 45 void LayoutSVGResourceContainer::layout() {
46 // FIXME: Investigate a way to detect and break resource layout dependency 46 // FIXME: Investigate a way to detect and break resource layout dependency
47 // cycles early. Then we can remove this method altogether, and fall back onto 47 // cycles early. Then we can remove this method altogether, and fall back onto
48 // LayoutSVGHiddenContainer::layout(). 48 // LayoutSVGHiddenContainer::layout().
49 ASSERT(needsLayout()); 49 DCHECK(needsLayout());
50 if (m_isInLayout) 50 if (m_isInLayout)
51 return; 51 return;
52 52
53 AutoReset<bool> inLayoutChange(&m_isInLayout, true); 53 AutoReset<bool> inLayoutChange(&m_isInLayout, true);
54 54
55 LayoutSVGHiddenContainer::layout(); 55 LayoutSVGHiddenContainer::layout();
56 56
57 clearInvalidationMask(); 57 clearInvalidationMask();
58 } 58 }
59 59
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 // Invalidate clients registered via an SVGElementProxy. 140 // Invalidate clients registered via an SVGElementProxy.
141 notifyContentChanged(); 141 notifyContentChanged();
142 142
143 m_isInvalidating = false; 143 m_isInvalidating = false;
144 } 144 }
145 145
146 void LayoutSVGResourceContainer::markClientForInvalidation( 146 void LayoutSVGResourceContainer::markClientForInvalidation(
147 LayoutObject* client, 147 LayoutObject* client,
148 InvalidationMode mode) { 148 InvalidationMode mode) {
149 ASSERT(client); 149 DCHECK(client);
150 ASSERT(!m_clients.isEmpty()); 150 DCHECK(!m_clients.isEmpty());
151 151
152 switch (mode) { 152 switch (mode) {
153 case LayoutAndBoundariesInvalidation: 153 case LayoutAndBoundariesInvalidation:
154 case BoundariesInvalidation: 154 case BoundariesInvalidation:
155 client->setNeedsBoundariesUpdate(); 155 client->setNeedsBoundariesUpdate();
156 break; 156 break;
157 case PaintInvalidation: 157 case PaintInvalidation:
158 // Since LayoutSVGInlineTexts don't have SVGResources (they use their 158 // Since LayoutSVGInlineTexts don't have SVGResources (they use their
159 // parent's), they will not be notified of changes to paint servers. So 159 // parent's), they will not be notified of changes to paint servers. So
160 // if the client is one that could have a LayoutSVGInlineText use a 160 // if the client is one that could have a LayoutSVGInlineText use a
161 // paint invalidation reason that will force paint invalidation of the 161 // paint invalidation reason that will force paint invalidation of the
162 // entire <text>/<tspan>/... subtree. 162 // entire <text>/<tspan>/... subtree.
163 client->setShouldDoFullPaintInvalidation( 163 client->setShouldDoFullPaintInvalidation(
164 PaintInvalidationSVGResourceChange); 164 PaintInvalidationSVGResourceChange);
165 // Invalidate paint properties to update effects if any. 165 // Invalidate paint properties to update effects if any.
166 client->setNeedsPaintPropertyUpdate(); 166 client->setNeedsPaintPropertyUpdate();
167 break; 167 break;
168 case ParentOnlyInvalidation: 168 case ParentOnlyInvalidation:
169 break; 169 break;
170 } 170 }
171 } 171 }
172 172
173 void LayoutSVGResourceContainer::addClient(LayoutObject* client) { 173 void LayoutSVGResourceContainer::addClient(LayoutObject* client) {
174 ASSERT(client); 174 DCHECK(client);
175 m_clients.insert(client); 175 m_clients.insert(client);
176 clearInvalidationMask(); 176 clearInvalidationMask();
177 } 177 }
178 178
179 void LayoutSVGResourceContainer::removeClient(LayoutObject* client) { 179 void LayoutSVGResourceContainer::removeClient(LayoutObject* client) {
180 ASSERT(client); 180 DCHECK(client);
181 removeClientFromCache(client, false); 181 removeClientFromCache(client, false);
182 m_clients.erase(client); 182 m_clients.erase(client);
183 } 183 }
184 184
185 void LayoutSVGResourceContainer::invalidateCacheAndMarkForLayout( 185 void LayoutSVGResourceContainer::invalidateCacheAndMarkForLayout(
186 SubtreeLayoutScope* layoutScope) { 186 SubtreeLayoutScope* layoutScope) {
187 if (selfNeedsLayout()) 187 if (selfNeedsLayout())
188 return; 188 return;
189 189
190 setNeedsLayoutAndFullPaintInvalidation( 190 setNeedsLayoutAndFullPaintInvalidation(
191 LayoutInvalidationReason::SvgResourceInvalidated, MarkContainerChain, 191 LayoutInvalidationReason::SvgResourceInvalidated, MarkContainerChain,
192 layoutScope); 192 layoutScope);
193 193
194 if (everHadLayout()) 194 if (everHadLayout())
195 removeAllClientsFromCache(); 195 removeAllClientsFromCache();
196 } 196 }
197 197
198 static inline void removeFromCacheAndInvalidateDependencies( 198 static inline void removeFromCacheAndInvalidateDependencies(
199 LayoutObject* object, 199 LayoutObject* object,
200 bool needsLayout) { 200 bool needsLayout) {
201 ASSERT(object); 201 DCHECK(object);
202 if (SVGResources* resources = 202 if (SVGResources* resources =
203 SVGResourcesCache::cachedResourcesForLayoutObject(object)) { 203 SVGResourcesCache::cachedResourcesForLayoutObject(object)) {
204 resources->removeClientFromCacheAffectingObjectBounds(object); 204 resources->removeClientFromCacheAffectingObjectBounds(object);
205 } 205 }
206 206
207 if (!object->node() || !object->node()->isSVGElement()) 207 if (!object->node() || !object->node()->isSVGElement())
208 return; 208 return;
209 209
210 SVGElementSet* dependencies = 210 SVGElementSet* dependencies =
211 toSVGElement(object->node())->setOfIncomingReferences(); 211 toSVGElement(object->node())->setOfIncomingReferences();
(...skipping 18 matching lines...) Expand all
230 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation( 230 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(
231 layoutObject, needsLayout); 231 layoutObject, needsLayout);
232 invalidatingDependencies.erase(element); 232 invalidatingDependencies.erase(element);
233 } 233 }
234 } 234 }
235 } 235 }
236 236
237 void LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation( 237 void LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(
238 LayoutObject* object, 238 LayoutObject* object,
239 bool needsLayout) { 239 bool needsLayout) {
240 ASSERT(object); 240 DCHECK(object);
241 ASSERT(object->node()); 241 DCHECK(object->node());
242 242
243 if (needsLayout && !object->documentBeingDestroyed()) 243 if (needsLayout && !object->documentBeingDestroyed())
244 object->setNeedsLayoutAndFullPaintInvalidation( 244 object->setNeedsLayoutAndFullPaintInvalidation(
245 LayoutInvalidationReason::SvgResourceInvalidated); 245 LayoutInvalidationReason::SvgResourceInvalidated);
246 246
247 removeFromCacheAndInvalidateDependencies(object, needsLayout); 247 removeFromCacheAndInvalidateDependencies(object, needsLayout);
248 248
249 // Invalidate resources in ancestor chain, if needed. 249 // Invalidate resources in ancestor chain, if needed.
250 LayoutObject* current = object->parent(); 250 LayoutObject* current = object->parent();
251 while (current) { 251 while (current) {
252 removeFromCacheAndInvalidateDependencies(current, needsLayout); 252 removeFromCacheAndInvalidateDependencies(current, needsLayout);
253 253
254 if (current->isSVGResourceContainer()) { 254 if (current->isSVGResourceContainer()) {
255 // This will process the rest of the ancestors. 255 // This will process the rest of the ancestors.
256 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache(); 256 toLayoutSVGResourceContainer(current)->removeAllClientsFromCache();
257 break; 257 break;
258 } 258 }
259 259
260 current = current->parent(); 260 current = current->parent();
261 } 261 }
262 } 262 }
263 263
264 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698