Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: Source/core/dom/Range.cpp

Issue 409283003: A pointer should be sufficient for Range::compareBoundaryPoints (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Range.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 PassRefPtrWillBeRawPtr< Range> sourceRange, ExceptionState& exceptionState) const 324 short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, Exc eptionState& exceptionState) const
325 { 325 {
326 if (!(how == START_TO_START || how == START_TO_END || how == END_TO_END || h ow == END_TO_START)) { 326 if (!(how == START_TO_START || how == START_TO_END || how == END_TO_END || h ow == END_TO_START)) {
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'."); 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.");
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 1709
1710 void showTree(const blink::Range* range) 1710 void showTree(const blink::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
OLDNEW
« no previous file with comments | « Source/core/dom/Range.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698