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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 8 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 updateSelectionIfAddedToSelection(); 242 updateSelectionIfAddedToSelection();
243 } 243 }
244 244
245 bool Range::isNodeFullyContained(Node& node) const { 245 bool Range::isNodeFullyContained(Node& node) const {
246 ContainerNode* parentNode = node.parentNode(); 246 ContainerNode* parentNode = node.parentNode();
247 int nodeIndex = node.nodeIndex(); 247 int nodeIndex = node.nodeIndex();
248 return isPointInRange( 248 return isPointInRange(
249 parentNode, nodeIndex, 249 parentNode, nodeIndex,
250 IGNORE_EXCEPTION_FOR_TESTING) // starts in the middle of this 250 IGNORE_EXCEPTION_FOR_TESTING) // starts in the middle of this
251 // range, or on the boundary points. 251 // range, or on the boundary points.
252 && isPointInRange( 252 &&
253 parentNode, nodeIndex + 1, 253 isPointInRange(
254 IGNORE_EXCEPTION_FOR_TESTING); // ends in the middle of this 254 parentNode, nodeIndex + 1,
255 // range, or on the boundary 255 IGNORE_EXCEPTION_FOR_TESTING); // ends in the middle of this
256 // points. 256 // range, or on the boundary
257 // points.
257 } 258 }
258 259
259 bool Range::hasSameRoot(const Node& node) const { 260 bool Range::hasSameRoot(const Node& node) const {
260 if (node.document() != m_ownerDocument) 261 if (node.document() != m_ownerDocument)
261 return false; 262 return false;
262 // commonAncestorContainer() is O(depth). We should avoid to call it in common 263 // commonAncestorContainer() is O(depth). We should avoid to call it in common
263 // cases. 264 // cases.
264 if (node.isInTreeScope() && m_start.container()->isInTreeScope() && 265 if (node.isInTreeScope() && m_start.container()->isInTreeScope() &&
265 &node.treeScope() == &m_start.container()->treeScope()) 266 &node.treeScope() == &m_start.container()->treeScope())
266 return true; 267 return true;
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 "The node to be inserted contains a '" + c->nodeName() + 842 "The node to be inserted contains a '" + c->nodeName() +
842 "' node, which may not be inserted here."); 843 "' node, which may not be inserted here.");
843 return; 844 return;
844 } 845 }
845 ++numNewChildren; 846 ++numNewChildren;
846 } 847 }
847 } else { 848 } else {
848 numNewChildren = 1; 849 numNewChildren = 1;
849 if (!checkAgainst->childTypeAllowed(newNodeType)) { 850 if (!checkAgainst->childTypeAllowed(newNodeType)) {
850 exceptionState.throwDOMException( 851 exceptionState.throwDOMException(
851 HierarchyRequestError, "The node to be inserted is a '" + 852 HierarchyRequestError,
852 newNode->nodeName() + 853 "The node to be inserted is a '" + newNode->nodeName() +
853 "' node, which may not be inserted here."); 854 "' node, which may not be inserted here.");
854 return; 855 return;
855 } 856 }
856 } 857 }
857 858
858 for (Node& node : NodeTraversal::inclusiveAncestorsOf(*m_start.container())) { 859 for (Node& node : NodeTraversal::inclusiveAncestorsOf(*m_start.container())) {
859 if (node == newNode) { 860 if (node == newNode) {
860 exceptionState.throwDOMException(HierarchyRequestError, 861 exceptionState.throwDOMException(HierarchyRequestError,
861 "The node to be inserted contains the " 862 "The node to be inserted contains the "
862 "insertion point; it may not be " 863 "insertion point; it may not be "
863 "inserted into itself."); 864 "inserted into itself.");
864 return; 865 return;
865 } 866 }
866 } 867 }
867 868
868 // InvalidNodeTypeError: Raised if newNode is an Attr, Entity, Notation, 869 // InvalidNodeTypeError: Raised if newNode is an Attr, Entity, Notation,
869 // ShadowRoot or Document node. 870 // ShadowRoot or Document node.
870 switch (newNodeType) { 871 switch (newNodeType) {
871 case Node::kAttributeNode: 872 case Node::kAttributeNode:
872 case Node::kDocumentNode: 873 case Node::kDocumentNode:
873 exceptionState.throwDOMException( 874 exceptionState.throwDOMException(
874 InvalidNodeTypeError, "The node to be inserted is a '" + 875 InvalidNodeTypeError,
875 newNode->nodeName() + 876 "The node to be inserted is a '" + newNode->nodeName() +
876 "' node, which may not be inserted here."); 877 "' node, which may not be inserted here.");
877 return; 878 return;
878 default: 879 default:
879 if (newNode->isShadowRoot()) { 880 if (newNode->isShadowRoot()) {
880 exceptionState.throwDOMException(InvalidNodeTypeError, 881 exceptionState.throwDOMException(InvalidNodeTypeError,
881 "The node to be inserted is a shadow " 882 "The node to be inserted is a shadow "
882 "root, which may not be inserted " 883 "root, which may not be inserted "
883 "here."); 884 "here.");
884 return; 885 return;
885 } 886 }
886 break; 887 break;
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 if (node->isElementNode()) 1663 if (node->isElementNode())
1663 nodeSet.insert(node); 1664 nodeSet.insert(node);
1664 } 1665 }
1665 1666
1666 for (Node* node = firstNode(); node != stopNode; 1667 for (Node* node = firstNode(); node != stopNode;
1667 node = NodeTraversal::next(*node)) { 1668 node = NodeTraversal::next(*node)) {
1668 if (node->isElementNode()) { 1669 if (node->isElementNode()) {
1669 // Exclude start & end container unless the entire corresponding 1670 // Exclude start & end container unless the entire corresponding
1670 // node is included in the range. 1671 // node is included in the range.
1671 if (!nodeSet.contains(node->parentNode()) && 1672 if (!nodeSet.contains(node->parentNode()) &&
1672 (startContainer == endContainer || (!node->contains(startContainer) && 1673 (startContainer == endContainer ||
1673 !node->contains(endContainer)))) { 1674 (!node->contains(startContainer) &&
1675 !node->contains(endContainer)))) {
1674 if (LayoutObject* layoutObject = toElement(node)->layoutObject()) { 1676 if (LayoutObject* layoutObject = toElement(node)->layoutObject()) {
1675 Vector<FloatQuad> elementQuads; 1677 Vector<FloatQuad> elementQuads;
1676 layoutObject->absoluteQuads(elementQuads); 1678 layoutObject->absoluteQuads(elementQuads);
1677 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom( 1679 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(
1678 elementQuads, *layoutObject); 1680 elementQuads, *layoutObject);
1679 1681
1680 quads.appendVector(elementQuads); 1682 quads.appendVector(elementQuads);
1681 } 1683 }
1682 } 1684 }
1683 } else if (node->isTextNode()) { 1685 } else if (node->isTextNode()) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 .data() 1762 .data()
1761 << "start offset: " << range->startOffset() 1763 << "start offset: " << range->startOffset()
1762 << ", end offset: " << range->endOffset(); 1764 << ", end offset: " << range->endOffset();
1763 } else { 1765 } else {
1764 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are " 1766 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are "
1765 "invalid."; 1767 "invalid.";
1766 } 1768 }
1767 } 1769 }
1768 1770
1769 #endif 1771 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/QualifiedName.h ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698