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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 104 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
105 return 0.0f; | 105 return 0.0f; |
106 } | 106 } |
107 | 107 |
108 if (nchars > numberOfChars - charnum) | 108 if (nchars > numberOfChars - charnum) |
109 nchars = numberOfChars - charnum; | 109 nchars = numberOfChars - charnum; |
110 | 110 |
111 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); | 111 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); |
112 } | 112 } |
113 | 113 |
114 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti
onState& exceptionState) | 114 PassRefPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionOfChar(unsign
ed charnum, ExceptionState& exceptionState) |
115 { | 115 { |
116 document().updateLayoutIgnorePendingStylesheets(); | 116 document().updateLayoutIgnorePendingStylesheets(); |
117 | 117 |
118 if (charnum > getNumberOfChars()) { | 118 if (charnum > getNumberOfChars()) { |
119 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 119 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
120 return FloatPoint(); | 120 return 0; |
121 } | 121 } |
122 | 122 |
123 return SVGTextQuery(renderer()).startPositionOfCharacter(charnum); | 123 FloatPoint point = SVGTextQuery(renderer()).startPositionOfCharacter(charnum
); |
| 124 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
124 } | 125 } |
125 | 126 |
126 SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, Exception
State& exceptionState) | 127 PassRefPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfChar(unsigned
charnum, ExceptionState& exceptionState) |
127 { | 128 { |
128 document().updateLayoutIgnorePendingStylesheets(); | 129 document().updateLayoutIgnorePendingStylesheets(); |
129 | 130 |
130 if (charnum > getNumberOfChars()) { | 131 if (charnum > getNumberOfChars()) { |
131 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 132 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
132 return FloatPoint(); | 133 return 0; |
133 } | 134 } |
134 | 135 |
135 return SVGTextQuery(renderer()).endPositionOfCharacter(charnum); | 136 FloatPoint point = SVGTextQuery(renderer()).endPositionOfCharacter(charnum); |
| 137 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
136 } | 138 } |
137 | 139 |
138 PassRefPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(unsigned charn
um, ExceptionState& exceptionState) | 140 PassRefPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(unsigned charn
um, ExceptionState& exceptionState) |
139 { | 141 { |
140 document().updateLayoutIgnorePendingStylesheets(); | 142 document().updateLayoutIgnorePendingStylesheets(); |
141 | 143 |
142 if (charnum > getNumberOfChars()) { | 144 if (charnum > getNumberOfChars()) { |
143 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 145 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
144 return 0; | 146 return 0; |
145 } | 147 } |
146 | 148 |
147 FloatRect rect = SVGTextQuery(renderer()).extentOfCharacter(charnum); | 149 FloatRect rect = SVGTextQuery(renderer()).extentOfCharacter(charnum); |
148 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal
); | 150 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal
); |
149 } | 151 } |
150 | 152 |
151 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) | 153 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) |
152 { | 154 { |
153 document().updateLayoutIgnorePendingStylesheets(); | 155 document().updateLayoutIgnorePendingStylesheets(); |
154 | 156 |
155 if (charnum > getNumberOfChars()) { | 157 if (charnum > getNumberOfChars()) { |
156 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 158 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
157 return 0.0f; | 159 return 0.0f; |
158 } | 160 } |
159 | 161 |
160 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); | 162 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); |
161 } | 163 } |
162 | 164 |
163 int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point) | 165 int SVGTextContentElement::getCharNumAtPosition(PassRefPtr<SVGPointTearOff> poin
t, ExceptionState& exceptionState) |
164 { | 166 { |
165 document().updateLayoutIgnorePendingStylesheets(); | 167 document().updateLayoutIgnorePendingStylesheets(); |
166 return SVGTextQuery(renderer()).characterNumberAtPosition(point); | 168 return SVGTextQuery(renderer()).characterNumberAtPosition(point->target()->v
alue()); |
167 } | 169 } |
168 | 170 |
169 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
xceptionState& exceptionState) | 171 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
xceptionState& exceptionState) |
170 { | 172 { |
171 unsigned numberOfChars = getNumberOfChars(); | 173 unsigned numberOfChars = getNumberOfChars(); |
172 if (charnum >= numberOfChars) { | 174 if (charnum >= numberOfChars) { |
173 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 175 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
174 return; | 176 return; |
175 } | 177 } |
176 | 178 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 SVGElement* element = toSVGElement(renderer->node()); | 280 SVGElement* element = toSVGElement(renderer->node()); |
279 ASSERT(element); | 281 ASSERT(element); |
280 | 282 |
281 if (!element->isTextContent()) | 283 if (!element->isTextContent()) |
282 return 0; | 284 return 0; |
283 | 285 |
284 return toSVGTextContentElement(element); | 286 return toSVGTextContentElement(element); |
285 } | 287 } |
286 | 288 |
287 } | 289 } |
OLD | NEW |