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

Unified Diff: third_party/WebKit/Source/core/svg/SVGGradientElement.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/SVGGradientElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp b/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
index 58b505dc23b81cf0843aa0818d870ad754db84f0..a2954ad778eea2ebc41b11f91036ba7804f049c4 100644
--- a/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
@@ -23,6 +23,7 @@
#include "core/dom/Attribute.h"
#include "core/dom/ElementTraversal.h"
+#include "core/dom/StyleChangeReason.h"
#include "core/layout/svg/LayoutSVGResourceContainer.h"
#include "core/svg/SVGStopElement.h"
#include "core/svg/SVGTransformList.h"
@@ -47,7 +48,8 @@ SVGGradientElement::SVGGradientElement(const QualifiedName& tagName,
SVGURIReference(this),
m_gradientTransform(
SVGAnimatedTransformList::create(this,
- SVGNames::gradientTransformAttr)),
+ SVGNames::gradientTransformAttr,
+ CSSPropertyTransform)),
m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(
this,
SVGNames::spreadMethodAttr,
@@ -69,7 +71,26 @@ DEFINE_TRACE(SVGGradientElement) {
SVGURIReference::trace(visitor);
}
+void SVGGradientElement::collectStyleForPresentationAttribute(
+ const QualifiedName& name,
+ const AtomicString& value,
+ MutableStylePropertySet* style) {
+ if (name == SVGNames::gradientTransformAttr) {
+ addPropertyToPresentationAttributeStyle(
+ style, CSSPropertyTransform,
+ m_gradientTransform->currentValue()->cssValue());
+ return;
+ }
+ SVGElement::collectStyleForPresentationAttribute(name, value, style);
+}
+
void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) {
+ if (attrName == SVGNames::gradientTransformAttr) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ }
+
if (attrName == SVGNames::gradientUnitsAttr ||
attrName == SVGNames::gradientTransformAttr ||
attrName == SVGNames::spreadMethodAttr ||
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGGradientElement.h ('k') | third_party/WebKit/Source/core/svg/SVGGraphicsElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698