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

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

Issue 2478233002: Make 'transform' a presentation attribute on SVG elements (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
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..db648a0f9038152344a71f16a01335177ecb1562 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 ||
@@ -160,10 +181,9 @@ static void setPatternAttributes(const SVGPatternElement* element,
element->patternContentUnits()->currentValue()->enumValue());
if (!attributes.hasPatternTransform() &&
- element->patternTransform()->isSpecified()) {
- AffineTransform transform;
- element->patternTransform()->currentValue()->concatenate(transform);
- attributes.setPatternTransform(transform);
+ element->hasTransform(SVGElement::ExcludeMotionTransform)) {
+ attributes.setPatternTransform(
+ element->calculateTransform(SVGElement::ExcludeMotionTransform));
}
if (!attributes.hasPatternContentElement() &&
@@ -198,9 +218,7 @@ void SVGPatternElement::collectPatternAttributes(
AffineTransform SVGPatternElement::localCoordinateSpaceTransform(
SVGElement::CTMScope) const {
- AffineTransform matrix;
- m_patternTransform->currentValue()->concatenate(matrix);
- return matrix;
+ return calculateTransform(SVGElement::ExcludeMotionTransform);
}
bool SVGPatternElement::selfHasRelativeLengths() const {

Powered by Google App Engine
This is Rietveld 408576698