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

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

Issue 579243004: Prevent reading stale/invalid data when applying a <pattern> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/core/rendering/svg/RenderSVGResourcePattern.h ('k') | 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 3ff46b05434d6403bd50f8d5dd7a24a55ab7bbc8..2848697de5528acd530140a0d6647a21bd5e5393 100644
--- a/Source/core/rendering/svg/RenderSVGResourcePattern.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourcePattern.cpp
@@ -52,25 +52,13 @@ void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
markClientForInvalidation(client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation);
}
-PatternData* RenderSVGResourcePattern::buildPattern(RenderObject* object, unsigned short resourceMode)
+PatternData* RenderSVGResourcePattern::buildPattern(RenderObject* object, const SVGPatternElement* patternElement)
{
ASSERT(object);
PatternData* currentData = m_patternMap.get(object);
if (currentData && currentData->pattern)
return currentData;
- SVGPatternElement* patternElement = toSVGPatternElement(element());
- if (!patternElement)
- return 0;
-
- if (m_shouldCollectPatternAttributes) {
- patternElement->synchronizeAnimatedSVGAttribute(anyQName());
-
- m_attributes = PatternAttributes();
- patternElement->collectPatternAttributes(m_attributes);
- m_shouldCollectPatternAttributes = false;
- }
-
// If we couldn't determine the pattern content element root, stop here.
if (!m_attributes.patternContentElement())
return 0;
@@ -133,13 +121,25 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
clearInvalidationMask();
+ SVGPatternElement* patternElement = toSVGPatternElement(element());
+ if (!patternElement)
+ return false;
+
+ if (m_shouldCollectPatternAttributes) {
+ patternElement->synchronizeAnimatedSVGAttribute(anyQName());
+
+ m_attributes = PatternAttributes();
+ patternElement->collectPatternAttributes(m_attributes);
+ m_shouldCollectPatternAttributes = false;
+ }
+
// Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
// then the given effect (e.g. a gradient or a filter) will be ignored.
FloatRect objectBoundingBox = object->objectBoundingBox();
if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty())
return false;
- PatternData* patternData = buildPattern(object, resourceMode);
+ PatternData* patternData = buildPattern(object, patternElement);
if (!patternData)
return false;
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourcePattern.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698