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

Side by Side Diff: Source/core/svg/SVGGraphicsElement.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated change after Doug's review. Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGFEFloodElement.cpp ('k') | Source/core/svg/SVGLengthContext.cpp » ('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, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2014 Google, Inc. 4 * Copyright (C) 2014 Google, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return SVGMatrixTearOff::create(getCTM()); 125 return SVGMatrixTearOff::create(getCTM());
126 } 126 }
127 127
128 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJav ascript() 128 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJav ascript()
129 { 129 {
130 return SVGMatrixTearOff::create(getScreenCTM()); 130 return SVGMatrixTearOff::create(getScreenCTM());
131 } 131 }
132 132
133 bool SVGGraphicsElement::hasAnimatedLocalTransform() const 133 bool SVGGraphicsElement::hasAnimatedLocalTransform() const
134 { 134 {
135 LayoutStyle* style = renderer() ? renderer()->style() : 0; 135 const LayoutStyle* style = renderer() ? renderer()->style() : nullptr;
136 136
137 // Each of these is used in SVGGraphicsElement::calculateAnimatedLocalTransf orm to create an animated local transform. 137 // Each of these is used in SVGGraphicsElement::calculateAnimatedLocalTransf orm to create an animated local transform.
138 return (style && style->hasTransform()) || !m_transform->currentValue()->isE mpty() || hasSVGRareData(); 138 return (style && style->hasTransform()) || !m_transform->currentValue()->isE mpty() || hasSVGRareData();
139 } 139 }
140 140
141 AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const 141 AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const
142 { 142 {
143 AffineTransform matrix; 143 AffineTransform matrix;
144 LayoutStyle* style = renderer() ? renderer()->style() : 0; 144 const LayoutStyle* style = renderer() ? renderer()->style() : nullptr;
145 145
146 // If CSS property was set, use that, otherwise fallback to attribute (if se t). 146 // If CSS property was set, use that, otherwise fallback to attribute (if se t).
147 if (style && style->hasTransform()) { 147 if (style && style->hasTransform()) {
148 TransformationMatrix transform; 148 TransformationMatrix transform;
149 float zoom = style->effectiveZoom(); 149 float zoom = style->effectiveZoom();
150 150
151 // SVGTextElements need special handling for the text positioning code. 151 // SVGTextElements need special handling for the text positioning code.
152 if (isSVGTextElement(this)) { 152 if (isSVGTextElement(this)) {
153 // Do not take into account SVG's zoom rules, transform-origin, or p ercentage values. 153 // Do not take into account SVG's zoom rules, transform-origin, or p ercentage values.
154 style->applyTransform(transform, LayoutSize(0, 0), LayoutStyle::Excl udeTransformOrigin); 154 style->applyTransform(transform, LayoutSize(0, 0), LayoutStyle::Excl udeTransformOrigin);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return new LayoutSVGPath(this); 273 return new LayoutSVGPath(this);
274 } 274 }
275 275
276 void SVGGraphicsElement::toClipPath(Path& path) 276 void SVGGraphicsElement::toClipPath(Path& path)
277 { 277 {
278 updatePathFromGraphicsElement(this, path); 278 updatePathFromGraphicsElement(this, path);
279 path.transform(calculateAnimatedLocalTransform()); 279 path.transform(calculateAnimatedLocalTransform());
280 } 280 }
281 281
282 } 282 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEFloodElement.cpp ('k') | Source/core/svg/SVGLengthContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698