OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect,
const SVGPreserveAspectRatio&, float viewWidth, float viewHeight); | 37 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect,
const SVGPreserveAspectRatio&, float viewWidth, float viewHeight); |
38 | 38 |
39 static bool isKnownAttribute(const QualifiedName&); | 39 static bool isKnownAttribute(const QualifiedName&); |
40 static void addSupportedAttributes(HashSet<QualifiedName>&); | 40 static void addSupportedAttributes(HashSet<QualifiedName>&); |
41 | 41 |
42 template<class SVGElementTarget> | 42 template<class SVGElementTarget> |
43 static bool parseAttribute(SVGElementTarget* target, const QualifiedName& na
me, const AtomicString& value) | 43 static bool parseAttribute(SVGElementTarget* target, const QualifiedName& na
me, const AtomicString& value) |
44 { | 44 { |
45 ASSERT(target); | 45 ASSERT(target); |
46 ASSERT(target->document()); | |
47 if (name == SVGNames::viewBoxAttr) { | 46 if (name == SVGNames::viewBoxAttr) { |
48 FloatRect viewBox; | 47 FloatRect viewBox; |
49 bool valueIsValid = !value.isNull() && parseViewBox(target->document
(), value, viewBox); | 48 bool valueIsValid = !value.isNull() && parseViewBox(&target->documen
t(), value, viewBox); |
50 target->setViewBoxBaseValue(viewBox, valueIsValid); | 49 target->setViewBoxBaseValue(viewBox, valueIsValid); |
51 return true; | 50 return true; |
52 } | 51 } |
53 | 52 |
54 if (name == SVGNames::preserveAspectRatioAttr) { | 53 if (name == SVGNames::preserveAspectRatioAttr) { |
55 SVGPreserveAspectRatio preserveAspectRatio; | 54 SVGPreserveAspectRatio preserveAspectRatio; |
56 preserveAspectRatio.parse(value); | 55 preserveAspectRatio.parse(value); |
57 target->setPreserveAspectRatioBaseValue(preserveAspectRatio); | 56 target->setPreserveAspectRatioBaseValue(preserveAspectRatio); |
58 return true; | 57 return true; |
59 } | 58 } |
60 | 59 |
61 return false; | 60 return false; |
62 } | 61 } |
63 | 62 |
64 static bool parseViewBox(Document*, const LChar*& start, const LChar* end, F
loatRect& viewBox, bool validate = true); | 63 static bool parseViewBox(Document*, const LChar*& start, const LChar* end, F
loatRect& viewBox, bool validate = true); |
65 static bool parseViewBox(Document*, const UChar*& start, const UChar* end, F
loatRect& viewBox, bool validate = true); | 64 static bool parseViewBox(Document*, const UChar*& start, const UChar* end, F
loatRect& viewBox, bool validate = true); |
66 | 65 |
67 private: | 66 private: |
68 static bool parseViewBox(Document*, const String&, FloatRect&); | 67 static bool parseViewBox(Document*, const String&, FloatRect&); |
69 }; | 68 }; |
70 | 69 |
71 } // namespace WebCore | 70 } // namespace WebCore |
72 | 71 |
73 #endif // SVGFitToViewBox_h | 72 #endif // SVGFitToViewBox_h |
OLD | NEW |