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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/svg/SVGResourcesCache.cpp
===================================================================
--- Source/WebCore/rendering/svg/SVGResourcesCache.cpp (revision 119626)
+++ Source/WebCore/rendering/svg/SVGResourcesCache.cpp (working copy)
@@ -128,25 +128,45 @@
void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifference diff, const RenderStyle* newStyle)
{
ASSERT(renderer);
- if (diff == StyleDifferenceEqual)
+ if (diff == StyleDifferenceEqual || !renderer->parent())
return;
// In this case the proper SVGFE*Element will decide whether the modified CSS properties require a relayout or repaint.
if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepaint)
return;
- clientUpdatedFromElement(renderer, newStyle);
+ // Dynamic changes of CSS properties like 'clip-path' may require us to recompute the associated resources for a renderer.
+ // FIXME: Avoid passing in a useless StyleDifference, but instead compare oldStyle/newStyle to see which resources changed
+ // to be able to selectively rebuild individual resources, instead of all of them.
+ SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
+ cache->removeResourcesFromRenderObject(renderer);
+ cache->addResourcesFromRenderObject(renderer, newStyle);
+
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false);
}
-void SVGResourcesCache::clientUpdatedFromElement(RenderObject* renderer, const RenderStyle* newStyle)
+static inline bool rendererCanHaveResources(RenderObject* renderer)
{
ASSERT(renderer);
ASSERT(renderer->parent());
+ return renderer->node() && !renderer->isSVGInlineText();
+}
+void SVGResourcesCache::clientWasAddedToTree(RenderObject* renderer, const RenderStyle* newStyle)
+{
+ if (!rendererCanHaveResources(renderer))
+ return;
SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
- cache->removeResourcesFromRenderObject(renderer);
cache->addResourcesFromRenderObject(renderer, newStyle);
+}
+void SVGResourcesCache::clientWillBeRemovedFromTree(RenderObject* renderer)
+{
+ if (!rendererCanHaveResources(renderer))
+ return;
+ SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
+ cache->removeResourcesFromRenderObject(renderer);
+
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false);
}
« 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