| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 document().updateLayoutIgnorePendingStylesheets(); | 106 document().updateLayoutIgnorePendingStylesheets(); |
| 107 return SVGTextQuery(renderer()).numberOfCharacters(); | 107 return SVGTextQuery(renderer()).numberOfCharacters(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 float SVGTextContentElement::getComputedTextLength() | 110 float SVGTextContentElement::getComputedTextLength() |
| 111 { | 111 { |
| 112 document().updateLayoutIgnorePendingStylesheets(); | 112 document().updateLayoutIgnorePendingStylesheets(); |
| 113 return SVGTextQuery(renderer()).textLength(); | 113 return SVGTextQuery(renderer()).textLength(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar
s, ExceptionState& es) | 116 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar
s, ExceptionState& exceptionState) |
| 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.throwUninformativeAndGenericDOMException(IndexSizeError); | 122 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 123 return 0.0f; | 123 return 0.0f; |
| 124 } | 124 } |
| 125 | 125 |
| 126 if (nchars > numberOfChars - charnum) | 126 if (nchars > numberOfChars - charnum) |
| 127 nchars = numberOfChars - charnum; | 127 nchars = numberOfChars - charnum; |
| 128 | 128 |
| 129 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); | 129 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); |
| 130 } | 130 } |
| 131 | 131 |
| 132 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti
onState& es) | 132 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti
onState& exceptionState) |
| 133 { | 133 { |
| 134 document().updateLayoutIgnorePendingStylesheets(); | 134 document().updateLayoutIgnorePendingStylesheets(); |
| 135 | 135 |
| 136 if (charnum > getNumberOfChars()) { | 136 if (charnum > getNumberOfChars()) { |
| 137 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 137 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 138 return FloatPoint(); | 138 return FloatPoint(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 return SVGTextQuery(renderer()).startPositionOfCharacter(charnum); | 141 return SVGTextQuery(renderer()).startPositionOfCharacter(charnum); |
| 142 } | 142 } |
| 143 | 143 |
| 144 SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, Exception
State& es) | 144 SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, Exception
State& exceptionState) |
| 145 { | 145 { |
| 146 document().updateLayoutIgnorePendingStylesheets(); | 146 document().updateLayoutIgnorePendingStylesheets(); |
| 147 | 147 |
| 148 if (charnum > getNumberOfChars()) { | 148 if (charnum > getNumberOfChars()) { |
| 149 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 149 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 150 return FloatPoint(); | 150 return FloatPoint(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 return SVGTextQuery(renderer()).endPositionOfCharacter(charnum); | 153 return SVGTextQuery(renderer()).endPositionOfCharacter(charnum); |
| 154 } | 154 } |
| 155 | 155 |
| 156 SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionState&
es) | 156 SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionState&
exceptionState) |
| 157 { | 157 { |
| 158 document().updateLayoutIgnorePendingStylesheets(); | 158 document().updateLayoutIgnorePendingStylesheets(); |
| 159 | 159 |
| 160 if (charnum > getNumberOfChars()) { | 160 if (charnum > getNumberOfChars()) { |
| 161 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 161 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 162 return SVGRect(); | 162 return SVGRect(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 return SVGTextQuery(renderer()).extentOfCharacter(charnum); | 165 return SVGTextQuery(renderer()).extentOfCharacter(charnum); |
| 166 } | 166 } |
| 167 | 167 |
| 168 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
es) | 168 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) |
| 169 { | 169 { |
| 170 document().updateLayoutIgnorePendingStylesheets(); | 170 document().updateLayoutIgnorePendingStylesheets(); |
| 171 | 171 |
| 172 if (charnum > getNumberOfChars()) { | 172 if (charnum > getNumberOfChars()) { |
| 173 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 173 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 174 return 0.0f; | 174 return 0.0f; |
| 175 } | 175 } |
| 176 | 176 |
| 177 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); | 177 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); |
| 178 } | 178 } |
| 179 | 179 |
| 180 int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point) | 180 int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point) |
| 181 { | 181 { |
| 182 document().updateLayoutIgnorePendingStylesheets(); | 182 document().updateLayoutIgnorePendingStylesheets(); |
| 183 return SVGTextQuery(renderer()).characterNumberAtPosition(point); | 183 return SVGTextQuery(renderer()).characterNumberAtPosition(point); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
xceptionState& es) | 186 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
xceptionState& exceptionState) |
| 187 { | 187 { |
| 188 unsigned numberOfChars = getNumberOfChars(); | 188 unsigned numberOfChars = getNumberOfChars(); |
| 189 if (charnum >= numberOfChars) { | 189 if (charnum >= numberOfChars) { |
| 190 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 190 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 | 193 |
| 194 if (nchars > numberOfChars - charnum) | 194 if (nchars > numberOfChars - charnum) |
| 195 nchars = numberOfChars - charnum; | 195 nchars = numberOfChars - charnum; |
| 196 | 196 |
| 197 ASSERT(document().frame()); | 197 ASSERT(document().frame()); |
| 198 | 198 |
| 199 // Find selection start | 199 // Find selection start |
| 200 VisiblePosition start(firstPositionInNode(const_cast<SVGTextContentElement*>
(this))); | 200 VisiblePosition start(firstPositionInNode(const_cast<SVGTextContentElement*>
(this))); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 SVGElement* element = toSVGElement(renderer->node()); | 297 SVGElement* element = toSVGElement(renderer->node()); |
| 298 ASSERT(element); | 298 ASSERT(element); |
| 299 | 299 |
| 300 if (!element->isTextContent()) | 300 if (!element->isTextContent()) |
| 301 return 0; | 301 return 0; |
| 302 | 302 |
| 303 return toSVGTextContentElement(element); | 303 return toSVGTextContentElement(element); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } | 306 } |
| OLD | NEW |