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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 return compareBoundaryPoints(refNode, offset, m_start.container(), m_start.o
ffset(), exceptionState) >= 0 && !exceptionState.hadException() | 238 return compareBoundaryPoints(refNode, offset, m_start.container(), m_start.o
ffset(), exceptionState) >= 0 && !exceptionState.hadException() |
239 && compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offse
t(), exceptionState) <= 0 && !exceptionState.hadException(); | 239 && compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offse
t(), exceptionState) <= 0 && !exceptionState.hadException(); |
240 } | 240 } |
241 | 241 |
242 short Range::comparePoint(Node* refNode, int offset, ExceptionState& exceptionSt
ate) const | 242 short Range::comparePoint(Node* refNode, int offset, ExceptionState& exceptionSt
ate) const |
243 { | 243 { |
244 // http://developer.mozilla.org/en/docs/DOM:range.comparePoint | 244 // http://developer.mozilla.org/en/docs/DOM:range.comparePoint |
245 // This method returns -1, 0 or 1 depending on if the point described by the | 245 // This method returns -1, 0 or 1 depending on if the point described by the |
246 // refNode node and an offset within the node is before, same as, or after t
he range respectively. | 246 // refNode node and an offset within the node is before, same as, or after t
he range respectively. |
247 | 247 |
248 if (!refNode) { | |
249 exceptionState.throwDOMException(HierarchyRequestError, "The node provid
ed was null."); | |
250 return 0; | |
251 } | |
252 | |
253 if (!refNode->inActiveDocument()) { | 248 if (!refNode->inActiveDocument()) { |
254 exceptionState.throwDOMException(WrongDocumentError, "The node provided
is not in an active document."); | 249 exceptionState.throwDOMException(WrongDocumentError, "The node provided
is not in an active document."); |
255 return 0; | 250 return 0; |
256 } | 251 } |
257 | 252 |
258 if (refNode->document() != m_ownerDocument) { | 253 if (refNode->document() != m_ownerDocument) { |
259 exceptionState.throwDOMException(WrongDocumentError, "The node provided
is not in this Range's Document."); | 254 exceptionState.throwDOMException(WrongDocumentError, "The node provided
is not in this Range's Document."); |
260 return 0; | 255 return 0; |
261 } | 256 } |
262 | 257 |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 | 1704 |
1710 void showTree(const blink::Range* range) | 1705 void showTree(const blink::Range* range) |
1711 { | 1706 { |
1712 if (range && range->boundaryPointsValid()) { | 1707 if (range && range->boundaryPointsValid()) { |
1713 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1708 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1714 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1709 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1715 } | 1710 } |
1716 } | 1711 } |
1717 | 1712 |
1718 #endif | 1713 #endif |
OLD | NEW |