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 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "core/svg/SVGPreserveAspectRatio.h" | 29 #include "core/svg/SVGPreserveAspectRatio.h" |
30 #include "core/svg/SVGRect.h" | 30 #include "core/svg/SVGRect.h" |
31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class AffineTransform; | 35 class AffineTransform; |
36 | 36 |
37 class SVGFitToViewBox : public GarbageCollectedMixin { | 37 class SVGFitToViewBox : public GarbageCollectedMixin { |
38 public: | 38 public: |
39 enum PropertyMapPolicy { | |
40 PropertyMapPolicyAdd, | |
41 PropertyMapPolicySkip, | |
42 }; | |
43 | |
44 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, | 39 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, |
45 SVGPreserveAspectRatio*, | 40 SVGPreserveAspectRatio*, |
46 float viewWidth, | 41 float viewWidth, |
47 float viewHeight); | 42 float viewHeight); |
48 | 43 |
49 static bool isKnownAttribute(const QualifiedName&); | 44 static bool isKnownAttribute(const QualifiedName&); |
50 | 45 |
51 bool hasEmptyViewBox() const { | 46 bool hasEmptyViewBox() const { |
52 return m_viewBox->currentValue()->isValid() && | 47 return m_viewBox->currentValue()->isValid() && |
53 m_viewBox->currentValue()->value().isEmpty(); | 48 m_viewBox->currentValue()->value().isEmpty(); |
54 } | 49 } |
55 | 50 |
56 // JS API | 51 // JS API |
57 SVGAnimatedRect* viewBox() const { return m_viewBox.get(); } | 52 SVGAnimatedRect* viewBox() const { return m_viewBox.get(); } |
58 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() const { | 53 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() const { |
59 return m_preserveAspectRatio.get(); | 54 return m_preserveAspectRatio.get(); |
60 } | 55 } |
61 | 56 |
62 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
63 | 58 |
64 protected: | 59 protected: |
65 explicit SVGFitToViewBox(SVGElement*, | 60 explicit SVGFitToViewBox(SVGElement*); |
66 PropertyMapPolicy = PropertyMapPolicyAdd); | |
67 void updateViewBox(const FloatRect&); | |
68 void clearViewBox() { m_viewBox = nullptr; } | |
69 void clearPreserveAspectRatio() { m_preserveAspectRatio = nullptr; } | |
70 | 61 |
71 private: | 62 private: |
72 Member<SVGAnimatedRect> m_viewBox; | 63 Member<SVGAnimatedRect> m_viewBox; |
73 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; | 64 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; |
74 }; | 65 }; |
75 | 66 |
76 } // namespace blink | 67 } // namespace blink |
77 | 68 |
78 #endif // SVGFitToViewBox_h | 69 #endif // SVGFitToViewBox_h |
OLD | NEW |