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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp

Issue 2955823002: Make VisiblePosition::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-26T17:50:06 Created 3 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 | « third_party/WebKit/Source/core/html/TextControlElement.cpp ('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 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return; 208 return;
209 } 209 }
210 210
211 if (nchars > number_of_chars - charnum) 211 if (nchars > number_of_chars - charnum)
212 nchars = number_of_chars - charnum; 212 nchars = number_of_chars - charnum;
213 213
214 DCHECK(GetDocument().GetFrame()); 214 DCHECK(GetDocument().GetFrame());
215 215
216 // Find selection start 216 // Find selection start
217 VisiblePosition start = VisiblePosition::FirstPositionInNode( 217 VisiblePosition start = VisiblePosition::FirstPositionInNode(
218 const_cast<SVGTextContentElement*>(this)); 218 *const_cast<SVGTextContentElement*>(this));
219 for (unsigned i = 0; i < charnum; ++i) 219 for (unsigned i = 0; i < charnum; ++i)
220 start = NextPositionOf(start); 220 start = NextPositionOf(start);
221 221
222 // Find selection end 222 // Find selection end
223 VisiblePosition end(start); 223 VisiblePosition end(start);
224 for (unsigned i = 0; i < nchars; ++i) 224 for (unsigned i = 0; i < nchars; ++i)
225 end = NextPositionOf(end); 225 end = NextPositionOf(end);
226 226
227 // TODO(editing-dev): We assume |start| and |end| are not null and we don't 227 // TODO(editing-dev): We assume |start| and |end| are not null and we don't
228 // known when |start| and |end| are null. Once we get a such case, we check 228 // known when |start| and |end| are null. Once we get a such case, we check
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 (!line_layout_item.IsSVGText() && !line_layout_item.IsSVGInline())) 296 (!line_layout_item.IsSVGText() && !line_layout_item.IsSVGInline()))
297 return nullptr; 297 return nullptr;
298 298
299 SVGElement* element = ToSVGElement(line_layout_item.GetNode()); 299 SVGElement* element = ToSVGElement(line_layout_item.GetNode());
300 DCHECK(element); 300 DCHECK(element);
301 return IsSVGTextContentElement(*element) ? ToSVGTextContentElement(element) 301 return IsSVGTextContentElement(*element) ? ToSVGTextContentElement(element)
302 : 0; 302 : 0;
303 } 303 }
304 304
305 } // namespace blink 305 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/TextControlElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698