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

Side by Side Diff: Source/core/svg/SVGElement.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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGGradientElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 #endif 1184 #endif
1185 Element::trace(visitor); 1185 Element::trace(visitor);
1186 } 1186 }
1187 1187
1188 const AtomicString& SVGElement::eventParameterName() 1188 const AtomicString& SVGElement::eventParameterName()
1189 { 1189 {
1190 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1190 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1191 return evtString; 1191 return evtString;
1192 } 1192 }
1193 1193
1194 bool SVGElement::getStyleTransform(AffineTransform& matrix) const
1195 {
1196 RenderStyle* style = renderer() ? renderer()->style() : 0;
1197 if (style && style->hasTransform()) {
1198 TransformationMatrix transform;
1199 float zoom = style->effectiveZoom();
1200
1201 // CSS transforms operate with pre-scaled lengths. To make this work wit h SVG
1202 // (which applies the zoom factor globally, at the root level) we
1203 //
1204 // * pre-scale the bounding box (to bring it into the same space as th e other CSS values)
1205 // * invert the zoom factor (to effectively compute the CSS transform under a 1.0 zoom)
1206 //
1207 // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
1208 // See the "Object bounding box units" section of http://dev.w3.org/cssw g/css3-transforms/
1209 if (zoom != 1) {
1210 FloatRect scaledBBox = renderer()->objectBoundingBox();
1211 scaledBBox.scale(zoom);
1212 transform.scale(1 / zoom);
1213 style->applyTransform(transform, scaledBBox);
1214 transform.scale(zoom);
1215 } else {
1216 style->applyTransform(transform, renderer()->objectBoundingBox());
1217 }
1218
1219 // Flatten any 3D transform.
1220 matrix = transform.toAffineTransform();
1221 return true;
1222 }
1223 return false;
1194 } 1224 }
1225
1226 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGGradientElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698