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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar
s, ExceptionState& es) | 116 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar
s, ExceptionState& es) |
117 { | 117 { |
118 document()->updateLayoutIgnorePendingStylesheets(); | 118 document()->updateLayoutIgnorePendingStylesheets(); |
119 | 119 |
120 unsigned numberOfChars = getNumberOfChars(); | 120 unsigned numberOfChars = getNumberOfChars(); |
121 if (charnum >= numberOfChars) { | 121 if (charnum >= numberOfChars) { |
122 es.throwDOMException(IndexSizeError); | 122 es.throwDOMException(IndexSizeError); |
123 return 0.0f; | 123 return 0.0f; |
124 } | 124 } |
125 | 125 |
| 126 if (nchars > numberOfChars - charnum) |
| 127 nchars = numberOfChars - charnum; |
| 128 |
126 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); | 129 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); |
127 } | 130 } |
128 | 131 |
129 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti
onState& es) | 132 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti
onState& es) |
130 { | 133 { |
131 document()->updateLayoutIgnorePendingStylesheets(); | 134 document()->updateLayoutIgnorePendingStylesheets(); |
132 | 135 |
133 if (charnum > getNumberOfChars()) { | 136 if (charnum > getNumberOfChars()) { |
134 es.throwDOMException(IndexSizeError); | 137 es.throwDOMException(IndexSizeError); |
135 return FloatPoint(); | 138 return FloatPoint(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 SVGElement* element = toSVGElement(renderer->node()); | 302 SVGElement* element = toSVGElement(renderer->node()); |
300 ASSERT(element); | 303 ASSERT(element); |
301 | 304 |
302 if (!element->isTextContent()) | 305 if (!element->isTextContent()) |
303 return 0; | 306 return 0; |
304 | 307 |
305 return toSVGTextContentElement(element); | 308 return toSVGTextContentElement(element); |
306 } | 309 } |
307 | 310 |
308 } | 311 } |
OLD | NEW |