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

Unified Diff: Source/core/svg/SVGGraphicsElement.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/SVGGraphicsElement.h ('k') | Source/core/svg/SVGLinearGradientElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGGraphicsElement.cpp
diff --git a/Source/core/svg/SVGGraphicsElement.cpp b/Source/core/svg/SVGGraphicsElement.cpp
index 08e178a6969d1cfb0b55bb502638960209e31e5e..bd71b71796d39f608e7c0c2810ffe17dc0b07aa9 100644
--- a/Source/core/svg/SVGGraphicsElement.cpp
+++ b/Source/core/svg/SVGGraphicsElement.cpp
@@ -43,6 +43,21 @@ SVGGraphicsElement::~SVGGraphicsElement()
{
}
+bool SVGGraphicsElement::isPresentationAttribute(const QualifiedName& name) const
+{
+ if (name == SVGNames::transformAttr)
+ return true;
+ return SVGElement::isPresentationAttribute(name);
+}
+
+void SVGGraphicsElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
+{
+ if (name == SVGNames::transformAttr)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyTransform, value);
+ else
+ SVGElement::collectStyleForPresentationAttribute(name, value, style);
+}
+
PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getTransformToElement(SVGElement* target, ExceptionState& exceptionState)
{
AffineTransform ctm = getCTM(AllowStyleUpdate);
@@ -124,36 +139,9 @@ PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJavascript()
AffineTransform SVGGraphicsElement::animatedLocalTransform() const
{
AffineTransform matrix;
- RenderStyle* style = renderer() ? renderer()->style() : 0;
-
// If CSS property was set, use that, otherwise fallback to attribute (if set).
- if (style && style->hasTransform()) {
- TransformationMatrix transform;
- float zoom = style->effectiveZoom();
-
- // CSS transforms operate with pre-scaled lengths. To make this work with SVG
- // (which applies the zoom factor globally, at the root level) we
- //
- // * pre-scale the bounding box (to bring it into the same space as the other CSS values)
- // * invert the zoom factor (to effectively compute the CSS transform under a 1.0 zoom)
- //
- // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
- // See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
- if (zoom != 1) {
- FloatRect scaledBBox = renderer()->objectBoundingBox();
- scaledBBox.scale(zoom);
- transform.scale(1 / zoom);
- style->applyTransform(transform, scaledBBox);
- transform.scale(zoom);
- } else {
- style->applyTransform(transform, renderer()->objectBoundingBox());
- }
-
- // Flatten any 3D transform.
- matrix = transform.toAffineTransform();
- } else {
+ if (!getStyleTransform(matrix))
m_transform->currentValue()->concatenate(matrix);
- }
if (m_supplementalTransform)
return *m_supplementalTransform * matrix;
@@ -202,6 +190,8 @@ void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
return;
if (attrName == SVGNames::transformAttr) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange);
object->setNeedsTransformUpdate();
RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
return;
« no previous file with comments | « Source/core/svg/SVGGraphicsElement.h ('k') | Source/core/svg/SVGLinearGradientElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698