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

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

Issue 2400783002: Reformat comments in core/layout/svg (Closed)
Patch Set: Created 4 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 for (auto* resourceContainer : resourceSet) 59 for (auto* resourceContainer : resourceSet)
60 resourceContainer->addClient(object); 60 resourceContainer->addClient(object);
61 } 61 }
62 62
63 void SVGResourcesCache::removeResourcesFromLayoutObject(LayoutObject* object) { 63 void SVGResourcesCache::removeResourcesFromLayoutObject(LayoutObject* object) {
64 std::unique_ptr<SVGResources> resources = m_cache.take(object); 64 std::unique_ptr<SVGResources> resources = m_cache.take(object);
65 if (!resources) 65 if (!resources)
66 return; 66 return;
67 67
68 // Walk resources and unregister the layout object as a client of each resourc e. 68 // Walk resources and unregister the layout object as a client of each
69 // resource.
69 HashSet<LayoutSVGResourceContainer*> resourceSet; 70 HashSet<LayoutSVGResourceContainer*> resourceSet;
70 resources->buildSetOfResources(resourceSet); 71 resources->buildSetOfResources(resourceSet);
71 72
72 for (auto* resourceContainer : resourceSet) 73 for (auto* resourceContainer : resourceSet)
73 resourceContainer->removeClient(object); 74 resourceContainer->removeClient(object);
74 } 75 }
75 76
76 static inline SVGResourcesCache& resourcesCache(Document& document) { 77 static inline SVGResourcesCache& resourcesCache(Document& document) {
77 return document.accessSVGExtensions().resourcesCache(); 78 return document.accessSVGExtensions().resourcesCache();
78 } 79 }
(...skipping 24 matching lines...) Expand all
103 void SVGResourcesCache::clientStyleChanged(LayoutObject* layoutObject, 104 void SVGResourcesCache::clientStyleChanged(LayoutObject* layoutObject,
104 StyleDifference diff, 105 StyleDifference diff,
105 const ComputedStyle& newStyle) { 106 const ComputedStyle& newStyle) {
106 ASSERT(layoutObject); 107 ASSERT(layoutObject);
107 ASSERT(layoutObject->node()); 108 ASSERT(layoutObject->node());
108 ASSERT(layoutObject->node()->isSVGElement()); 109 ASSERT(layoutObject->node()->isSVGElement());
109 110
110 if (!diff.hasDifference() || !layoutObject->parent()) 111 if (!diff.hasDifference() || !layoutObject->parent())
111 return; 112 return;
112 113
113 // In this case the proper SVGFE*Element will decide whether the modified CSS properties require 114 // In this case the proper SVGFE*Element will decide whether the modified CSS
115 // properties require
114 // a relayout or paintInvalidation. 116 // a relayout or paintInvalidation.
115 if (layoutObject->isSVGResourceFilterPrimitive() && !diff.needsLayout()) 117 if (layoutObject->isSVGResourceFilterPrimitive() && !diff.needsLayout())
116 return; 118 return;
117 119
118 // Dynamic changes of CSS properties like 'clip-path' may require us to recomp ute the associated 120 // Dynamic changes of CSS properties like 'clip-path' may require us to
119 // resources for a LayoutObject. 121 // recompute the associated resources for a LayoutObject.
120 // TODO(fs): Avoid passing in a useless StyleDifference, but instead compare o ldStyle/newStyle 122 // TODO(fs): Avoid passing in a useless StyleDifference, but instead compare
121 // to see which resources changed to be able to selectively rebuild individual resources, 123 // oldStyle/newStyle to see which resources changed to be able to selectively
122 // instead of all of them. 124 // rebuild individual resources, instead of all of them.
123 if (layoutObjectCanHaveResources(layoutObject)) { 125 if (layoutObjectCanHaveResources(layoutObject)) {
124 SVGResourcesCache& cache = resourcesCache(layoutObject->document()); 126 SVGResourcesCache& cache = resourcesCache(layoutObject->document());
125 cache.removeResourcesFromLayoutObject(layoutObject); 127 cache.removeResourcesFromLayoutObject(layoutObject);
126 cache.addResourcesFromLayoutObject(layoutObject, newStyle); 128 cache.addResourcesFromLayoutObject(layoutObject, newStyle);
127 } 129 }
128 130
129 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation( 131 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(
130 layoutObject, false); 132 layoutObject, false);
131 } 133 }
132 134
(...skipping 27 matching lines...) Expand all
160 ASSERT(layoutObject); 162 ASSERT(layoutObject);
161 163
162 SVGResources* resources = cachedResourcesForLayoutObject(layoutObject); 164 SVGResources* resources = cachedResourcesForLayoutObject(layoutObject);
163 if (resources) 165 if (resources)
164 resources->removeClientFromCache(layoutObject); 166 resources->removeClientFromCache(layoutObject);
165 SVGResourcesCache& cache = resourcesCache(layoutObject->document()); 167 SVGResourcesCache& cache = resourcesCache(layoutObject->document());
166 cache.removeResourcesFromLayoutObject(layoutObject); 168 cache.removeResourcesFromLayoutObject(layoutObject);
167 } 169 }
168 170
169 } // namespace blink 171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698