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

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

Issue 2724333002: Get rid of VisibleSelection::firstRangeOf() (Closed)
Patch Set: 2017-03-03T13:18:27 DCHECK(!range) => DCHECK(range) Created 3 years, 9 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 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 EphemeralRange firstEphemeralRangeOf(const VisibleSelection& selection) { 139 EphemeralRange firstEphemeralRangeOf(const VisibleSelection& selection) {
140 if (selection.isNone()) 140 if (selection.isNone())
141 return EphemeralRange(); 141 return EphemeralRange();
142 Position start = selection.start().parentAnchoredEquivalent(); 142 Position start = selection.start().parentAnchoredEquivalent();
143 Position end = selection.end().parentAnchoredEquivalent(); 143 Position end = selection.end().parentAnchoredEquivalent();
144 return EphemeralRange(start, end); 144 return EphemeralRange(start, end);
145 } 145 }
146 146
147 Range* firstRangeOf(const VisibleSelection& selection) {
148 return createRange(firstEphemeralRangeOf(selection));
149 }
150
151 template <typename Strategy> 147 template <typename Strategy>
152 EphemeralRangeTemplate<Strategy> 148 EphemeralRangeTemplate<Strategy>
153 VisibleSelectionTemplate<Strategy>::toNormalizedEphemeralRange() const { 149 VisibleSelectionTemplate<Strategy>::toNormalizedEphemeralRange() const {
154 if (isNone()) 150 if (isNone())
155 return EphemeralRangeTemplate<Strategy>(); 151 return EphemeralRangeTemplate<Strategy>();
156 152
157 // Make sure we have an updated layout since this function is called 153 // Make sure we have an updated layout since this function is called
158 // in the course of running edit commands which modify the DOM. 154 // in the course of running edit commands which modify the DOM.
159 // Failing to ensure this can result in equivalentXXXPosition calls returning 155 // Failing to ensure this can result in equivalentXXXPosition calls returning
160 // incorrect results. 156 // incorrect results.
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 800
805 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 801 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
806 sel.showTreeForThis(); 802 sel.showTreeForThis();
807 } 803 }
808 804
809 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 805 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
810 if (sel) 806 if (sel)
811 sel->showTreeForThis(); 807 sel->showTreeForThis();
812 } 808 }
813 #endif 809 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698