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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGLengthContext.cpp

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return 0; 153 return 0;
154 } 154 }
155 155
156 SVGLengthContext::SVGLengthContext(const SVGElement* context) 156 SVGLengthContext::SVGLengthContext(const SVGElement* context)
157 : m_context(context) 157 : m_context(context)
158 { 158 {
159 } 159 }
160 160
161 FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitT ypes::SVGUnitType type, const FloatRect& viewport, const SVGLength& x, const SVG Length& y, const SVGLength& width, const SVGLength& height) 161 FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitT ypes::SVGUnitType type, const FloatRect& viewport, const SVGLength& x, const SVG Length& y, const SVGLength& width, const SVGLength& height)
162 { 162 {
163 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); 163 DCHECK_NE(SVGUnitTypes::kSvgUnitTypeUnknown, type);
164 if (type != SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { 164 if (type != SVGUnitTypes::kSvgUnitTypeUserspaceonuse) {
165 const FloatSize& viewportSize = viewport.size(); 165 const FloatSize& viewportSize = viewport.size();
166 return FloatRect( 166 return FloatRect(
167 convertValueFromPercentageToUserUnits(x, viewportSize) + viewport.x( ), 167 convertValueFromPercentageToUserUnits(x, viewportSize) + viewport.x( ),
168 convertValueFromPercentageToUserUnits(y, viewportSize) + viewport.y( ), 168 convertValueFromPercentageToUserUnits(y, viewportSize) + viewport.y( ),
169 convertValueFromPercentageToUserUnits(width, viewportSize), 169 convertValueFromPercentageToUserUnits(width, viewportSize),
170 convertValueFromPercentageToUserUnits(height, viewportSize)); 170 convertValueFromPercentageToUserUnits(height, viewportSize));
171 } 171 }
172 172
173 SVGLengthContext lengthContext(context); 173 SVGLengthContext lengthContext(context);
174 return FloatRect(x.value(lengthContext), y.value(lengthContext), width.value (lengthContext), height.value(lengthContext)); 174 return FloatRect(x.value(lengthContext), y.value(lengthContext), width.value (lengthContext), height.value(lengthContext));
175 } 175 }
176 176
177 FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitType s::SVGUnitType type, const SVGLength& x, const SVGLength& y) 177 FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitType s::SVGUnitType type, const SVGLength& x, const SVGLength& y)
178 { 178 {
179 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); 179 DCHECK_NE(SVGUnitTypes::kSvgUnitTypeUnknown, type);
180 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { 180 if (type == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) {
181 SVGLengthContext lengthContext(context); 181 SVGLengthContext lengthContext(context);
182 return FloatPoint(x.value(lengthContext), y.value(lengthContext)); 182 return FloatPoint(x.value(lengthContext), y.value(lengthContext));
183 } 183 }
184 184
185 // FIXME: valueAsPercentage() won't be correct for eg. cm units. They need t o be resolved in user space and then be considered in objectBoundingBox space. 185 // FIXME: valueAsPercentage() won't be correct for eg. cm units. They need t o be resolved in user space and then be considered in objectBoundingBox space.
186 return FloatPoint(x.valueAsPercentage(), y.valueAsPercentage()); 186 return FloatPoint(x.valueAsPercentage(), y.valueAsPercentage());
187 } 187 }
188 188
189 float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S VGUnitType type, const SVGLength& x) 189 float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S VGUnitType type, const SVGLength& x)
190 { 190 {
191 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); 191 DCHECK_NE(SVGUnitTypes::kSvgUnitTypeUnknown, type);
192 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { 192 if (type == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) {
193 SVGLengthContext lengthContext(context); 193 SVGLengthContext lengthContext(context);
194 return x.value(lengthContext); 194 return x.value(lengthContext);
195 } 195 }
196 196
197 // FIXME: valueAsPercentage() won't be correct for eg. cm units. They need t o be resolved in user space and then be considered in objectBoundingBox space. 197 // FIXME: valueAsPercentage() won't be correct for eg. cm units. They need t o be resolved in user space and then be considered in objectBoundingBox space.
198 return x.valueAsPercentage(); 198 return x.valueAsPercentage();
199 } 199 }
200 200
201 float SVGLengthContext::valueForLength(const UnzoomedLength& unzoomedLength, SVG LengthMode mode) const 201 float SVGLengthContext::valueForLength(const UnzoomedLength& unzoomedLength, SVG LengthMode mode) const
202 { 202 {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 const ComputedStyle* rootStyle = rootElementStyle(m_context); 427 const ComputedStyle* rootStyle = rootElementStyle(m_context);
428 if (!rootStyle) 428 if (!rootStyle)
429 return 0; 429 return 0;
430 430
431 CSSToLengthConversionData conversionData = CSSToLengthConversionData(style, rootStyle, m_context->document().layoutViewItem(), 1.0f); 431 CSSToLengthConversionData conversionData = CSSToLengthConversionData(style, rootStyle, m_context->document().layoutViewItem(), 1.0f);
432 Length length = primitiveValue.convertToLength(conversionData); 432 Length length = primitiveValue.convertToLength(conversionData);
433 return valueForLength(length, 1.0f, mode); 433 return valueForLength(length, 1.0f, mode);
434 } 434 }
435 } // namespace blink 435 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGGradientElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGLengthTearOff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698