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

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

Issue 2950053002: Make Position::BeforeNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-21T17:56:36 Created 3 years, 6 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 | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilities.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 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 Range* Range::CreateAdjustedToTreeScope(const TreeScope& tree_scope, 165 Range* Range::CreateAdjustedToTreeScope(const TreeScope& tree_scope,
166 const Position& position) { 166 const Position& position) {
167 DCHECK(position.IsNotNull()); 167 DCHECK(position.IsNotNull());
168 // Note: Since |Position::computeContanerNode()| returns |nullptr| if 168 // Note: Since |Position::computeContanerNode()| returns |nullptr| if
169 // |position| is |BeforeAnchor| or |AfterAnchor|. 169 // |position| is |BeforeAnchor| or |AfterAnchor|.
170 Node* const anchor_node = position.AnchorNode(); 170 Node* const anchor_node = position.AnchorNode();
171 if (anchor_node->GetTreeScope() == tree_scope) 171 if (anchor_node->GetTreeScope() == tree_scope)
172 return Create(tree_scope.GetDocument(), position, position); 172 return Create(tree_scope.GetDocument(), position, position);
173 Node* const shadow_host = tree_scope.AncestorInThisScope(anchor_node); 173 Node* const shadow_host = tree_scope.AncestorInThisScope(anchor_node);
174 return Range::Create(tree_scope.GetDocument(), 174 return Range::Create(tree_scope.GetDocument(),
175 Position::BeforeNode(shadow_host), 175 Position::BeforeNode(*shadow_host),
176 Position::BeforeNode(shadow_host)); 176 Position::BeforeNode(*shadow_host));
177 } 177 }
178 178
179 void Range::Dispose() { 179 void Range::Dispose() {
180 // A prompt detach from the owning Document helps avoid GC overhead. 180 // A prompt detach from the owning Document helps avoid GC overhead.
181 owner_document_->DetachRange(this); 181 owner_document_->DetachRange(this);
182 } 182 }
183 183
184 bool Range::IsConnected() const { 184 bool Range::IsConnected() const {
185 DCHECK_EQ(start_.IsConnected(), end_.IsConnected()); 185 DCHECK_EQ(start_.IsConnected(), end_.IsConnected());
186 return start_.IsConnected(); 186 return start_.IsConnected();
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 .data() 1729 .data()
1730 << "start offset: " << range->startOffset() 1730 << "start offset: " << range->startOffset()
1731 << ", end offset: " << range->endOffset(); 1731 << ", end offset: " << range->endOffset();
1732 } else { 1732 } else {
1733 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are " 1733 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are "
1734 "invalid."; 1734 "invalid.";
1735 } 1735 }
1736 } 1736 }
1737 1737
1738 #endif 1738 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698