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

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

Issue 2846513002: More targeted resource-switching mechanism for SVG selection painting (Closed)
Patch Set: Use rALAP instead of first rAF 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 side-by-side diff with in-line comments
Download patch
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);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698