Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGViewSpec.h

Issue 2552513002: Rework SVGViewSpec<->SVGSVGElement integration (Closed)
Patch Set: Move setup back to SVGSVGElement Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007 Rob Buis <buis@kde.org>
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 10 matching lines...) Expand all
21 #define SVGViewSpec_h 21 #define SVGViewSpec_h
22 22
23 #include "core/svg/SVGZoomAndPan.h" 23 #include "core/svg/SVGZoomAndPan.h"
24 #include "platform/heap/Handle.h" 24 #include "platform/heap/Handle.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 class FloatRect; 28 class FloatRect;
29 class SVGPreserveAspectRatio; 29 class SVGPreserveAspectRatio;
30 class SVGRect; 30 class SVGRect;
31 class SVGSVGElement;
31 class SVGTransformList; 32 class SVGTransformList;
32 33
33 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>, 34 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>,
34 public SVGZoomAndPan { 35 public SVGZoomAndPan {
35 public: 36 public:
36 static SVGViewSpec* create() { return new SVGViewSpec(); } 37 static SVGViewSpec* createForElement(SVGSVGElement&);
37 38
38 bool parseViewSpec(const String&); 39 bool parseViewSpec(const String&);
39 void reset(); 40 void reset();
40 template <typename T> 41 template <typename T>
41 void inheritViewAttributesFromElement(T*); 42 void inheritViewAttributesFromElement(T&);
42 43
43 SVGRect* viewBox() { return m_viewBox; } 44 SVGRect* viewBox() { return m_viewBox; }
44 SVGPreserveAspectRatio* preserveAspectRatio() { 45 SVGPreserveAspectRatio* preserveAspectRatio() {
45 return m_preserveAspectRatio; 46 return m_preserveAspectRatio;
46 } 47 }
47 SVGTransformList* transform() { return m_transform; } 48 SVGTransformList* transform() { return m_transform; }
48 49
49 DECLARE_VIRTUAL_TRACE(); 50 DECLARE_VIRTUAL_TRACE();
50 51
51 private: 52 private:
52 SVGViewSpec(); 53 SVGViewSpec();
53 54
54 template <typename CharType> 55 template <typename CharType>
55 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); 56 bool parseViewSpecInternal(const CharType* ptr, const CharType* end);
56 57
57 void setViewBox(const FloatRect&); 58 void setViewBox(const FloatRect&);
58 void setPreserveAspectRatio(const SVGPreserveAspectRatio&); 59 void setPreserveAspectRatio(const SVGPreserveAspectRatio&);
59 60
60 Member<SVGRect> m_viewBox; 61 Member<SVGRect> m_viewBox;
61 Member<SVGPreserveAspectRatio> m_preserveAspectRatio; 62 Member<SVGPreserveAspectRatio> m_preserveAspectRatio;
62 Member<SVGTransformList> m_transform; 63 Member<SVGTransformList> m_transform;
63 }; 64 };
64 65
65 template <typename T> 66 template <typename T>
66 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) { 67 void SVGViewSpec::inheritViewAttributesFromElement(T& inheritFromElement) {
67 if (!inheritFromElement->hasEmptyViewBox()) 68 if (!inheritFromElement.hasEmptyViewBox())
68 setViewBox(inheritFromElement->viewBox()->currentValue()->value()); 69 setViewBox(inheritFromElement.viewBox()->currentValue()->value());
69 70
70 if (inheritFromElement->preserveAspectRatio()->isSpecified()) { 71 if (inheritFromElement.preserveAspectRatio()->isSpecified()) {
71 setPreserveAspectRatio( 72 setPreserveAspectRatio(
72 *inheritFromElement->preserveAspectRatio()->currentValue()); 73 *inheritFromElement.preserveAspectRatio()->currentValue());
73 } 74 }
74 75
75 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) 76 if (inheritFromElement.hasAttribute(SVGNames::zoomAndPanAttr))
76 setZoomAndPan(inheritFromElement->zoomAndPan()); 77 setZoomAndPan(inheritFromElement.zoomAndPan());
77 } 78 }
78 79
79 } // namespace blink 80 } // namespace blink
80 81
81 #endif // SVGViewSpec_h 82 #endif // SVGViewSpec_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGSVGElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGViewSpec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698