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

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

Issue 144063008: Use Node.isDocumentTypeNode more (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Start using isDocumentTypeNode Created 6 years, 11 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/Node.cpp ('k') | Source/core/editing/markup.cpp » ('j') | 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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 if (!m_start.container()) { 1451 if (!m_start.container()) {
1452 exceptionState.throwDOMException(InvalidStateError, "The range has no co ntainer. Perhaps 'detatch()' has been invoked on this object?"); 1452 exceptionState.throwDOMException(InvalidStateError, "The range has no co ntainer. Perhaps 'detatch()' has been invoked on this object?");
1453 return; 1453 return;
1454 } 1454 }
1455 1455
1456 if (!commonAncestorContainer(exceptionState) || exceptionState.hadException( )) 1456 if (!commonAncestorContainer(exceptionState) || exceptionState.hadException( ))
1457 return; 1457 return;
1458 1458
1459 Node* pastLast = pastLastNode(); 1459 Node* pastLast = pastLastNode();
1460 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { 1460 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) {
1461 if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) { 1461 if (n->isDocumentTypeNode()) {
1462 exceptionState.throwDOMException(HierarchyRequestError, "The Range c ontains a doctype node."); 1462 exceptionState.throwDOMException(HierarchyRequestError, "The Range c ontains a doctype node.");
1463 return; 1463 return;
1464 } 1464 }
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 Node* Range::firstNode() const 1468 Node* Range::firstNode() const
1469 { 1469 {
1470 if (!m_start.container()) 1470 if (!m_start.container())
1471 return 0; 1471 return 0;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 1886
1887 void showTree(const WebCore::Range* range) 1887 void showTree(const WebCore::Range* range)
1888 { 1888 {
1889 if (range && range->boundaryPointsValid()) { 1889 if (range && range->boundaryPointsValid()) {
1890 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1890 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1891 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1891 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1892 } 1892 }
1893 } 1893 }
1894 1894
1895 #endif 1895 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698