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

Unified Diff: Source/core/svg/SVGPatternElement.cpp

Issue 423093014: [SVG2] Make transform, gradientTransform and patternTransform presentation attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline for mac/win Created 6 years, 4 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/svg/SVGPatternElement.h ('k') | Source/core/svg/SVGRadialGradientElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
+
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))
« no previous file with comments | « Source/core/svg/SVGPatternElement.h ('k') | Source/core/svg/SVGRadialGradientElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698