summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/SVGPreserveAspectRatio.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/svg/SVGPreserveAspectRatio.h')
-rw-r--r--WebCore/svg/SVGPreserveAspectRatio.h120
1 files changed, 59 insertions, 61 deletions
diff --git a/WebCore/svg/SVGPreserveAspectRatio.h b/WebCore/svg/SVGPreserveAspectRatio.h
index f29b7d3..eda82d4 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.h
+++ b/WebCore/svg/SVGPreserveAspectRatio.h
@@ -22,72 +22,70 @@
#define SVGPreserveAspectRatio_h
#if ENABLE(SVG)
-#include "FloatRect.h"
-#include "PlatformString.h"
-#include "SVGNames.h"
-#include <wtf/Forward.h>
+#include "ExceptionCode.h"
+#include <wtf/text/WTFString.h>
namespace WebCore {
- class AffineTransform;
-
- class SVGPreserveAspectRatio {
- public:
- enum SVGPreserveAspectRatioType {
- SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
- SVG_PRESERVEASPECTRATIO_NONE = 1,
- SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
- SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
- SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
- SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
- SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
- SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
- SVG_PRESERVEASPECTRATIO_XMINYMAX = 8,
- SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9,
- SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
- };
-
- enum SVGMeetOrSliceType {
- SVG_MEETORSLICE_UNKNOWN = 0,
- SVG_MEETORSLICE_MEET = 1,
- SVG_MEETORSLICE_SLICE = 2
- };
-
- SVGPreserveAspectRatio();
-
- void setAlign(unsigned short);
- unsigned short align() const;
-
- void setMeetOrSlice(unsigned short);
- unsigned short meetOrSlice() const;
-
- void transformRect(FloatRect& destRect, FloatRect& srcRect);
-
- AffineTransform getCTM(double logicX, double logicY,
- double logicWidth, double logicHeight,
- double physX, double physY,
- double physWidth, double physHeight) const;
-
- template<class Consumer>
- static bool parsePreserveAspectRatio(Consumer* consumer, const String& value, bool validate = true)
- {
- bool result = false;
- const UChar* begin = value.characters();
- const UChar* end = begin + value.length();
- consumer->setPreserveAspectRatioBaseValue(parsePreserveAspectRatio(begin, end, validate, result));
- return result;
- }
-
- // It's recommended to use the method above, only SVGViewSpec needs this parsing method
- static SVGPreserveAspectRatio parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate, bool& result);
-
- String valueAsString() const;
-
- private:
- unsigned short m_align;
- unsigned short m_meetOrSlice;
+class AffineTransform;
+class FloatRect;
+
+class SVGPreserveAspectRatio {
+public:
+ enum SVGPreserveAspectRatioType {
+ SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
+ SVG_PRESERVEASPECTRATIO_NONE = 1,
+ SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
+ SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
+ SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
+ SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
+ SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
+ SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
+ SVG_PRESERVEASPECTRATIO_XMINYMAX = 8,
+ SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9,
+ SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
};
+ enum SVGMeetOrSliceType {
+ SVG_MEETORSLICE_UNKNOWN = 0,
+ SVG_MEETORSLICE_MEET = 1,
+ SVG_MEETORSLICE_SLICE = 2
+ };
+
+ SVGPreserveAspectRatio();
+
+ void setAlign(unsigned short align, ExceptionCode&);
+ unsigned short align() const { return m_align; }
+
+ void setMeetOrSlice(unsigned short, ExceptionCode&);
+ unsigned short meetOrSlice() const { return m_meetOrSlice; }
+
+ void transformRect(FloatRect& destRect, FloatRect& srcRect);
+
+ AffineTransform getCTM(double logicX, double logicY,
+ double logicWidth, double logicHeight,
+ double physWidth, double physHeight) const;
+
+ template<class Consumer>
+ static bool parsePreserveAspectRatio(Consumer* consumer, const String& value, bool validate = true)
+ {
+ bool result = false;
+ const UChar* begin = value.characters();
+ const UChar* end = begin + value.length();
+ consumer->setPreserveAspectRatioBaseValue(parsePreserveAspectRatio(begin, end, validate, result));
+ return result;
+ }
+
+ // It's recommended to use the method above, only SVGViewSpec needs this parsing method
+ static SVGPreserveAspectRatio parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate, bool& result);
+
+ String valueAsString() const;
+
+private:
+ SVGPreserveAspectRatioType m_align;
+ SVGMeetOrSliceType m_meetOrSlice;
+};
+
} // namespace WebCore
#endif // ENABLE(SVG)