OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2010 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 m_transform->baseValue()->clear(); | 78 m_transform->baseValue()->clear(); |
79 updateViewBox(FloatRect()); | 79 updateViewBox(FloatRect()); |
80 ASSERT(preserveAspectRatio()); | 80 ASSERT(preserveAspectRatio()); |
81 preserveAspectRatio()->baseValue()->setAlign( | 81 preserveAspectRatio()->baseValue()->setAlign( |
82 SVGPreserveAspectRatio::kSvgPreserveaspectratioXmidymid); | 82 SVGPreserveAspectRatio::kSvgPreserveaspectratioXmidymid); |
83 preserveAspectRatio()->baseValue()->setMeetOrSlice( | 83 preserveAspectRatio()->baseValue()->setMeetOrSlice( |
84 SVGPreserveAspectRatio::kSvgMeetorsliceMeet); | 84 SVGPreserveAspectRatio::kSvgMeetorsliceMeet); |
85 m_viewTargetString = emptyString(); | 85 m_viewTargetString = emptyString(); |
86 } | 86 } |
87 | 87 |
88 void SVGViewSpec::detachContextElement() { | |
89 m_transform = nullptr; | |
90 clearViewBox(); | |
91 clearPreserveAspectRatio(); | |
92 m_contextElement = nullptr; | |
93 } | |
94 | |
95 SVGElement* SVGViewSpec::viewTarget() const { | |
96 if (!m_contextElement) | |
97 return nullptr; | |
98 Element* element = m_contextElement->treeScope().getElementById( | |
99 AtomicString(m_viewTargetString)); | |
100 if (!element || !element->isSVGElement()) | |
101 return nullptr; | |
102 return toSVGElement(element); | |
103 } | |
104 | |
105 String SVGViewSpec::viewBoxString() const { | |
106 if (!viewBox()) | |
107 return String(); | |
108 | |
109 return viewBox()->currentValue()->valueAsString(); | |
110 } | |
111 | |
112 String SVGViewSpec::preserveAspectRatioString() const { | |
113 if (!preserveAspectRatio()) | |
114 return String(); | |
115 | |
116 return preserveAspectRatio()->baseValue()->valueAsString(); | |
117 } | |
118 | |
119 String SVGViewSpec::transformString() const { | |
120 if (!m_transform) | |
121 return String(); | |
122 | |
123 return m_transform->baseValue()->valueAsString(); | |
124 } | |
125 | |
126 void SVGViewSpec::setZoomAndPan(unsigned short, | 88 void SVGViewSpec::setZoomAndPan(unsigned short, |
127 ExceptionState& exceptionState) { | 89 ExceptionState& exceptionState) { |
128 // SVGViewSpec and all of its content is read-only. | 90 // SVGViewSpec and all of its content is read-only. |
129 exceptionState.throwDOMException(NoModificationAllowedError, | 91 exceptionState.throwDOMException(NoModificationAllowedError, |
130 ExceptionMessages::readOnly()); | 92 ExceptionMessages::readOnly()); |
131 } | 93 } |
132 | 94 |
133 namespace { | 95 namespace { |
134 | 96 |
135 enum ViewSpecFunctionType { | 97 enum ViewSpecFunctionType { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 188 |
227 if (!skipExactly<CharType>(ptr, end, ')')) | 189 if (!skipExactly<CharType>(ptr, end, ')')) |
228 return false; | 190 return false; |
229 | 191 |
230 skipExactly<CharType>(ptr, end, ';'); | 192 skipExactly<CharType>(ptr, end, ';'); |
231 } | 193 } |
232 return skipExactly<CharType>(ptr, end, ')'); | 194 return skipExactly<CharType>(ptr, end, ')'); |
233 } | 195 } |
234 | 196 |
235 } // namespace blink | 197 } // namespace blink |
OLD | NEW |