OLD | NEW |
---|---|
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 "bindings/core/v8/TraceWrapperMember.h" | |
24 #include "core/svg/SVGFitToViewBox.h" | 23 #include "core/svg/SVGFitToViewBox.h" |
25 #include "core/svg/SVGSVGElement.h" | 24 #include "core/svg/SVGSVGElement.h" |
26 #include "core/svg/SVGZoomAndPan.h" | 25 #include "core/svg/SVGZoomAndPan.h" |
27 #include "platform/heap/Handle.h" | 26 #include "platform/heap/Handle.h" |
28 | 27 |
29 namespace blink { | 28 namespace blink { |
30 | 29 |
31 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>, | 30 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>, |
32 public ScriptWrappable, | |
33 public SVGZoomAndPan, | 31 public SVGZoomAndPan, |
foolip
2016/11/08 09:42:42
Have you verified that both of these still need to
fs
2016/11/08 10:29:40
With the setZoomAndPan overrides below (which thin
Shanmuga Pandi
2016/11/09 06:34:56
though setZoomAndPan overrides, but parseViewSpecI
Shanmuga Pandi
2016/11/09 06:34:56
I have checked. It seems both are needed.
fs
2016/11/09 11:39:53
Acknowledged. But just removing the setZoomAndPan
Shanmuga Pandi
2016/11/09 12:00:06
Not sure.
Do you want to remove below two ?
void s
fs
2016/11/09 12:13:05
Yes, at the very least the second one. Removing th
Shanmuga Pandi
2016/11/11 12:35:50
Done.
| |
34 public SVGFitToViewBox { | 32 public SVGFitToViewBox { |
35 DEFINE_WRAPPERTYPEINFO(); | |
36 USING_GARBAGE_COLLECTED_MIXIN(SVGViewSpec); | 33 USING_GARBAGE_COLLECTED_MIXIN(SVGViewSpec); |
37 | 34 |
38 public: | 35 public: |
39 static SVGViewSpec* create(SVGSVGElement* contextElement) { | 36 static SVGViewSpec* create(SVGSVGElement* contextElement) { |
40 return new SVGViewSpec(contextElement); | 37 return new SVGViewSpec(contextElement); |
41 } | 38 } |
42 | 39 |
43 bool parseViewSpec(const String&); | 40 bool parseViewSpec(const String&); |
44 void reset(); | 41 void reset(); |
45 void detachContextElement(); | |
46 template <typename T> | 42 template <typename T> |
47 void inheritViewAttributesFromElement(T*); | 43 void inheritViewAttributesFromElement(T*); |
48 | 44 |
49 // JS API | |
50 SVGTransformList* transform() { | 45 SVGTransformList* transform() { |
51 return m_transform ? m_transform->baseValue() : 0; | 46 return m_transform ? m_transform->baseValue() : 0; |
52 } | 47 } |
53 SVGTransformListTearOff* transformFromJavascript() { | |
54 return m_transform ? m_transform->baseVal() : 0; | |
55 } | |
56 SVGElement* viewTarget() const; | |
57 String viewBoxString() const; | |
58 String preserveAspectRatioString() const; | |
59 String transformString() const; | |
60 String viewTargetString() const { return m_viewTargetString; } | |
61 // override SVGZoomAndPan.setZoomAndPan so can throw exception on write | 48 // override SVGZoomAndPan.setZoomAndPan so can throw exception on write |
62 void setZoomAndPan(unsigned short value) {} // read only | 49 void setZoomAndPan(unsigned short value) {} // read only |
63 void setZoomAndPan(unsigned short value, ExceptionState&); | 50 void setZoomAndPan(unsigned short value, ExceptionState&); |
64 | 51 |
65 DECLARE_VIRTUAL_TRACE(); | 52 DECLARE_VIRTUAL_TRACE(); |
66 DECLARE_VIRTUAL_TRACE_WRAPPERS(); | 53 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
fs
2016/11/08 12:42:41
I believe this is now useless (no longer any wrapp
Shanmuga Pandi
2016/11/09 06:34:56
Done.
| |
67 | 54 |
68 SVGSVGElement* contextElement() { return m_contextElement.get(); } | 55 SVGSVGElement* contextElement() { return m_contextElement.get(); } |
69 | 56 |
70 private: | 57 private: |
71 explicit SVGViewSpec(SVGSVGElement*); | 58 explicit SVGViewSpec(SVGSVGElement*); |
72 | 59 |
73 template <typename CharType> | 60 template <typename CharType> |
74 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); | 61 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); |
75 | 62 |
fs
2016/11/08 10:29:40
(...i.e these...)
| |
76 TraceWrapperMember<SVGSVGElement> m_contextElement; | 63 TraceWrapperMember<SVGSVGElement> m_contextElement; |
77 Member<SVGAnimatedTransformList> m_transform; | 64 Member<SVGAnimatedTransformList> m_transform; |
78 String m_viewTargetString; | 65 String m_viewTargetString; |
79 }; | 66 }; |
80 | 67 |
81 template <typename T> | 68 template <typename T> |
82 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) { | 69 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) { |
83 if (!inheritFromElement->hasEmptyViewBox()) | 70 if (!inheritFromElement->hasEmptyViewBox()) |
84 viewBox()->baseValue()->setValue( | 71 viewBox()->baseValue()->setValue( |
85 inheritFromElement->viewBox()->currentValue()->value()); | 72 inheritFromElement->viewBox()->currentValue()->value()); |
86 | 73 |
87 if (inheritFromElement->preserveAspectRatio()->isSpecified()) { | 74 if (inheritFromElement->preserveAspectRatio()->isSpecified()) { |
88 preserveAspectRatio()->baseValue()->setAlign( | 75 preserveAspectRatio()->baseValue()->setAlign( |
89 inheritFromElement->preserveAspectRatio()->currentValue()->align()); | 76 inheritFromElement->preserveAspectRatio()->currentValue()->align()); |
90 preserveAspectRatio()->baseValue()->setMeetOrSlice( | 77 preserveAspectRatio()->baseValue()->setMeetOrSlice( |
91 inheritFromElement->preserveAspectRatio() | 78 inheritFromElement->preserveAspectRatio() |
92 ->currentValue() | 79 ->currentValue() |
93 ->meetOrSlice()); | 80 ->meetOrSlice()); |
94 } | 81 } |
95 | 82 |
96 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) | 83 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) |
97 setZoomAndPan(inheritFromElement->zoomAndPan()); | 84 setZoomAndPan(inheritFromElement->zoomAndPan()); |
98 } | 85 } |
99 | 86 |
100 } // namespace blink | 87 } // namespace blink |
101 | 88 |
102 #endif // SVGViewSpec_h | 89 #endif // SVGViewSpec_h |
OLD | NEW |