| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 { | 77 { |
| 78 resetZoomAndPan(); | 78 resetZoomAndPan(); |
| 79 m_transform->baseValue()->clear(); | 79 m_transform->baseValue()->clear(); |
| 80 updateViewBox(FloatRect()); | 80 updateViewBox(FloatRect()); |
| 81 ASSERT(preserveAspectRatio()); | 81 ASSERT(preserveAspectRatio()); |
| 82 preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRE
SERVEASPECTRATIO_XMIDYMID); | 82 preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRE
SERVEASPECTRATIO_XMIDYMID); |
| 83 preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::S
VG_MEETORSLICE_MEET); | 83 preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::S
VG_MEETORSLICE_MEET); |
| 84 m_viewTargetString = emptyString(); | 84 m_viewTargetString = emptyString(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SVGViewSpec::detachContextElement() | |
| 88 { | |
| 89 m_transform = nullptr; | |
| 90 clearViewBox(); | |
| 91 clearPreserveAspectRatio(); | |
| 92 m_contextElement = nullptr; | |
| 93 } | |
| 94 | |
| 95 SVGElement* SVGViewSpec::viewTarget() const | |
| 96 { | |
| 97 if (!m_contextElement) | |
| 98 return nullptr; | |
| 99 Element* element = m_contextElement->treeScope().getElementById(AtomicString
(m_viewTargetString)); | |
| 100 if (!element || !element->isSVGElement()) | |
| 101 return nullptr; | |
| 102 return toSVGElement(element); | |
| 103 } | |
| 104 | |
| 105 String SVGViewSpec::viewBoxString() const | |
| 106 { | |
| 107 if (!viewBox()) | |
| 108 return String(); | |
| 109 | |
| 110 return viewBox()->currentValue()->valueAsString(); | |
| 111 } | |
| 112 | |
| 113 String SVGViewSpec::preserveAspectRatioString() const | |
| 114 { | |
| 115 if (!preserveAspectRatio()) | |
| 116 return String(); | |
| 117 | |
| 118 return preserveAspectRatio()->baseValue()->valueAsString(); | |
| 119 } | |
| 120 | |
| 121 String SVGViewSpec::transformString() const | |
| 122 { | |
| 123 if (!m_transform) | |
| 124 return String(); | |
| 125 | |
| 126 return m_transform->baseValue()->valueAsString(); | |
| 127 } | |
| 128 | |
| 129 void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& exceptionState) | 87 void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& exceptionState) |
| 130 { | 88 { |
| 131 // SVGViewSpec and all of its content is read-only. | 89 // SVGViewSpec and all of its content is read-only. |
| 132 exceptionState.throwDOMException(NoModificationAllowedError, ExceptionMessag
es::readOnly()); | 90 exceptionState.throwDOMException(NoModificationAllowedError, ExceptionMessag
es::readOnly()); |
| 133 } | 91 } |
| 134 | 92 |
| 135 static const LChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'}; | 93 static const LChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'}; |
| 136 static const LChar viewBoxSpec[] = {'v', 'i', 'e', 'w', 'B', 'o', 'x'}; | 94 static const LChar viewBoxSpec[] = {'v', 'i', 'e', 'w', 'B', 'o', 'x'}; |
| 137 static const LChar preserveAspectRatioSpec[] = {'p', 'r', 'e', 's', 'e', 'r', 'v
', 'e', 'A', 's', 'p', 'e', 'c', 't', 'R', 'a', 't', 'i', 'o'}; | 95 static const LChar preserveAspectRatioSpec[] = {'p', 'r', 'e', 's', 'e', 'r', 'v
', 'e', 'A', 's', 'p', 'e', 'c', 't', 'R', 'a', 't', 'i', 'o'}; |
| 138 static const LChar transformSpec[] = {'t', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm
'}; | 96 static const LChar transformSpec[] = {'t', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm
'}; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 ptr++; | 174 ptr++; |
| 217 } | 175 } |
| 218 | 176 |
| 219 if (ptr >= end || *ptr != ')') | 177 if (ptr >= end || *ptr != ')') |
| 220 return false; | 178 return false; |
| 221 | 179 |
| 222 return true; | 180 return true; |
| 223 } | 181 } |
| 224 | 182 |
| 225 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |