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 29 matching lines...) Expand all Loading... |
40 : m_context(context) | 40 : m_context(context) |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 SVGLengthContext::SVGLengthContext(const SVGElement* context, const FloatRect& v
iewport) | 44 SVGLengthContext::SVGLengthContext(const SVGElement* context, const FloatRect& v
iewport) |
45 : m_context(context) | 45 : m_context(context) |
46 , m_overridenViewport(viewport) | 46 , m_overridenViewport(viewport) |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitT
ypes::SVGUnitType type, const FloatRect& viewport, PassRefPtr<SVGLength> passX,
PassRefPtr<SVGLength> passY, PassRefPtr<SVGLength> passWidth, PassRefPtr<SVGLeng
th> passHeight) | 50 FloatRect SVGLengthContext::resolveRectangle(const SVGElement* context, SVGUnitT
ypes::SVGUnitType type, const FloatRect& viewport, PassRefPtrWillBeRawPtr<SVGLen
gth> passX, PassRefPtrWillBeRawPtr<SVGLength> passY, PassRefPtrWillBeRawPtr<SVGL
ength> passWidth, PassRefPtrWillBeRawPtr<SVGLength> passHeight) |
51 { | 51 { |
52 RefPtr<SVGLength> x = passX; | 52 RefPtrWillBeRawPtr<SVGLength> x = passX; |
53 RefPtr<SVGLength> y = passY; | 53 RefPtrWillBeRawPtr<SVGLength> y = passY; |
54 RefPtr<SVGLength> width = passWidth; | 54 RefPtrWillBeRawPtr<SVGLength> width = passWidth; |
55 RefPtr<SVGLength> height = passHeight; | 55 RefPtrWillBeRawPtr<SVGLength> height = passHeight; |
56 | 56 |
57 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); | 57 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); |
58 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { | 58 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { |
59 SVGLengthContext lengthContext(context); | 59 SVGLengthContext lengthContext(context); |
60 return FloatRect(x->value(lengthContext), y->value(lengthContext), width
->value(lengthContext), height->value(lengthContext)); | 60 return FloatRect(x->value(lengthContext), y->value(lengthContext), width
->value(lengthContext), height->value(lengthContext)); |
61 } | 61 } |
62 | 62 |
63 SVGLengthContext lengthContext(context, viewport); | 63 SVGLengthContext lengthContext(context, viewport); |
64 return FloatRect( | 64 return FloatRect( |
65 x->value(lengthContext) + viewport.x(), | 65 x->value(lengthContext) + viewport.x(), |
66 y->value(lengthContext) + viewport.y(), | 66 y->value(lengthContext) + viewport.y(), |
67 width->value(lengthContext), | 67 width->value(lengthContext), |
68 height->value(lengthContext)); | 68 height->value(lengthContext)); |
69 } | 69 } |
70 | 70 |
71 FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitType
s::SVGUnitType type, PassRefPtr<SVGLength> passX, PassRefPtr<SVGLength> passY) | 71 FloatPoint SVGLengthContext::resolvePoint(const SVGElement* context, SVGUnitType
s::SVGUnitType type, PassRefPtrWillBeRawPtr<SVGLength> passX, PassRefPtrWillBeRa
wPtr<SVGLength> passY) |
72 { | 72 { |
73 RefPtr<SVGLength> x = passX; | 73 RefPtrWillBeRawPtr<SVGLength> x = passX; |
74 RefPtr<SVGLength> y = passY; | 74 RefPtrWillBeRawPtr<SVGLength> y = passY; |
75 | 75 |
76 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); | 76 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); |
77 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { | 77 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { |
78 SVGLengthContext lengthContext(context); | 78 SVGLengthContext lengthContext(context); |
79 return FloatPoint(x->value(lengthContext), y->value(lengthContext)); | 79 return FloatPoint(x->value(lengthContext), y->value(lengthContext)); |
80 } | 80 } |
81 | 81 |
82 // 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. | 82 // 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. |
83 return FloatPoint(x->valueAsPercentage(), y->valueAsPercentage()); | 83 return FloatPoint(x->valueAsPercentage(), y->valueAsPercentage()); |
84 } | 84 } |
85 | 85 |
86 float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
VGUnitType type, PassRefPtr<SVGLength> passX) | 86 float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
VGUnitType type, PassRefPtrWillBeRawPtr<SVGLength> passX) |
87 { | 87 { |
88 RefPtr<SVGLength> x = passX; | 88 RefPtrWillBeRawPtr<SVGLength> x = passX; |
89 | 89 |
90 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); | 90 ASSERT(type != SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN); |
91 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { | 91 if (type == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { |
92 SVGLengthContext lengthContext(context); | 92 SVGLengthContext lengthContext(context); |
93 return x->value(lengthContext); | 93 return x->value(lengthContext); |
94 } | 94 } |
95 | 95 |
96 // 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. | 96 // 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. |
97 return x->valueAsPercentage(); | 97 return x->valueAsPercentage(); |
98 } | 98 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); | 313 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); |
314 viewportSize = svg.currentViewBoxRect().size(); | 314 viewportSize = svg.currentViewBoxRect().size(); |
315 if (viewportSize.isEmpty()) | 315 if (viewportSize.isEmpty()) |
316 viewportSize = svg.currentViewportSize(); | 316 viewportSize = svg.currentViewportSize(); |
317 | 317 |
318 return true; | 318 return true; |
319 } | 319 } |
320 | 320 |
321 } | 321 } |
OLD | NEW |