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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); | 103 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
104 return 0.0f; | 104 return 0.0f; |
105 } | 105 } |
106 | 106 |
107 if (nchars > numberOfChars - charnum) | 107 if (nchars > numberOfChars - charnum) |
108 nchars = numberOfChars - charnum; | 108 nchars = numberOfChars - charnum; |
109 | 109 |
110 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); | 110 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); |
111 } | 111 } |
112 | 112 |
113 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti onState& exceptionState) | 113 PassRefPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionOfChar(unsign ed charnum, ExceptionState& exceptionState) |
114 { | 114 { |
115 document().updateLayoutIgnorePendingStylesheets(); | 115 document().updateLayoutIgnorePendingStylesheets(); |
116 | 116 |
117 if (charnum > getNumberOfChars()) { | 117 if (charnum > getNumberOfChars()) { |
118 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); | 118 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
119 return FloatPoint(); | 119 return 0; |
120 } | 120 } |
121 | 121 |
122 return SVGTextQuery(renderer()).startPositionOfCharacter(charnum); | 122 FloatPoint point = SVGTextQuery(renderer()).startPositionOfCharacter(charnum ); |
123 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val); | |
123 } | 124 } |
124 | 125 |
125 SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, Exception State& exceptionState) | 126 PassRefPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionState& exceptionState) |
126 { | 127 { |
127 document().updateLayoutIgnorePendingStylesheets(); | 128 document().updateLayoutIgnorePendingStylesheets(); |
128 | 129 |
129 if (charnum > getNumberOfChars()) { | 130 if (charnum > getNumberOfChars()) { |
130 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); | 131 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
131 return FloatPoint(); | 132 return 0; |
132 } | 133 } |
133 | 134 |
134 return SVGTextQuery(renderer()).endPositionOfCharacter(charnum); | 135 FloatPoint point = SVGTextQuery(renderer()).endPositionOfCharacter(charnum); |
136 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val); | |
135 } | 137 } |
136 | 138 |
137 PassRefPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(unsigned charn um, ExceptionState& exceptionState) | 139 PassRefPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(unsigned charn um, ExceptionState& exceptionState) |
138 { | 140 { |
139 document().updateLayoutIgnorePendingStylesheets(); | 141 document().updateLayoutIgnorePendingStylesheets(); |
140 | 142 |
141 if (charnum > getNumberOfChars()) { | 143 if (charnum > getNumberOfChars()) { |
142 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); | 144 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
143 return 0; | 145 return 0; |
144 } | 146 } |
145 | 147 |
146 FloatRect rect = SVGTextQuery(renderer()).extentOfCharacter(charnum); | 148 FloatRect rect = SVGTextQuery(renderer()).extentOfCharacter(charnum); |
147 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal ); | 149 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal ); |
148 } | 150 } |
149 | 151 |
150 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& exceptionState) | 152 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& exceptionState) |
151 { | 153 { |
152 document().updateLayoutIgnorePendingStylesheets(); | 154 document().updateLayoutIgnorePendingStylesheets(); |
153 | 155 |
154 if (charnum > getNumberOfChars()) { | 156 if (charnum > getNumberOfChars()) { |
155 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); | 157 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
156 return 0.0f; | 158 return 0.0f; |
157 } | 159 } |
158 | 160 |
159 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); | 161 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); |
160 } | 162 } |
161 | 163 |
162 int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point) | 164 int SVGTextContentElement::getCharNumAtPosition(PassRefPtr<SVGPointTearOff> poin t, ExceptionState& exceptionState) |
163 { | 165 { |
166 // FIXME | |
haraken
2014/01/17 11:50:18
Add some description.
kouhei (in TOK)
2014/01/20 01:10:26
Removed. This was a temporary fix needed before nb
| |
167 if (!point) { | |
168 exceptionState.throwTypeError("The argument can't be null."); | |
169 return 0; | |
170 } | |
171 | |
164 document().updateLayoutIgnorePendingStylesheets(); | 172 document().updateLayoutIgnorePendingStylesheets(); |
165 return SVGTextQuery(renderer()).characterNumberAtPosition(point); | 173 return SVGTextQuery(renderer()).characterNumberAtPosition(point->target()->v alue()); |
166 } | 174 } |
167 | 175 |
168 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E xceptionState& exceptionState) | 176 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E xceptionState& exceptionState) |
169 { | 177 { |
170 unsigned numberOfChars = getNumberOfChars(); | 178 unsigned numberOfChars = getNumberOfChars(); |
171 if (charnum >= numberOfChars) { | 179 if (charnum >= numberOfChars) { |
172 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); | 180 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
173 return; | 181 return; |
174 } | 182 } |
175 | 183 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 SVGElement* element = toSVGElement(renderer->node()); | 285 SVGElement* element = toSVGElement(renderer->node()); |
278 ASSERT(element); | 286 ASSERT(element); |
279 | 287 |
280 if (!element->isTextContent()) | 288 if (!element->isTextContent()) |
281 return 0; | 289 return 0; |
282 | 290 |
283 return toSVGTextContentElement(element); | 291 return toSVGTextContentElement(element); |
284 } | 292 } |
285 | 293 |
286 } | 294 } |
OLD | NEW |