OLD | NEW |
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 float SVGLengthContext::valueForLength(const Length& length, const ComputedStyle
& style, float dimension) | 171 float SVGLengthContext::valueForLength(const Length& length, const ComputedStyle
& style, float dimension) |
172 { | 172 { |
173 return valueForLength(length, style.effectiveZoom(), dimension); | 173 return valueForLength(length, style.effectiveZoom(), dimension); |
174 } | 174 } |
175 | 175 |
176 float SVGLengthContext::valueForLength(const Length& length, float zoom, float d
imension) | 176 float SVGLengthContext::valueForLength(const Length& length, float zoom, float d
imension) |
177 { | 177 { |
178 ASSERT(zoom != 0); | 178 ASSERT(zoom != 0); |
| 179 // isIntrinsic can occur for 'width' and 'height', but has no |
| 180 // real meaning for svg. |
| 181 if (length.isIntrinsic()) |
| 182 return 0; |
179 return floatValueForLength(length, dimension * zoom) / zoom; | 183 return floatValueForLength(length, dimension * zoom) / zoom; |
180 } | 184 } |
181 | 185 |
182 float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode,
SVGLengthType fromUnit) const | 186 float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode,
SVGLengthType fromUnit) const |
183 { | 187 { |
184 float userUnits = value; | 188 float userUnits = value; |
185 switch (fromUnit) { | 189 switch (fromUnit) { |
186 case LengthTypeUnknown: | 190 case LengthTypeUnknown: |
187 return 0; | 191 return 0; |
188 case LengthTypePX: | 192 case LengthTypePX: |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 345 |
342 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); | 346 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); |
343 viewportSize = svg.currentViewBoxRect().size(); | 347 viewportSize = svg.currentViewBoxRect().size(); |
344 if (viewportSize.isEmpty()) | 348 if (viewportSize.isEmpty()) |
345 viewportSize = svg.currentViewportSize(); | 349 viewportSize = svg.currentViewportSize(); |
346 | 350 |
347 return true; | 351 return true; |
348 } | 352 } |
349 | 353 |
350 } | 354 } |
OLD | NEW |