OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 }; | 49 }; |
50 | 50 |
51 class SVGLengthContext { | 51 class SVGLengthContext { |
52 STACK_ALLOCATED(); | 52 STACK_ALLOCATED(); |
53 public: | 53 public: |
54 explicit SVGLengthContext(const SVGElement*); | 54 explicit SVGLengthContext(const SVGElement*); |
55 | 55 |
56 template<typename T> | 56 template<typename T> |
57 static FloatRect resolveRectangle(const T* context, SVGUnitTypes::SVGUnitTyp
e type, const FloatRect& viewport) | 57 static FloatRect resolveRectangle(const T* context, SVGUnitTypes::SVGUnitTyp
e type, const FloatRect& viewport) |
58 { | 58 { |
59 return resolveRectangle(context, type, viewport, context->x()->currentVa
lue(), context->y()->currentValue(), context->width()->currentValue(), context->
height()->currentValue()); | 59 return resolveRectangle(context, type, viewport, *context->x()->currentV
alue(), *context->y()->currentValue(), *context->width()->currentValue(), *conte
xt->height()->currentValue()); |
60 } | 60 } |
61 | 61 |
62 static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitTy
pe, const FloatRect& viewport, PassRefPtrWillBeRawPtr<SVGLength> x, PassRefPtrWi
llBeRawPtr<SVGLength> y, PassRefPtrWillBeRawPtr<SVGLength> width, PassRefPtrWill
BeRawPtr<SVGLength> height); | 62 static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitTy
pe, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVG
Length& width, const SVGLength& height); |
63 static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType,
PassRefPtrWillBeRawPtr<SVGLength> x, PassRefPtrWillBeRawPtr<SVGLength> y); | 63 static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType,
const SVGLength& x, const SVGLength& y); |
64 static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, Pas
sRefPtrWillBeRawPtr<SVGLength>); | 64 static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, con
st SVGLength&); |
65 | 65 |
66 float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit)
const; | 66 float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit)
const; |
67 float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit)
const; | 67 float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit)
const; |
68 | 68 |
69 bool determineViewport(FloatSize&) const; | 69 bool determineViewport(FloatSize&) const; |
70 | 70 |
71 private: | 71 private: |
72 static float convertValueFromUserUnitsToPercentage(float value, SVGLengthMod
e, const FloatSize&); | 72 static float convertValueFromUserUnitsToPercentage(float value, SVGLengthMod
e, const FloatSize&); |
73 static float convertValueFromPercentageToUserUnits(float value, SVGLengthMod
e, const FloatSize&); | 73 static float convertValueFromPercentageToUserUnits(float value, SVGLengthMod
e, const FloatSize&); |
74 static float convertValueFromPercentageToUserUnits(const SVGLength& value, c
onst FloatSize& viewportSize); | 74 static float convertValueFromPercentageToUserUnits(const SVGLength& value, c
onst FloatSize& viewportSize); |
75 | 75 |
76 float convertValueFromUserUnitsToEMS(float value) const; | 76 float convertValueFromUserUnitsToEMS(float value) const; |
77 float convertValueFromEMSToUserUnits(float value) const; | 77 float convertValueFromEMSToUserUnits(float value) const; |
78 | 78 |
79 float convertValueFromUserUnitsToEXS(float value) const; | 79 float convertValueFromUserUnitsToEXS(float value) const; |
80 float convertValueFromEXSToUserUnits(float value) const; | 80 float convertValueFromEXSToUserUnits(float value) const; |
81 | 81 |
82 RawPtrWillBeMember<const SVGElement> m_context; | 82 RawPtrWillBeMember<const SVGElement> m_context; |
83 }; | 83 }; |
84 | 84 |
85 } // namespace blink | 85 } // namespace blink |
86 | 86 |
87 #endif // SVGLengthContext_h | 87 #endif // SVGLengthContext_h |
OLD | NEW |