OLD | NEW |
---|---|
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 return m_startInComposedTree; | 216 return m_startInComposedTree; |
217 } | 217 } |
218 | 218 |
219 PositionInComposedTree VisibleSelection::endInComposedTree() const | 219 PositionInComposedTree VisibleSelection::endInComposedTree() const |
220 { | 220 { |
221 return m_endInComposedTree; | 221 return m_endInComposedTree; |
222 } | 222 } |
223 | 223 |
224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) | 224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) |
225 { | 225 { |
226 if (selection.isNone()) | 226 if (selection.isNone()) |
yosin_UTC9
2015/09/10 01:58:39
nit: Could you use |firstEphemeralRange()| here?
yosin_UTC9
2015/09/10 02:24:02
It is better to remove |firstRangeOf()| by replaci
| |
227 return nullptr; | 227 return nullptr; |
228 Position start = selection.start().parentAnchoredEquivalent(); | 228 Position start = selection.start().parentAnchoredEquivalent(); |
229 Position end = selection.end().parentAnchoredEquivalent(); | 229 Position end = selection.end().parentAnchoredEquivalent(); |
230 return Range::create(*start.document(), start, end); | 230 return Range::create(*start.document(), start, end); |
231 } | 231 } |
232 | 232 |
233 EphemeralRange firstEphemeralRangeOf(const VisibleSelection& selection) | |
234 { | |
235 if (selection.isNone()) | |
236 return EphemeralRange(); | |
237 Position start = selection.start().parentAnchoredEquivalent(); | |
238 Position end = selection.end().parentAnchoredEquivalent(); | |
239 return EphemeralRange(start, end); | |
240 } | |
241 | |
233 EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const | 242 EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const |
234 { | 243 { |
235 if (isNone()) | 244 if (isNone()) |
236 return EphemeralRange(); | 245 return EphemeralRange(); |
237 | 246 |
238 // Make sure we have an updated layout since this function is called | 247 // Make sure we have an updated layout since this function is called |
239 // in the course of running edit commands which modify the DOM. | 248 // in the course of running edit commands which modify the DOM. |
240 // Failing to call this can result in equivalentXXXPosition calls returning | 249 // Failing to call this can result in equivalentXXXPosition calls returning |
241 // incorrect results. | 250 // incorrect results. |
242 m_start.document()->updateLayout(); | 251 m_start.document()->updateLayout(); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1220 sel.showTreeForThis(); | 1229 sel.showTreeForThis(); |
1221 } | 1230 } |
1222 | 1231 |
1223 void showTree(const blink::VisibleSelection* sel) | 1232 void showTree(const blink::VisibleSelection* sel) |
1224 { | 1233 { |
1225 if (sel) | 1234 if (sel) |
1226 sel->showTreeForThis(); | 1235 sel->showTreeForThis(); |
1227 } | 1236 } |
1228 | 1237 |
1229 #endif | 1238 #endif |
OLD | NEW |