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

Unified Diff: Source/core/rendering/svg/RenderSVGResourcePattern.cpp

Issue 677683003: [SVG] Reinstate RenderSVGResourcePattern's inval-during-paint guard. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: minor cleanup Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGResourcePattern.cpp
diff --git a/Source/core/rendering/svg/RenderSVGResourcePattern.cpp b/Source/core/rendering/svg/RenderSVGResourcePattern.cpp
index fa31c0cae1e0a3c2acdbbaa528a5e97b9ed914c5..6bae6c3f2644eccab23783c27c8fac772cb40d8c 100644
--- a/Source/core/rendering/svg/RenderSVGResourcePattern.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourcePattern.cpp
@@ -62,14 +62,15 @@ void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
PatternData* RenderSVGResourcePattern::patternForRenderer(const RenderObject& object)
{
- auto addResult = m_patternMap.add(&object, nullptr);
- OwnPtr<PatternData>& patternData = addResult.storedValue->value;
+ ASSERT(!m_shouldCollectPatternAttributes);
- if (addResult.isNewEntry)
- patternData = buildPatternData(object);
+ // FIXME: the double hash lookup is needed to guard against paint-time invalidation
+ // (painting animated images may trigger layout invals which delete our map entry).
+ // Hopefully that will be addressed at some point, and then we can optimize the lookup.
+ if (PatternData* currentData = m_patternMap.get(&object))
+ return currentData;
- ASSERT(!m_shouldCollectPatternAttributes);
- return patternData.get();
+ return m_patternMap.set(&object, buildPatternData(object)).storedValue->value.get();
}
PassOwnPtr<PatternData> RenderSVGResourcePattern::buildPatternData(const RenderObject& object)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698