OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 if (nchars > numberOfChars - charnum) | 114 if (nchars > numberOfChars - charnum) |
115 nchars = numberOfChars - charnum; | 115 nchars = numberOfChars - charnum; |
116 | 116 |
117 return SVGTextQuery(layoutObject()).subStringLength(charnum, nchars); | 117 return SVGTextQuery(layoutObject()).subStringLength(charnum, nchars); |
118 } | 118 } |
119 | 119 |
120 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionO
fChar(unsigned charnum, ExceptionState& exceptionState) | 120 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionO
fChar(unsigned charnum, ExceptionState& exceptionState) |
121 { | 121 { |
122 document().updateLayoutIgnorePendingStylesheets(); | 122 document().updateLayoutIgnorePendingStylesheets(); |
123 | 123 |
124 if (charnum > getNumberOfChars()) { | 124 if (charnum >= getNumberOfChars()) { |
125 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 125 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
126 return nullptr; | 126 return nullptr; |
127 } | 127 } |
128 | 128 |
129 FloatPoint point = SVGTextQuery(layoutObject()).startPositionOfCharacter(cha
rnum); | 129 FloatPoint point = SVGTextQuery(layoutObject()).startPositionOfCharacter(cha
rnum); |
130 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); | 130 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
131 } | 131 } |
132 | 132 |
133 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfC
har(unsigned charnum, ExceptionState& exceptionState) | 133 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfC
har(unsigned charnum, ExceptionState& exceptionState) |
134 { | 134 { |
135 document().updateLayoutIgnorePendingStylesheets(); | 135 document().updateLayoutIgnorePendingStylesheets(); |
136 | 136 |
137 if (charnum > getNumberOfChars()) { | 137 if (charnum >= getNumberOfChars()) { |
138 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 138 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
139 return nullptr; | 139 return nullptr; |
140 } | 140 } |
141 | 141 |
142 FloatPoint point = SVGTextQuery(layoutObject()).endPositionOfCharacter(charn
um); | 142 FloatPoint point = SVGTextQuery(layoutObject()).endPositionOfCharacter(charn
um); |
143 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); | 143 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
144 } | 144 } |
145 | 145 |
146 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(un
signed charnum, ExceptionState& exceptionState) | 146 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(un
signed charnum, ExceptionState& exceptionState) |
147 { | 147 { |
148 document().updateLayoutIgnorePendingStylesheets(); | 148 document().updateLayoutIgnorePendingStylesheets(); |
149 | 149 |
150 if (charnum > getNumberOfChars()) { | 150 if (charnum >= getNumberOfChars()) { |
151 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 151 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
152 return nullptr; | 152 return nullptr; |
153 } | 153 } |
154 | 154 |
155 FloatRect rect = SVGTextQuery(layoutObject()).extentOfCharacter(charnum); | 155 FloatRect rect = SVGTextQuery(layoutObject()).extentOfCharacter(charnum); |
156 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal
); | 156 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal
); |
157 } | 157 } |
158 | 158 |
159 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) | 159 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) |
160 { | 160 { |
161 document().updateLayoutIgnorePendingStylesheets(); | 161 document().updateLayoutIgnorePendingStylesheets(); |
162 | 162 |
163 if (charnum > getNumberOfChars()) { | 163 if (charnum >= getNumberOfChars()) { |
164 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 164 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
165 return 0.0f; | 165 return 0.0f; |
166 } | 166 } |
167 | 167 |
168 return SVGTextQuery(layoutObject()).rotationOfCharacter(charnum); | 168 return SVGTextQuery(layoutObject()).rotationOfCharacter(charnum); |
169 } | 169 } |
170 | 170 |
171 int SVGTextContentElement::getCharNumAtPosition(PassRefPtrWillBeRawPtr<SVGPointT
earOff> point, ExceptionState& exceptionState) | 171 int SVGTextContentElement::getCharNumAtPosition(PassRefPtrWillBeRawPtr<SVGPointT
earOff> point, ExceptionState& exceptionState) |
172 { | 172 { |
173 document().updateLayoutIgnorePendingStylesheets(); | 173 document().updateLayoutIgnorePendingStylesheets(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 if (!layoutObject->isSVGText() && !layoutObject->isSVGInline()) | 259 if (!layoutObject->isSVGText() && !layoutObject->isSVGInline()) |
260 return nullptr; | 260 return nullptr; |
261 | 261 |
262 SVGElement* element = toSVGElement(layoutObject->node()); | 262 SVGElement* element = toSVGElement(layoutObject->node()); |
263 ASSERT(element); | 263 ASSERT(element); |
264 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element)
: 0; | 264 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element)
: 0; |
265 } | 265 } |
266 | 266 |
267 } | 267 } |
OLD | NEW |