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

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

Issue 2537223006: Cleanup after removal of the SVGViewSpec interface (Closed)
Patch Set: SVGViewSpec& 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef SVGViewSpec_h 20 #ifndef SVGViewSpec_h
21 #define SVGViewSpec_h 21 #define SVGViewSpec_h
22 22
23 #include "core/svg/SVGFitToViewBox.h"
24 #include "core/svg/SVGSVGElement.h"
25 #include "core/svg/SVGZoomAndPan.h" 23 #include "core/svg/SVGZoomAndPan.h"
26 #include "platform/heap/Handle.h" 24 #include "platform/heap/Handle.h"
27 25
28 namespace blink { 26 namespace blink {
29 27
28 class FloatRect;
29 class SVGPreserveAspectRatio;
30 class SVGRect;
31 class SVGTransformList;
32
30 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>, 33 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>,
31 public SVGZoomAndPan, 34 public SVGZoomAndPan {
32 public SVGFitToViewBox {
33 USING_GARBAGE_COLLECTED_MIXIN(SVGViewSpec);
34
35 public: 35 public:
36 static SVGViewSpec* create(SVGSVGElement* contextElement) { 36 static SVGViewSpec* create() { return new SVGViewSpec(); }
37 return new SVGViewSpec(contextElement);
38 }
39 37
40 bool parseViewSpec(const String&); 38 bool parseViewSpec(const String&);
41 void reset(); 39 void reset();
42 template <typename T> 40 template <typename T>
43 void inheritViewAttributesFromElement(T*); 41 void inheritViewAttributesFromElement(T*);
44 42
45 SVGTransformList* transform() { 43 SVGRect* viewBox() { return m_viewBox; }
46 return m_transform ? m_transform->baseValue() : 0; 44 SVGPreserveAspectRatio* preserveAspectRatio() {
45 return m_preserveAspectRatio;
47 } 46 }
47 SVGTransformList* transform() { return m_transform; }
48 48
49 DECLARE_VIRTUAL_TRACE(); 49 DECLARE_VIRTUAL_TRACE();
50 50
51 SVGSVGElement* contextElement() { return m_contextElement.get(); }
52
53 private: 51 private:
54 explicit SVGViewSpec(SVGSVGElement*); 52 SVGViewSpec();
55 53
56 template <typename CharType> 54 template <typename CharType>
57 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); 55 bool parseViewSpecInternal(const CharType* ptr, const CharType* end);
58 56
59 Member<SVGSVGElement> m_contextElement; 57 void setViewBox(const FloatRect&);
60 Member<SVGAnimatedTransformList> m_transform; 58 void setPreserveAspectRatio(const SVGPreserveAspectRatio&);
61 String m_viewTargetString; 59
60 Member<SVGRect> m_viewBox;
61 Member<SVGPreserveAspectRatio> m_preserveAspectRatio;
62 Member<SVGTransformList> m_transform;
62 }; 63 };
63 64
64 template <typename T> 65 template <typename T>
65 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) { 66 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) {
66 if (!inheritFromElement->hasEmptyViewBox()) 67 if (!inheritFromElement->hasEmptyViewBox())
67 viewBox()->baseValue()->setValue( 68 setViewBox(inheritFromElement->viewBox()->currentValue()->value());
68 inheritFromElement->viewBox()->currentValue()->value());
69 69
70 if (inheritFromElement->preserveAspectRatio()->isSpecified()) { 70 if (inheritFromElement->preserveAspectRatio()->isSpecified()) {
71 preserveAspectRatio()->baseValue()->setAlign( 71 setPreserveAspectRatio(
72 inheritFromElement->preserveAspectRatio()->currentValue()->align()); 72 *inheritFromElement->preserveAspectRatio()->currentValue());
73 preserveAspectRatio()->baseValue()->setMeetOrSlice(
74 inheritFromElement->preserveAspectRatio()
75 ->currentValue()
76 ->meetOrSlice());
77 } 73 }
78 74
79 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) 75 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr))
80 setZoomAndPan(inheritFromElement->zoomAndPan()); 76 setZoomAndPan(inheritFromElement->zoomAndPan());
81 } 77 }
82 78
83 } // namespace blink 79 } // namespace blink
84 80
85 #endif // SVGViewSpec_h 81 #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