Chromium Code Reviews| Index: Source/core/svg/SVGPatternElement.cpp |
| diff --git a/Source/core/svg/SVGPatternElement.cpp b/Source/core/svg/SVGPatternElement.cpp |
| index f8cb010227b0fdbc4c012a0a1567ca7d7941c935..cce1bad7ac5d2c317f9d91171fc0a9b9ee3fdd1b 100644 |
| --- a/Source/core/svg/SVGPatternElement.cpp |
| +++ b/Source/core/svg/SVGPatternElement.cpp |
| @@ -57,6 +57,21 @@ inline SVGPatternElement::SVGPatternElement(Document& document) |
| DEFINE_NODE_FACTORY(SVGPatternElement) |
| +bool SVGPatternElement::isPresentationAttribute(const QualifiedName& name) const |
| +{ |
| + if (name == SVGNames::patternTransformAttr) |
| + return true; |
| + return SVGElement::isPresentationAttribute(name); |
| +} |
| + |
| +void SVGPatternElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style) |
| +{ |
| + if (name == SVGNames::patternTransformAttr) |
| + addPropertyToPresentationAttributeStyle(style, CSSPropertyTransform, value); |
| + else |
| + SVGElement::collectStyleForPresentationAttribute(name, value, style); |
| +} |
| + |
| bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) |
| { |
| DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| @@ -112,6 +127,11 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) |
| return; |
| } |
| + if (attrName == SVGNames::patternTransformAttr) { |
| + invalidateSVGPresentationAttributeStyle(); |
| + setNeedsStyleRecalc(LocalStyleChange); |
|
pdr.
2014/08/04 16:11:17
Could a pattern's children depend on the transform
|
| + } |
| + |
| SVGElement::InvalidationGuard invalidationGuard(this); |
| if (attrName == SVGNames::xAttr |
| @@ -167,10 +187,18 @@ static void setPatternAttributes(const SVGPatternElement* element, PatternAttrib |
| if (!attributes.hasPatternContentUnits() && element->patternContentUnits()->isSpecified()) |
| attributes.setPatternContentUnits(element->patternContentUnits()->currentValue()->enumValue()); |
| - if (!attributes.hasPatternTransform() && element->patternTransform()->isSpecified()) { |
| + if (!attributes.hasPatternTransform()) { |
| AffineTransform transform; |
| - element->patternTransform()->currentValue()->concatenate(transform); |
| - attributes.setPatternTransform(transform); |
| + bool hasTransform = element->getStyleTransform(transform); |
| + |
| + // If CSS property was set, use that, otherwise fallback to attribute (if set). |
| + if (!hasTransform && element->patternTransform()->isSpecified()) { |
| + element->patternTransform()->currentValue()->concatenate(transform); |
| + hasTransform = true; |
| + } |
| + |
| + if (hasTransform) |
| + attributes.setPatternTransform(transform); |
| } |
| if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin(*element)) |