Index: third_party/WebKit/Source/core/svg/SVGPatternElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp b/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp |
index 216ddcff46746d5cbf185618e9a6e35f4738ce1b..f180a61d8096743a964be533dfaa3c496fa83844 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp |
@@ -23,6 +23,7 @@ |
#include "core/svg/SVGPatternElement.h" |
#include "core/dom/ElementTraversal.h" |
+#include "core/dom/StyleChangeReason.h" |
#include "core/layout/svg/LayoutSVGResourcePattern.h" |
#include "core/svg/PatternAttributes.h" |
#include "platform/transforms/AffineTransform.h" |
@@ -50,7 +51,8 @@ inline SVGPatternElement::SVGPatternElement(Document& document) |
SVGLength::create(SVGLengthMode::Height))), |
m_patternTransform( |
SVGAnimatedTransformList::create(this, |
- SVGNames::patternTransformAttr)), |
+ SVGNames::patternTransformAttr, |
+ CSSPropertyTransform)), |
m_patternUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( |
this, |
SVGNames::patternUnitsAttr, |
@@ -85,11 +87,30 @@ DEFINE_TRACE(SVGPatternElement) { |
DEFINE_NODE_FACTORY(SVGPatternElement) |
+void SVGPatternElement::collectStyleForPresentationAttribute( |
+ const QualifiedName& name, |
+ const AtomicString& value, |
+ MutableStylePropertySet* style) { |
+ if (name == SVGNames::patternTransformAttr) { |
+ addPropertyToPresentationAttributeStyle( |
+ style, CSSPropertyTransform, |
+ m_patternTransform->currentValue()->cssValue()); |
+ return; |
+ } |
+ SVGElement::collectStyleForPresentationAttribute(name, value, style); |
+} |
+ |
void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) { |
bool isLengthAttr = |
attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || |
attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr; |
+ if (attrName == SVGNames::patternTransformAttr) { |
+ invalidateSVGPresentationAttributeStyle(); |
+ setNeedsStyleRecalc(LocalStyleChange, |
+ StyleChangeReasonForTracing::fromAttribute(attrName)); |
+ } |
+ |
if (isLengthAttr || attrName == SVGNames::patternUnitsAttr || |
attrName == SVGNames::patternContentUnitsAttr || |
attrName == SVGNames::patternTransformAttr || |
@@ -159,12 +180,8 @@ static void setPatternAttributes(const SVGPatternElement* element, |
attributes.setPatternContentUnits( |
element->patternContentUnits()->currentValue()->enumValue()); |
- if (!attributes.hasPatternTransform() && |
- element->patternTransform()->isSpecified()) { |
- AffineTransform transform; |
- element->patternTransform()->currentValue()->concatenate(transform); |
- attributes.setPatternTransform(transform); |
- } |
+ if (!attributes.hasPatternTransform() && element->hasTransform()) |
+ attributes.setPatternTransform(element->calculateTransform()); |
if (!attributes.hasPatternContentElement() && |
ElementTraversal::firstWithin(*element)) |
@@ -198,9 +215,7 @@ void SVGPatternElement::collectPatternAttributes( |
AffineTransform SVGPatternElement::localCoordinateSpaceTransform( |
SVGElement::CTMScope) const { |
- AffineTransform matrix; |
- m_patternTransform->currentValue()->concatenate(matrix); |
- return matrix; |
+ return calculateTransform(); |
} |
bool SVGPatternElement::selfHasRelativeLengths() const { |