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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 SVGLengthContext::SVGLengthContext(const SVGElement* context) | 104 SVGLengthContext::SVGLengthContext(const SVGElement* context) |
105 : m_context(context) | 105 : m_context(context) |
106 { | 106 { |
107 } | 107 } |
108 | 108 |
109 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) | 109 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) |
110 { | 110 { |
111 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); | 111 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); |
112 if (type != SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE && !viewport.isEmpty(
)) { | 112 if (type != SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { |
113 const FloatSize& viewportSize = viewport.size(); | 113 const FloatSize& viewportSize = viewport.size(); |
114 return FloatRect( | 114 return FloatRect( |
115 convertValueFromPercentageToUserUnits(x, viewportSize) + viewport.x(
), | 115 convertValueFromPercentageToUserUnits(x, viewportSize) + viewport.x(
), |
116 convertValueFromPercentageToUserUnits(y, viewportSize) + viewport.y(
), | 116 convertValueFromPercentageToUserUnits(y, viewportSize) + viewport.y(
), |
117 convertValueFromPercentageToUserUnits(width, viewportSize), | 117 convertValueFromPercentageToUserUnits(width, viewportSize), |
118 convertValueFromPercentageToUserUnits(height, viewportSize)); | 118 convertValueFromPercentageToUserUnits(height, viewportSize)); |
119 } | 119 } |
120 | 120 |
121 SVGLengthContext lengthContext(context); | 121 SVGLengthContext lengthContext(context); |
122 return FloatRect(x.value(lengthContext), y.value(lengthContext), width.value
(lengthContext), height.value(lengthContext)); | 122 return FloatRect(x.value(lengthContext), y.value(lengthContext), width.value
(lengthContext), height.value(lengthContext)); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); | 349 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); |
350 viewportSize = svg.currentViewBoxRect().size(); | 350 viewportSize = svg.currentViewBoxRect().size(); |
351 if (viewportSize.isEmpty()) | 351 if (viewportSize.isEmpty()) |
352 viewportSize = svg.currentViewportSize(); | 352 viewportSize = svg.currentViewportSize(); |
353 | 353 |
354 return true; | 354 return true; |
355 } | 355 } |
356 | 356 |
357 } | 357 } |
OLD | NEW |