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

Side by Side Diff: Source/WebCore/rendering/svg/SVGResourcesCache.cpp

Issue 10540037: Merge 118608 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 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/WebCore/rendering/svg/SVGResourcesCache.h ('k') | Source/WebCore/svg/SVGStyledElement.h » ('j') | 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) 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 // Invalidate the resources if either the RenderObject itself changed, 122 // Invalidate the resources if either the RenderObject itself changed,
123 // or we have filter resources, which could depend on the layout of children . 123 // or we have filter resources, which could depend on the layout of children .
124 if (object->selfNeedsLayout()) 124 if (object->selfNeedsLayout())
125 resources->removeClientFromCache(object); 125 resources->removeClientFromCache(object);
126 } 126 }
127 127
128 void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifferen ce diff, const RenderStyle* newStyle) 128 void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifferen ce diff, const RenderStyle* newStyle)
129 { 129 {
130 ASSERT(renderer); 130 ASSERT(renderer);
131 if (diff == StyleDifferenceEqual) 131 if (diff == StyleDifferenceEqual || !renderer->parent())
132 return; 132 return;
133 133
134 // In this case the proper SVGFE*Element will decide whether the modified CS S properties require a relayout or repaint. 134 // In this case the proper SVGFE*Element will decide whether the modified CS S properties require a relayout or repaint.
135 if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepai nt) 135 if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepai nt)
136 return; 136 return;
137 137
138 clientUpdatedFromElement(renderer, newStyle); 138 // Dynamic changes of CSS properties like 'clip-path' may require us to reco mpute the associated resources for a renderer.
139 } 139 // FIXME: Avoid passing in a useless StyleDifference, but instead compare ol dStyle/newStyle to see which resources changed
140 140 // to be able to selectively rebuild individual resources, instead of all of them.
141 void SVGResourcesCache::clientUpdatedFromElement(RenderObject* renderer, const R enderStyle* newStyle)
142 {
143 ASSERT(renderer);
144 ASSERT(renderer->parent());
145
146 SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer); 141 SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
147 cache->removeResourcesFromRenderObject(renderer); 142 cache->removeResourcesFromRenderObject(renderer);
148 cache->addResourcesFromRenderObject(renderer, newStyle); 143 cache->addResourcesFromRenderObject(renderer, newStyle);
149 144
150 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, fals e); 145 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, fals e);
151 } 146 }
152 147
148 static inline bool rendererCanHaveResources(RenderObject* renderer)
149 {
150 ASSERT(renderer);
151 ASSERT(renderer->parent());
152 return renderer->node() && !renderer->isSVGInlineText();
153 }
154
155 void SVGResourcesCache::clientWasAddedToTree(RenderObject* renderer, const Rende rStyle* newStyle)
156 {
157 if (!rendererCanHaveResources(renderer))
158 return;
159 SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
160 cache->addResourcesFromRenderObject(renderer, newStyle);
161 }
162
163 void SVGResourcesCache::clientWillBeRemovedFromTree(RenderObject* renderer)
164 {
165 if (!rendererCanHaveResources(renderer))
166 return;
167 SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
168 cache->removeResourcesFromRenderObject(renderer);
169
170 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, fals e);
171 }
172
153 void SVGResourcesCache::clientDestroyed(RenderObject* renderer) 173 void SVGResourcesCache::clientDestroyed(RenderObject* renderer)
154 { 174 {
155 ASSERT(renderer); 175 ASSERT(renderer);
156 176
157 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( renderer); 177 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( renderer);
158 if (resources) 178 if (resources)
159 resources->removeClientFromCache(renderer); 179 resources->removeClientFromCache(renderer);
160 180
161 SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer); 181 SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
162 cache->removeResourcesFromRenderObject(renderer); 182 cache->removeResourcesFromRenderObject(renderer);
(...skipping 16 matching lines...) Expand all
179 SVGStyledElement* clientElement = toSVGStyledElement(it->first->node()); 199 SVGStyledElement* clientElement = toSVGStyledElement(it->first->node());
180 SVGDocumentExtensions* extensions = clientElement->document()->accessSVG Extensions(); 200 SVGDocumentExtensions* extensions = clientElement->document()->accessSVG Extensions();
181 201
182 extensions->addPendingResource(resourceElement->fastGetAttribute(HTMLNam es::idAttr), clientElement); 202 extensions->addPendingResource(resourceElement->fastGetAttribute(HTMLNam es::idAttr), clientElement);
183 } 203 }
184 } 204 }
185 205
186 } 206 }
187 207
188 #endif 208 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/svg/SVGResourcesCache.h ('k') | Source/WebCore/svg/SVGStyledElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698