OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) | 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) |
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) | 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) |
5 * (C) 2001 Peter Kelly (pmk@post.com) | 5 * (C) 2001 Peter Kelly (pmk@post.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 m_ownerDocument->detachRange(this); | 122 m_ownerDocument->detachRange(this); |
123 m_ownerDocument = &document; | 123 m_ownerDocument = &document; |
124 m_start.setToStartOfNode(&document); | 124 m_start.setToStartOfNode(&document); |
125 m_end.setToStartOfNode(&document); | 125 m_end.setToStartOfNode(&document); |
126 m_ownerDocument->attachRange(this); | 126 m_ownerDocument->attachRange(this); |
127 } | 127 } |
128 | 128 |
129 Node* Range::startContainer(ExceptionState& exceptionState) const | 129 Node* Range::startContainer(ExceptionState& exceptionState) const |
130 { | 130 { |
131 if (!m_start.container()) { | 131 if (!m_start.container()) { |
132 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("startContainer", "Range", "The range has no container. Perhaps '
detatch()' has been invoked on this object?")); | 132 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
133 return 0; | 133 return 0; |
134 } | 134 } |
135 | 135 |
136 return m_start.container(); | 136 return m_start.container(); |
137 } | 137 } |
138 | 138 |
139 int Range::startOffset(ExceptionState& exceptionState) const | 139 int Range::startOffset(ExceptionState& exceptionState) const |
140 { | 140 { |
141 if (!m_start.container()) { | 141 if (!m_start.container()) { |
142 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("startOffset", "Range", "The range has no container. Perhaps 'det
atch()' has been invoked on this object?")); | 142 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
143 return 0; | 143 return 0; |
144 } | 144 } |
145 | 145 |
146 return m_start.offset(); | 146 return m_start.offset(); |
147 } | 147 } |
148 | 148 |
149 Node* Range::endContainer(ExceptionState& exceptionState) const | 149 Node* Range::endContainer(ExceptionState& exceptionState) const |
150 { | 150 { |
151 if (!m_start.container()) { | 151 if (!m_start.container()) { |
152 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("endContainer", "Range", "The range has no container. Perhaps 'de
tatch()' has been invoked on this object?")); | 152 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
153 return 0; | 153 return 0; |
154 } | 154 } |
155 | 155 |
156 return m_end.container(); | 156 return m_end.container(); |
157 } | 157 } |
158 | 158 |
159 int Range::endOffset(ExceptionState& exceptionState) const | 159 int Range::endOffset(ExceptionState& exceptionState) const |
160 { | 160 { |
161 if (!m_start.container()) { | 161 if (!m_start.container()) { |
162 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("endOffset", "Range", "The range has no container. Perhaps 'detat
ch()' has been invoked on this object?")); | 162 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
163 return 0; | 163 return 0; |
164 } | 164 } |
165 | 165 |
166 return m_end.offset(); | 166 return m_end.offset(); |
167 } | 167 } |
168 | 168 |
169 Node* Range::commonAncestorContainer(ExceptionState& exceptionState) const | 169 Node* Range::commonAncestorContainer(ExceptionState& exceptionState) const |
170 { | 170 { |
171 if (!m_start.container()) { | 171 if (!m_start.container()) { |
172 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("commonAncestorContainer", "Range", "The range has no container.
Perhaps 'detatch()' has been invoked on this object?")); | 172 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
173 return 0; | 173 return 0; |
174 } | 174 } |
175 | 175 |
176 return commonAncestorContainer(m_start.container(), m_end.container()); | 176 return commonAncestorContainer(m_start.container(), m_end.container()); |
177 } | 177 } |
178 | 178 |
179 Node* Range::commonAncestorContainer(Node* containerA, Node* containerB) | 179 Node* Range::commonAncestorContainer(Node* containerA, Node* containerB) |
180 { | 180 { |
181 for (Node* parentA = containerA; parentA; parentA = parentA->parentNode()) { | 181 for (Node* parentA = containerA; parentA; parentA = parentA->parentNode()) { |
182 for (Node* parentB = containerB; parentB; parentB = parentB->parentNode(
)) { | 182 for (Node* parentB = containerB; parentB; parentB = parentB->parentNode(
)) { |
183 if (parentA == parentB) | 183 if (parentA == parentB) |
184 return parentA; | 184 return parentA; |
185 } | 185 } |
186 } | 186 } |
187 return 0; | 187 return 0; |
188 } | 188 } |
189 | 189 |
190 bool Range::collapsed(ExceptionState& exceptionState) const | 190 bool Range::collapsed(ExceptionState& exceptionState) const |
191 { | 191 { |
192 if (!m_start.container()) { | 192 if (!m_start.container()) { |
193 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("collapsed", "Range", "The range has no container. Perhaps 'detat
ch()' has been invoked on this object?")); | 193 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
194 return 0; | 194 return 0; |
195 } | 195 } |
196 | 196 |
197 return m_start == m_end; | 197 return m_start == m_end; |
198 } | 198 } |
199 | 199 |
200 static inline bool checkForDifferentRootContainer(const RangeBoundaryPoint& star
t, const RangeBoundaryPoint& end) | 200 static inline bool checkForDifferentRootContainer(const RangeBoundaryPoint& star
t, const RangeBoundaryPoint& end) |
201 { | 201 { |
202 Node* endRootContainer = end.container(); | 202 Node* endRootContainer = end.container(); |
203 while (endRootContainer->parentNode()) | 203 while (endRootContainer->parentNode()) |
204 endRootContainer = endRootContainer->parentNode(); | 204 endRootContainer = endRootContainer->parentNode(); |
205 Node* startRootContainer = start.container(); | 205 Node* startRootContainer = start.container(); |
206 while (startRootContainer->parentNode()) | 206 while (startRootContainer->parentNode()) |
207 startRootContainer = startRootContainer->parentNode(); | 207 startRootContainer = startRootContainer->parentNode(); |
208 | 208 |
209 return startRootContainer != endRootContainer || (Range::compareBoundaryPoin
ts(start, end, ASSERT_NO_EXCEPTION) > 0); | 209 return startRootContainer != endRootContainer || (Range::compareBoundaryPoin
ts(start, end, ASSERT_NO_EXCEPTION) > 0); |
210 } | 210 } |
211 | 211 |
212 void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionState& excep
tionState) | 212 void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionState& excep
tionState) |
213 { | 213 { |
214 if (!m_start.container()) { | 214 if (!m_start.container()) { |
215 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("setStart", "Range", "The range has no container. Perhaps 'detatc
h()' has been invoked on this object?")); | 215 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
216 return; | 216 return; |
217 } | 217 } |
218 | 218 |
219 if (!refNode) { | 219 if (!refNode) { |
220 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 220 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
221 return; | 221 return; |
222 } | 222 } |
223 | 223 |
224 bool didMoveDocument = false; | 224 bool didMoveDocument = false; |
225 if (refNode->document() != m_ownerDocument) { | 225 if (refNode->document() != m_ownerDocument) { |
226 setDocument(refNode->document()); | 226 setDocument(refNode->document()); |
227 didMoveDocument = true; | 227 didMoveDocument = true; |
228 } | 228 } |
229 | 229 |
230 Node* childNode = checkNodeWOffset(refNode.get(), offset, exceptionState); | 230 Node* childNode = checkNodeWOffset(refNode.get(), offset, exceptionState); |
231 if (exceptionState.hadException()) | 231 if (exceptionState.hadException()) |
232 return; | 232 return; |
233 | 233 |
234 m_start.set(refNode, offset, childNode); | 234 m_start.set(refNode, offset, childNode); |
235 | 235 |
236 if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end)) | 236 if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end)) |
237 collapse(true, exceptionState); | 237 collapse(true, exceptionState); |
238 } | 238 } |
239 | 239 |
240 void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionState& excepti
onState) | 240 void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionState& excepti
onState) |
241 { | 241 { |
242 if (!m_start.container()) { | 242 if (!m_start.container()) { |
243 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("setEnd", "Range", "The range has no container. Perhaps 'detatch(
)' has been invoked on this object?")); | 243 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
244 return; | 244 return; |
245 } | 245 } |
246 | 246 |
247 if (!refNode) { | 247 if (!refNode) { |
248 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 248 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
249 return; | 249 return; |
250 } | 250 } |
251 | 251 |
252 bool didMoveDocument = false; | 252 bool didMoveDocument = false; |
253 if (refNode->document() != m_ownerDocument) { | 253 if (refNode->document() != m_ownerDocument) { |
(...skipping 19 matching lines...) Expand all Loading... |
273 | 273 |
274 void Range::setEnd(const Position& end, ExceptionState& exceptionState) | 274 void Range::setEnd(const Position& end, ExceptionState& exceptionState) |
275 { | 275 { |
276 Position parentAnchored = end.parentAnchoredEquivalent(); | 276 Position parentAnchored = end.parentAnchoredEquivalent(); |
277 setEnd(parentAnchored.containerNode(), parentAnchored.offsetInContainerNode(
), exceptionState); | 277 setEnd(parentAnchored.containerNode(), parentAnchored.offsetInContainerNode(
), exceptionState); |
278 } | 278 } |
279 | 279 |
280 void Range::collapse(bool toStart, ExceptionState& exceptionState) | 280 void Range::collapse(bool toStart, ExceptionState& exceptionState) |
281 { | 281 { |
282 if (!m_start.container()) { | 282 if (!m_start.container()) { |
283 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("collapse", "Range", "The range has no container. Perhaps 'detatc
h()' has been invoked on this object?")); | 283 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
284 return; | 284 return; |
285 } | 285 } |
286 | 286 |
287 if (toStart) | 287 if (toStart) |
288 m_end = m_start; | 288 m_end = m_start; |
289 else | 289 else |
290 m_start = m_end; | 290 m_start = m_end; |
291 } | 291 } |
292 | 292 |
293 bool Range::isPointInRange(Node* refNode, int offset, ExceptionState& exceptionS
tate) | 293 bool Range::isPointInRange(Node* refNode, int offset, ExceptionState& exceptionS
tate) |
294 { | 294 { |
295 if (!m_start.container()) { | 295 if (!m_start.container()) { |
296 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("isPointInRange", "Range", "The range has no container. Perhaps '
detatch()' has been invoked on this object?")); | 296 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
297 return false; | 297 return false; |
298 } | 298 } |
299 | 299 |
300 if (!refNode) { | 300 if (!refNode) { |
301 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest
Error); | 301 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest
Error); |
302 return false; | 302 return false; |
303 } | 303 } |
304 | 304 |
305 if (!refNode->inActiveDocument() || refNode->document() != m_ownerDocument)
{ | 305 if (!refNode->inActiveDocument() || refNode->document() != m_ownerDocument)
{ |
306 return false; | 306 return false; |
307 } | 307 } |
308 | 308 |
309 checkNodeWOffset(refNode, offset, exceptionState); | 309 checkNodeWOffset(refNode, offset, exceptionState); |
310 if (exceptionState.hadException()) | 310 if (exceptionState.hadException()) |
311 return false; | 311 return false; |
312 | 312 |
313 return compareBoundaryPoints(refNode, offset, m_start.container(), m_start.o
ffset(), exceptionState) >= 0 && !exceptionState.hadException() | 313 return compareBoundaryPoints(refNode, offset, m_start.container(), m_start.o
ffset(), exceptionState) >= 0 && !exceptionState.hadException() |
314 && compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offse
t(), exceptionState) <= 0 && !exceptionState.hadException(); | 314 && compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offse
t(), exceptionState) <= 0 && !exceptionState.hadException(); |
315 } | 315 } |
316 | 316 |
317 short Range::comparePoint(Node* refNode, int offset, ExceptionState& exceptionSt
ate) const | 317 short Range::comparePoint(Node* refNode, int offset, ExceptionState& exceptionSt
ate) const |
318 { | 318 { |
319 // http://developer.mozilla.org/en/docs/DOM:range.comparePoint | 319 // http://developer.mozilla.org/en/docs/DOM:range.comparePoint |
320 // This method returns -1, 0 or 1 depending on if the point described by the | 320 // This method returns -1, 0 or 1 depending on if the point described by the |
321 // refNode node and an offset within the node is before, same as, or after t
he range respectively. | 321 // refNode node and an offset within the node is before, same as, or after t
he range respectively. |
322 | 322 |
323 if (!m_start.container()) { | 323 if (!m_start.container()) { |
324 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("comparePoint", "Range", "The range has no container. Perhaps 'de
tatch()' has been invoked on this object?")); | 324 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
325 return 0; | 325 return 0; |
326 } | 326 } |
327 | 327 |
328 if (!refNode) { | 328 if (!refNode) { |
329 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest
Error); | 329 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest
Error); |
330 return 0; | 330 return 0; |
331 } | 331 } |
332 | 332 |
333 if (!refNode->inActiveDocument() || refNode->document() != m_ownerDocument)
{ | 333 if (!refNode->inActiveDocument() || refNode->document() != m_ownerDocument)
{ |
334 exceptionState.throwUninformativeAndGenericDOMException(WrongDocumentErr
or); | 334 exceptionState.throwUninformativeAndGenericDOMException(WrongDocumentErr
or); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 397 } |
398 // starts at or after the range start | 398 // starts at or after the range start |
399 if (comparePoint(parentNode, nodeIndex + 1, exceptionState) > 0) // ends aft
er the range | 399 if (comparePoint(parentNode, nodeIndex + 1, exceptionState) > 0) // ends aft
er the range |
400 return NODE_AFTER; | 400 return NODE_AFTER; |
401 return NODE_INSIDE; // ends inside the range | 401 return NODE_INSIDE; // ends inside the range |
402 } | 402 } |
403 | 403 |
404 short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, Exc
eptionState& exceptionState) const | 404 short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, Exc
eptionState& exceptionState) const |
405 { | 405 { |
406 if (!m_start.container()) { | 406 if (!m_start.container()) { |
407 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("compareBoundaryPoints", "Range", "The range has no container. Pe
rhaps 'detatch()' has been invoked on this object?")); | 407 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
408 return 0; | 408 return 0; |
409 } | 409 } |
410 | 410 |
411 if (!sourceRange) { | 411 if (!sourceRange) { |
412 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 412 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
413 return 0; | 413 return 0; |
414 } | 414 } |
415 | 415 |
416 Node* thisCont = commonAncestorContainer(exceptionState); | 416 Node* thisCont = commonAncestorContainer(exceptionState); |
417 if (exceptionState.hadException()) | 417 if (exceptionState.hadException()) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 550 } |
551 | 551 |
552 bool Range::boundaryPointsValid() const | 552 bool Range::boundaryPointsValid() const |
553 { | 553 { |
554 TrackExceptionState exceptionState; | 554 TrackExceptionState exceptionState; |
555 return m_start.container() && compareBoundaryPoints(m_start, m_end, exceptio
nState) <= 0 && !exceptionState.hadException(); | 555 return m_start.container() && compareBoundaryPoints(m_start, m_end, exceptio
nState) <= 0 && !exceptionState.hadException(); |
556 } | 556 } |
557 | 557 |
558 void Range::deleteContents(ExceptionState& exceptionState) | 558 void Range::deleteContents(ExceptionState& exceptionState) |
559 { | 559 { |
560 checkDeleteExtract("deleteContents", exceptionState); | 560 checkDeleteExtract(exceptionState); |
561 if (exceptionState.hadException()) | 561 if (exceptionState.hadException()) |
562 return; | 562 return; |
563 | 563 |
564 processContents(DELETE_CONTENTS, exceptionState); | 564 processContents(DELETE_CONTENTS, exceptionState); |
565 } | 565 } |
566 | 566 |
567 bool Range::intersectsNode(Node* refNode, ExceptionState& exceptionState) | 567 bool Range::intersectsNode(Node* refNode, ExceptionState& exceptionState) |
568 { | 568 { |
569 // http://developer.mozilla.org/en/docs/DOM:range.intersectsNode | 569 // http://developer.mozilla.org/en/docs/DOM:range.intersectsNode |
570 // Returns a bool if the node intersects the range. | 570 // Returns a bool if the node intersects the range. |
571 | 571 |
572 // Throw exception if the range is already detached. | 572 // Throw exception if the range is already detached. |
573 if (!m_start.container()) { | 573 if (!m_start.container()) { |
574 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("intersectsNode", "Range", "The range has no container. Perhaps '
detatch()' has been invoked on this object?")); | 574 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
575 return false; | 575 return false; |
576 } | 576 } |
577 if (!refNode) { | 577 if (!refNode) { |
578 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 578 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
579 return false; | 579 return false; |
580 } | 580 } |
581 | 581 |
582 if (!refNode->inActiveDocument() || refNode->document() != m_ownerDocument)
{ | 582 if (!refNode->inActiveDocument() || refNode->document() != m_ownerDocument)
{ |
583 // Firefox doesn't throw an exception for these cases; it returns false. | 583 // Firefox doesn't throw an exception for these cases; it returns false. |
584 return false; | 584 return false; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 } | 919 } |
920 } | 920 } |
921 firstChildInAncestorToProcess = direction == ProcessContentsForward ? an
cestor->nextSibling() : ancestor->previousSibling(); | 921 firstChildInAncestorToProcess = direction == ProcessContentsForward ? an
cestor->nextSibling() : ancestor->previousSibling(); |
922 } | 922 } |
923 | 923 |
924 return clonedContainer.release(); | 924 return clonedContainer.release(); |
925 } | 925 } |
926 | 926 |
927 PassRefPtr<DocumentFragment> Range::extractContents(ExceptionState& exceptionSta
te) | 927 PassRefPtr<DocumentFragment> Range::extractContents(ExceptionState& exceptionSta
te) |
928 { | 928 { |
929 checkDeleteExtract("extractContents", exceptionState); | 929 checkDeleteExtract(exceptionState); |
930 if (exceptionState.hadException()) | 930 if (exceptionState.hadException()) |
931 return 0; | 931 return 0; |
932 | 932 |
933 return processContents(EXTRACT_CONTENTS, exceptionState); | 933 return processContents(EXTRACT_CONTENTS, exceptionState); |
934 } | 934 } |
935 | 935 |
936 PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionState& exceptionState
) | 936 PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionState& exceptionState
) |
937 { | 937 { |
938 if (!m_start.container()) { | 938 if (!m_start.container()) { |
939 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("cloneContents", "Range", "The range has no container. Perhaps 'd
etatch()' has been invoked on this object?")); | 939 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
940 return 0; | 940 return 0; |
941 } | 941 } |
942 | 942 |
943 return processContents(CLONE_CONTENTS, exceptionState); | 943 return processContents(CLONE_CONTENTS, exceptionState); |
944 } | 944 } |
945 | 945 |
946 void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& exceptionSta
te) | 946 void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& exceptionSta
te) |
947 { | 947 { |
948 RefPtr<Node> newNode = prpNewNode; | 948 RefPtr<Node> newNode = prpNewNode; |
949 | 949 |
950 if (!m_start.container()) { | 950 if (!m_start.container()) { |
951 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("insertNode", "Range", "The range has no container. Perhaps 'deta
tch()' has been invoked on this object?")); | 951 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
952 return; | 952 return; |
953 } | 953 } |
954 | 954 |
955 if (!newNode) { | 955 if (!newNode) { |
956 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 956 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
957 return; | 957 return; |
958 } | 958 } |
959 | 959 |
960 // HierarchyRequestError: Raised if the container of the start of the Range
is of a type that | 960 // HierarchyRequestError: Raised if the container of the start of the Range
is of a type that |
961 // does not allow children of the type of newNode or if newNode is an ancest
or of the container. | 961 // does not allow children of the type of newNode or if newNode is an ancest
or of the container. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 // Note that m_start.offset() may have changed as a result of container-
>insertBefore, | 1053 // Note that m_start.offset() may have changed as a result of container-
>insertBefore, |
1054 // when the node we are inserting comes before the range in the same con
tainer. | 1054 // when the node we are inserting comes before the range in the same con
tainer. |
1055 if (collapsed && numNewChildren) | 1055 if (collapsed && numNewChildren) |
1056 m_end.set(m_start.container(), m_start.offset() + numNewChildren, la
stChild.get()); | 1056 m_end.set(m_start.container(), m_start.offset() + numNewChildren, la
stChild.get()); |
1057 } | 1057 } |
1058 } | 1058 } |
1059 | 1059 |
1060 String Range::toString(ExceptionState& exceptionState) const | 1060 String Range::toString(ExceptionState& exceptionState) const |
1061 { | 1061 { |
1062 if (!m_start.container()) { | 1062 if (!m_start.container()) { |
1063 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("toString", "Range", "The range has no container. Perhaps 'detatc
h()' has been invoked on this object?")); | 1063 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1064 return String(); | 1064 return String(); |
1065 } | 1065 } |
1066 | 1066 |
1067 StringBuilder builder; | 1067 StringBuilder builder; |
1068 | 1068 |
1069 Node* pastLast = pastLastNode(); | 1069 Node* pastLast = pastLastNode(); |
1070 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { | 1070 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { |
1071 if (n->nodeType() == Node::TEXT_NODE || n->nodeType() == Node::CDATA_SEC
TION_NODE) { | 1071 if (n->nodeType() == Node::TEXT_NODE || n->nodeType() == Node::CDATA_SEC
TION_NODE) { |
1072 String data = toCharacterData(n)->data(); | 1072 String data = toCharacterData(n)->data(); |
1073 int length = data.length(); | 1073 int length = data.length(); |
(...skipping 19 matching lines...) Expand all Loading... |
1093 // We need to update layout, since plainText uses line boxes in the render t
ree. | 1093 // We need to update layout, since plainText uses line boxes in the render t
ree. |
1094 // FIXME: As with innerText, we'd like this to work even if there are no ren
der objects. | 1094 // FIXME: As with innerText, we'd like this to work even if there are no ren
der objects. |
1095 m_start.container()->document().updateLayout(); | 1095 m_start.container()->document().updateLayout(); |
1096 | 1096 |
1097 return plainText(this); | 1097 return plainText(this); |
1098 } | 1098 } |
1099 | 1099 |
1100 PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& marku
p, ExceptionState& exceptionState) | 1100 PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& marku
p, ExceptionState& exceptionState) |
1101 { | 1101 { |
1102 if (!m_start.container()) { | 1102 if (!m_start.container()) { |
1103 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("createContextualFragment", "Range", "The range has no container.
Perhaps 'detatch()' has been invoked on this object?")); | 1103 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1104 return 0; | 1104 return 0; |
1105 } | 1105 } |
1106 | 1106 |
1107 Node* element = m_start.container()->isElementNode() ? m_start.container() :
m_start.container()->parentNode(); | 1107 Node* element = m_start.container()->isElementNode() ? m_start.container() :
m_start.container()->parentNode(); |
1108 if (!element || !element->isHTMLElement()) { | 1108 if (!element || !element->isHTMLElement()) { |
1109 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::f
ailedToExecute("createContextualFragment", "Range", "The range's container must
be an HTML element.")); | 1109 exceptionState.throwDOMException(NotSupportedError, "The range's contain
er must be an HTML element."); |
1110 return 0; | 1110 return 0; |
1111 } | 1111 } |
1112 | 1112 |
1113 RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup
, toHTMLElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted, excep
tionState); | 1113 RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup
, toHTMLElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted, excep
tionState); |
1114 if (!fragment) | 1114 if (!fragment) |
1115 return 0; | 1115 return 0; |
1116 | 1116 |
1117 return fragment.release(); | 1117 return fragment.release(); |
1118 } | 1118 } |
1119 | 1119 |
1120 | 1120 |
1121 void Range::detach(ExceptionState& exceptionState) | 1121 void Range::detach(ExceptionState& exceptionState) |
1122 { | 1122 { |
1123 // Check first to see if we've already detached: | 1123 // Check first to see if we've already detached: |
1124 if (!m_start.container()) { | 1124 if (!m_start.container()) { |
1125 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("detach", "Range", "The range has no container. Perhaps 'detatch(
)' has been invoked on this object?")); | 1125 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1126 return; | 1126 return; |
1127 } | 1127 } |
1128 | 1128 |
1129 m_ownerDocument->detachRange(this); | 1129 m_ownerDocument->detachRange(this); |
1130 | 1130 |
1131 m_start.clear(); | 1131 m_start.clear(); |
1132 m_end.clear(); | 1132 m_end.clear(); |
1133 } | 1133 } |
1134 | 1134 |
1135 Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionState& exceptionStat
e) const | 1135 Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionState& exceptionStat
e) const |
(...skipping 24 matching lines...) Expand all Loading... |
1160 Node* childBefore = n->childNode(offset - 1); | 1160 Node* childBefore = n->childNode(offset - 1); |
1161 if (!childBefore) | 1161 if (!childBefore) |
1162 exceptionState.throwUninformativeAndGenericDOMException(IndexSiz
eError); | 1162 exceptionState.throwUninformativeAndGenericDOMException(IndexSiz
eError); |
1163 return childBefore; | 1163 return childBefore; |
1164 } | 1164 } |
1165 } | 1165 } |
1166 ASSERT_NOT_REACHED(); | 1166 ASSERT_NOT_REACHED(); |
1167 return 0; | 1167 return 0; |
1168 } | 1168 } |
1169 | 1169 |
1170 void Range::checkNodeBA(Node* n, const String& methodName, ExceptionState& excep
tionState) const | 1170 void Range::checkNodeBA(Node* n, ExceptionState& exceptionState) const |
1171 { | 1171 { |
1172 if (!m_start.container()) { | 1172 if (!m_start.container()) { |
1173 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute(methodName, "Range", "The range has no container. Perhaps 'detatc
h()' has been invoked on this object?")); | 1173 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1174 return; | 1174 return; |
1175 } | 1175 } |
1176 | 1176 |
1177 if (!n) { | 1177 if (!n) { |
1178 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 1178 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
1179 return; | 1179 return; |
1180 } | 1180 } |
1181 | 1181 |
1182 // InvalidNodeTypeError: Raised if the root container of refNode is not an | 1182 // InvalidNodeTypeError: Raised if the root container of refNode is not an |
1183 // Attr, Document, DocumentFragment or ShadowRoot node, or part of a SVG sha
dow DOM tree, | 1183 // Attr, Document, DocumentFragment or ShadowRoot node, or part of a SVG sha
dow DOM tree, |
1184 // or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity,
or Notation node. | 1184 // or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity,
or Notation node. |
1185 | 1185 |
1186 if (!n->parentNode()) { | 1186 if (!n->parentNode()) { |
1187 exceptionState.throwDOMException(InvalidNodeTypeError, ExceptionMessages
::failedToExecute(methodName, "Range", "the given Node has no parent.")); | 1187 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h
as no parent."); |
1188 return; | 1188 return; |
1189 } | 1189 } |
1190 | 1190 |
1191 switch (n->nodeType()) { | 1191 switch (n->nodeType()) { |
1192 case Node::ATTRIBUTE_NODE: | 1192 case Node::ATTRIBUTE_NODE: |
1193 case Node::DOCUMENT_FRAGMENT_NODE: | 1193 case Node::DOCUMENT_FRAGMENT_NODE: |
1194 case Node::DOCUMENT_NODE: | 1194 case Node::DOCUMENT_NODE: |
1195 case Node::ENTITY_NODE: | 1195 case Node::ENTITY_NODE: |
1196 case Node::NOTATION_NODE: | 1196 case Node::NOTATION_NODE: |
1197 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeT
ypeError); | 1197 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeT
ypeError); |
(...skipping 27 matching lines...) Expand all Loading... |
1225 case Node::TEXT_NODE: | 1225 case Node::TEXT_NODE: |
1226 case Node::XPATH_NAMESPACE_NODE: | 1226 case Node::XPATH_NAMESPACE_NODE: |
1227 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeT
ypeError); | 1227 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeT
ypeError); |
1228 return; | 1228 return; |
1229 } | 1229 } |
1230 } | 1230 } |
1231 | 1231 |
1232 PassRefPtr<Range> Range::cloneRange(ExceptionState& exceptionState) const | 1232 PassRefPtr<Range> Range::cloneRange(ExceptionState& exceptionState) const |
1233 { | 1233 { |
1234 if (!m_start.container()) { | 1234 if (!m_start.container()) { |
1235 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("cloneRange", "Range", "The range has no container. Perhaps 'deta
tch()' has been invoked on this object?")); | 1235 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1236 return 0; | 1236 return 0; |
1237 } | 1237 } |
1238 | 1238 |
1239 return Range::create(*m_ownerDocument.get(), m_start.container(), m_start.of
fset(), m_end.container(), m_end.offset()); | 1239 return Range::create(*m_ownerDocument.get(), m_start.container(), m_start.of
fset(), m_end.container(), m_end.offset()); |
1240 } | 1240 } |
1241 | 1241 |
1242 void Range::setStartAfter(Node* refNode, ExceptionState& exceptionState) | 1242 void Range::setStartAfter(Node* refNode, ExceptionState& exceptionState) |
1243 { | 1243 { |
1244 checkNodeBA(refNode, "setStartAfter", exceptionState); | 1244 checkNodeBA(refNode, exceptionState); |
1245 if (exceptionState.hadException()) | 1245 if (exceptionState.hadException()) |
1246 return; | 1246 return; |
1247 | 1247 |
1248 setStart(refNode->parentNode(), refNode->nodeIndex() + 1, exceptionState); | 1248 setStart(refNode->parentNode(), refNode->nodeIndex() + 1, exceptionState); |
1249 } | 1249 } |
1250 | 1250 |
1251 void Range::setEndBefore(Node* refNode, ExceptionState& exceptionState) | 1251 void Range::setEndBefore(Node* refNode, ExceptionState& exceptionState) |
1252 { | 1252 { |
1253 checkNodeBA(refNode, "setEndBefore", exceptionState); | 1253 checkNodeBA(refNode, exceptionState); |
1254 if (exceptionState.hadException()) | 1254 if (exceptionState.hadException()) |
1255 return; | 1255 return; |
1256 | 1256 |
1257 setEnd(refNode->parentNode(), refNode->nodeIndex(), exceptionState); | 1257 setEnd(refNode->parentNode(), refNode->nodeIndex(), exceptionState); |
1258 } | 1258 } |
1259 | 1259 |
1260 void Range::setEndAfter(Node* refNode, ExceptionState& exceptionState) | 1260 void Range::setEndAfter(Node* refNode, ExceptionState& exceptionState) |
1261 { | 1261 { |
1262 checkNodeBA(refNode, "setEndAfter", exceptionState); | 1262 checkNodeBA(refNode, exceptionState); |
1263 if (exceptionState.hadException()) | 1263 if (exceptionState.hadException()) |
1264 return; | 1264 return; |
1265 | 1265 |
1266 setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, exceptionState); | 1266 setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, exceptionState); |
1267 } | 1267 } |
1268 | 1268 |
1269 void Range::selectNode(Node* refNode, ExceptionState& exceptionState) | 1269 void Range::selectNode(Node* refNode, ExceptionState& exceptionState) |
1270 { | 1270 { |
1271 if (!m_start.container()) { | 1271 if (!m_start.container()) { |
1272 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("selectNode", "Range", "The range has no container. Perhaps 'deta
tch()' has been invoked on this object?")); | 1272 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1273 return; | 1273 return; |
1274 } | 1274 } |
1275 | 1275 |
1276 if (!refNode) { | 1276 if (!refNode) { |
1277 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 1277 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
1278 return; | 1278 return; |
1279 } | 1279 } |
1280 | 1280 |
1281 if (!refNode->parentNode()) { | 1281 if (!refNode->parentNode()) { |
1282 exceptionState.throwDOMException(InvalidNodeTypeError, ExceptionMessages
::failedToExecute("selectNode", "Range", "the given Node has no parent.")); | 1282 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h
as no parent."); |
1283 return; | 1283 return; |
1284 } | 1284 } |
1285 | 1285 |
1286 // InvalidNodeTypeError: Raised if an ancestor of refNode is an Entity, Nota
tion or | 1286 // InvalidNodeTypeError: Raised if an ancestor of refNode is an Entity, Nota
tion or |
1287 // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRo
ot, Attr, Entity, or Notation | 1287 // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRo
ot, Attr, Entity, or Notation |
1288 // node. | 1288 // node. |
1289 for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode(
)) { | 1289 for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode(
)) { |
1290 switch (anc->nodeType()) { | 1290 switch (anc->nodeType()) { |
1291 case Node::ATTRIBUTE_NODE: | 1291 case Node::ATTRIBUTE_NODE: |
1292 case Node::CDATA_SECTION_NODE: | 1292 case Node::CDATA_SECTION_NODE: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 if (m_ownerDocument != refNode->document()) | 1327 if (m_ownerDocument != refNode->document()) |
1328 setDocument(refNode->document()); | 1328 setDocument(refNode->document()); |
1329 | 1329 |
1330 setStartBefore(refNode); | 1330 setStartBefore(refNode); |
1331 setEndAfter(refNode); | 1331 setEndAfter(refNode); |
1332 } | 1332 } |
1333 | 1333 |
1334 void Range::selectNodeContents(Node* refNode, ExceptionState& exceptionState) | 1334 void Range::selectNodeContents(Node* refNode, ExceptionState& exceptionState) |
1335 { | 1335 { |
1336 if (!m_start.container()) { | 1336 if (!m_start.container()) { |
1337 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("selectNodeContents", "Range", "The range has no container. Perha
ps 'detatch()' has been invoked on this object?")); | 1337 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1338 return; | 1338 return; |
1339 } | 1339 } |
1340 | 1340 |
1341 if (!refNode) { | 1341 if (!refNode) { |
1342 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 1342 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
1343 return; | 1343 return; |
1344 } | 1344 } |
1345 | 1345 |
1346 // InvalidNodeTypeError: Raised if refNode or an ancestor of refNode is an E
ntity, Notation | 1346 // InvalidNodeTypeError: Raised if refNode or an ancestor of refNode is an E
ntity, Notation |
1347 // or DocumentType node. | 1347 // or DocumentType node. |
(...skipping 22 matching lines...) Expand all Loading... |
1370 | 1370 |
1371 m_start.setToStartOfNode(refNode); | 1371 m_start.setToStartOfNode(refNode); |
1372 m_end.setToEndOfNode(refNode); | 1372 m_end.setToEndOfNode(refNode); |
1373 } | 1373 } |
1374 | 1374 |
1375 void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionState& exc
eptionState) | 1375 void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionState& exc
eptionState) |
1376 { | 1376 { |
1377 RefPtr<Node> newParent = passNewParent; | 1377 RefPtr<Node> newParent = passNewParent; |
1378 | 1378 |
1379 if (!m_start.container()) { | 1379 if (!m_start.container()) { |
1380 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("surroundContents", "Range", "The range has no container. Perhaps
'detatch()' has been invoked on this object?")); | 1380 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1381 return; | 1381 return; |
1382 } | 1382 } |
1383 | 1383 |
1384 if (!newParent) { | 1384 if (!newParent) { |
1385 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); | 1385 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
1386 return; | 1386 return; |
1387 } | 1387 } |
1388 | 1388 |
1389 // InvalidNodeTypeError: Raised if node is an Attr, Entity, DocumentType, No
tation, | 1389 // InvalidNodeTypeError: Raised if node is an Attr, Entity, DocumentType, No
tation, |
1390 // Document, or DocumentFragment node. | 1390 // Document, or DocumentFragment node. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 if (exceptionState.hadException()) | 1451 if (exceptionState.hadException()) |
1452 return; | 1452 return; |
1453 newParent->appendChild(fragment.release(), exceptionState); | 1453 newParent->appendChild(fragment.release(), exceptionState); |
1454 if (exceptionState.hadException()) | 1454 if (exceptionState.hadException()) |
1455 return; | 1455 return; |
1456 selectNode(newParent.get(), exceptionState); | 1456 selectNode(newParent.get(), exceptionState); |
1457 } | 1457 } |
1458 | 1458 |
1459 void Range::setStartBefore(Node* refNode, ExceptionState& exceptionState) | 1459 void Range::setStartBefore(Node* refNode, ExceptionState& exceptionState) |
1460 { | 1460 { |
1461 checkNodeBA(refNode, "setStartBefore", exceptionState); | 1461 checkNodeBA(refNode, exceptionState); |
1462 if (exceptionState.hadException()) | 1462 if (exceptionState.hadException()) |
1463 return; | 1463 return; |
1464 | 1464 |
1465 setStart(refNode->parentNode(), refNode->nodeIndex(), exceptionState); | 1465 setStart(refNode->parentNode(), refNode->nodeIndex(), exceptionState); |
1466 } | 1466 } |
1467 | 1467 |
1468 void Range::checkDeleteExtract(const String& methodName, ExceptionState& excepti
onState) | 1468 void Range::checkDeleteExtract(ExceptionState& exceptionState) |
1469 { | 1469 { |
1470 if (!m_start.container()) { | 1470 if (!m_start.container()) { |
1471 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute(methodName, "Range", "The range has no container. Perhaps 'detatc
h()' has been invoked on this object?")); | 1471 exceptionState.throwDOMException(InvalidStateError, "The range has no co
ntainer. Perhaps 'detatch()' has been invoked on this object?"); |
1472 return; | 1472 return; |
1473 } | 1473 } |
1474 | 1474 |
1475 if (!commonAncestorContainer(exceptionState) || exceptionState.hadException(
)) | 1475 if (!commonAncestorContainer(exceptionState) || exceptionState.hadException(
)) |
1476 return; | 1476 return; |
1477 | 1477 |
1478 Node* pastLast = pastLastNode(); | 1478 Node* pastLast = pastLastNode(); |
1479 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { | 1479 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { |
1480 if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) { | 1480 if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) { |
1481 exceptionState.throwUninformativeAndGenericDOMException(HierarchyReq
uestError); | 1481 exceptionState.throwUninformativeAndGenericDOMException(HierarchyReq
uestError); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 | 1905 |
1906 void showTree(const WebCore::Range* range) | 1906 void showTree(const WebCore::Range* range) |
1907 { | 1907 { |
1908 if (range && range->boundaryPointsValid()) { | 1908 if (range && range->boundaryPointsValid()) { |
1909 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1909 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1910 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1910 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1911 } | 1911 } |
1912 } | 1912 } |
1913 | 1913 |
1914 #endif | 1914 #endif |
OLD | NEW |