Chromium Code Reviews| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 if (comparePoint(parentNode, nodeIndex + 1, exceptionState) > 0) // ends after the range | 314 if (comparePoint(parentNode, nodeIndex + 1, exceptionState) > 0) // ends after the range |
| 315 return NODE_BEFORE_AND_AFTER; | 315 return NODE_BEFORE_AND_AFTER; |
| 316 return NODE_BEFORE; // ends before or in the range | 316 return NODE_BEFORE; // ends before or in the range |
| 317 } | 317 } |
| 318 // starts at or after the range start | 318 // starts at or after the range start |
| 319 if (comparePoint(parentNode, nodeIndex + 1, exceptionState) > 0) // ends aft er the range | 319 if (comparePoint(parentNode, nodeIndex + 1, exceptionState) > 0) // ends aft er the range |
| 320 return NODE_AFTER; | 320 return NODE_AFTER; |
| 321 return NODE_INSIDE; // ends inside the range | 321 return NODE_INSIDE; // ends inside the range |
| 322 } | 322 } |
| 323 | 323 |
| 324 short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, Exc eptionState& exceptionState) const | 324 short Range::compareBoundaryPoints(CompareHow how, const PassRefPtrWillBeRawPtr< Range> sourceRange, ExceptionState& exceptionState) const |
|
Yuta Kitamura
2014/07/22 06:03:39
nit: const seems unnecessary.
Just curious, TypeC
kangil_
2014/07/22 08:41:49
IMHO, const is generally good since it protects us
Yuta Kitamura
2014/07/22 09:22:43
I'm not opposing to the use of const in general. I
| |
| 325 { | 325 { |
| 326 if (!sourceRange) { | 326 if (!(how == START_TO_START || how == START_TO_END || how == END_TO_END || h ow == END_TO_START)) { |
| 327 exceptionState.throwDOMException(NotFoundError, "The source range provid ed was null."); | 327 exceptionState.throwDOMException(NotSupportedError, "The comparison meth od provided must be one of 'START_TO_START', 'START_TO_END', 'END_TO_END', or 'E ND_TO_START'."); |
| 328 return 0; | 328 return 0; |
| 329 } | 329 } |
| 330 | 330 |
| 331 Node* thisCont = commonAncestorContainer(); | 331 Node* thisCont = commonAncestorContainer(); |
| 332 Node* sourceCont = sourceRange->commonAncestorContainer(); | 332 Node* sourceCont = sourceRange->commonAncestorContainer(); |
| 333 if (thisCont->document() != sourceCont->document()) { | 333 if (thisCont->document() != sourceCont->document()) { |
| 334 exceptionState.throwDOMException(WrongDocumentError, "The source range i s in a different document than this range."); | 334 exceptionState.throwDOMException(WrongDocumentError, "The source range i s in a different document than this range."); |
| 335 return 0; | 335 return 0; |
| 336 } | 336 } |
| 337 | 337 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 350 case START_TO_START: | 350 case START_TO_START: |
| 351 return compareBoundaryPoints(m_start, sourceRange->m_start, exceptio nState); | 351 return compareBoundaryPoints(m_start, sourceRange->m_start, exceptio nState); |
| 352 case START_TO_END: | 352 case START_TO_END: |
| 353 return compareBoundaryPoints(m_end, sourceRange->m_start, exceptionS tate); | 353 return compareBoundaryPoints(m_end, sourceRange->m_start, exceptionS tate); |
| 354 case END_TO_END: | 354 case END_TO_END: |
| 355 return compareBoundaryPoints(m_end, sourceRange->m_end, exceptionSta te); | 355 return compareBoundaryPoints(m_end, sourceRange->m_end, exceptionSta te); |
| 356 case END_TO_START: | 356 case END_TO_START: |
| 357 return compareBoundaryPoints(m_start, sourceRange->m_end, exceptionS tate); | 357 return compareBoundaryPoints(m_start, sourceRange->m_end, exceptionS tate); |
| 358 } | 358 } |
| 359 | 359 |
| 360 exceptionState.throwDOMException(SyntaxError, "The comparison method provide d must be one of 'START_TO_START', 'START_TO_END', 'END_TO_END', or 'END_TO_STAR T'."); | 360 ASSERT_NOT_REACHED(); |
| 361 return 0; | 361 return 0; |
| 362 } | 362 } |
| 363 | 363 |
| 364 short Range::compareBoundaryPoints(Node* containerA, int offsetA, Node* containe rB, int offsetB, ExceptionState& exceptionState) | 364 short Range::compareBoundaryPoints(Node* containerA, int offsetA, Node* containe rB, int offsetB, ExceptionState& exceptionState) |
| 365 { | 365 { |
| 366 ASSERT(containerA); | 366 ASSERT(containerA); |
| 367 ASSERT(containerB); | 367 ASSERT(containerB); |
| 368 | 368 |
| 369 if (!containerA) | 369 if (!containerA) |
| 370 return -1; | 370 return -1; |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1709 | 1709 |
| 1710 void showTree(const WebCore::Range* range) | 1710 void showTree(const WebCore::Range* range) |
| 1711 { | 1711 { |
| 1712 if (range && range->boundaryPointsValid()) { | 1712 if (range && range->boundaryPointsValid()) { |
| 1713 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); | 1713 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); |
| 1714 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); | 1714 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); |
| 1715 } | 1715 } |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 #endif | 1718 #endif |
| OLD | NEW |