diff options
Diffstat (limited to 'Source/WebCore/svg/SVGLengthContext.h')
-rw-r--r-- | Source/WebCore/svg/SVGLengthContext.h | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/Source/WebCore/svg/SVGLengthContext.h b/Source/WebCore/svg/SVGLengthContext.h index c7070f8b6..b03eb1f8f 100644 --- a/Source/WebCore/svg/SVGLengthContext.h +++ b/Source/WebCore/svg/SVGLengthContext.h @@ -17,19 +17,18 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGLengthContext_h -#define SVGLengthContext_h +#pragma once -#if ENABLE(SVG) +#include "ExceptionOr.h" #include "FloatRect.h" #include "SVGUnitTypes.h" namespace WebCore { class SVGElement; -class SVGLength; +class SVGLengthValue; -typedef int ExceptionCode; +struct Length; enum SVGLengthType { LengthTypeUnknown = 0, @@ -61,32 +60,30 @@ public: return SVGLengthContext::resolveRectangle(context, type, viewport, context->x(), context->y(), context->width(), context->height()); } - static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitType, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVGLength& width, const SVGLength& height); - static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength& x, const SVGLength& y); - static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength&); + static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitType, const FloatRect& viewport, const SVGLengthValue& x, const SVGLengthValue& y, const SVGLengthValue& width, const SVGLengthValue& height); + static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLengthValue& x, const SVGLengthValue& y); + static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLengthValue&); - float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit, ExceptionCode&) const; - float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit, ExceptionCode&) const; + float valueForLength(const Length&, SVGLengthMode = LengthModeOther); + ExceptionOr<float> convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit) const; + ExceptionOr<float> convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit) const; bool determineViewport(FloatSize&) const; private: SVGLengthContext(const SVGElement*, const FloatRect& viewport); - float convertValueFromUserUnitsToPercentage(float value, SVGLengthMode, ExceptionCode&) const; - float convertValueFromPercentageToUserUnits(float value, SVGLengthMode, ExceptionCode&) const; + ExceptionOr<float> convertValueFromUserUnitsToPercentage(float value, SVGLengthMode) const; + ExceptionOr<float> convertValueFromPercentageToUserUnits(float value, SVGLengthMode) const; - float convertValueFromUserUnitsToEMS(float value, ExceptionCode&) const; - float convertValueFromEMSToUserUnits(float value, ExceptionCode&) const; + ExceptionOr<float> convertValueFromUserUnitsToEMS(float value) const; + ExceptionOr<float> convertValueFromEMSToUserUnits(float value) const; - float convertValueFromUserUnitsToEXS(float value, ExceptionCode&) const; - float convertValueFromEXSToUserUnits(float value, ExceptionCode&) const; + ExceptionOr<float> convertValueFromUserUnitsToEXS(float value) const; + ExceptionOr<float> convertValueFromEXSToUserUnits(float value) const; const SVGElement* m_context; FloatRect m_overridenViewport; }; } // namespace WebCore - -#endif // ENABLE(SVG) -#endif // SVGLengthContext_h |