Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp |
| index b2a4e9c9823631c9a19ca61b6efccea001f6bba5..dc9cdff976402988c24be236fe841681199c2aaf 100644 |
| --- a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp |
| +++ b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp |
| @@ -186,4 +186,24 @@ void SVGResourcesCache::ClientDestroyed(LayoutObject* layout_object) { |
| cache.RemoveResourcesFromLayoutObject(layout_object); |
| } |
| +SVGResourcesCache::TemporaryStyleScope::TemporaryStyleScope( |
| + LayoutObject& layout_object, |
| + const ComputedStyle& style, |
| + const ComputedStyle& temporary_style) |
| + : layout_object_(layout_object), |
| + original_style_(style), |
| + styles_are_equal_(style == temporary_style) { |
| + SwitchTo(temporary_style); |
| +} |
| + |
| +void SVGResourcesCache::TemporaryStyleScope::SwitchTo( |
| + const ComputedStyle& style) { |
| + DCHECK(LayoutObjectCanHaveResources(&layout_object_)); |
| + if (styles_are_equal_) |
| + return; |
| + SVGResourcesCache& cache = ResourcesCache(layout_object_.GetDocument()); |
| + cache.RemoveResourcesFromLayoutObject(&layout_object_); |
| + cache.AddResourcesFromLayoutObject(&layout_object_, style); |
|
Stephen Chennney
2017/04/28 16:16:40
A non-trivial chunk of invalidation logic is gone
fs
2017/04/28 18:16:34
That is correct. Optimally we'd like to just produ
|
| +} |
| + |
| } // namespace blink |