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

Side by Side Diff: third_party/WebKit/Source/core/editing/PlainTextRange.cpp

Issue 2949763002: Introduce Position constructor with const Node& (Closed)
Patch Set: 2017-06-21T13:23:13 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/Position.h » ('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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
3 * rights reserved. 3 * rights reserved.
4 * Copyright (C) 2005 Alexey Proskuryakov. 4 * Copyright (C) 2005 Alexey Proskuryakov.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 Node* start_container = range.StartPosition().ComputeContainerNode(); 177 Node* start_container = range.StartPosition().ComputeContainerNode();
178 if (start_container != &scope && !start_container->IsDescendantOf(&scope)) 178 if (start_container != &scope && !start_container->IsDescendantOf(&scope))
179 return PlainTextRange(); 179 return PlainTextRange();
180 Node* end_container = range.EndPosition().ComputeContainerNode(); 180 Node* end_container = range.EndPosition().ComputeContainerNode();
181 if (end_container != scope && !end_container->IsDescendantOf(&scope)) 181 if (end_container != scope && !end_container->IsDescendantOf(&scope))
182 return PlainTextRange(); 182 return PlainTextRange();
183 183
184 DocumentLifecycle::DisallowTransitionScope disallow_transition( 184 DocumentLifecycle::DisallowTransitionScope disallow_transition(
185 scope.GetDocument().Lifecycle()); 185 scope.GetDocument().Lifecycle());
186 186
187 size_t start = TextIterator::RangeLength( 187 size_t start =
188 Position(&const_cast<ContainerNode&>(scope), 0), range.StartPosition()); 188 TextIterator::RangeLength(Position(scope, 0), range.StartPosition());
189 size_t end = TextIterator::RangeLength( 189 size_t end =
190 Position(&const_cast<ContainerNode&>(scope), 0), range.EndPosition()); 190 TextIterator::RangeLength(Position(scope, 0), range.EndPosition());
191 191
192 return PlainTextRange(start, end); 192 return PlainTextRange(start, end);
193 } 193 }
194 194
195 PlainTextRange PlainTextRange::Create(const ContainerNode& scope, 195 PlainTextRange PlainTextRange::Create(const ContainerNode& scope,
196 const Range& range) { 196 const Range& range) {
197 return Create(scope, EphemeralRange(&range)); 197 return Create(scope, EphemeralRange(&range));
198 } 198 }
199 199
200 } // namespace blink 200 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698