| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 PositionInComposedTree VisibleSelection::startInComposedTree() const | 214 PositionInComposedTree VisibleSelection::startInComposedTree() const |
| 215 { | 215 { |
| 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 EphemeralRange firstEphemeralRangeOf(const VisibleSelection& selection) |
| 225 { |
| 226 if (selection.isNone()) |
| 227 return EphemeralRange(); |
| 228 Position start = selection.start().parentAnchoredEquivalent(); |
| 229 Position end = selection.end().parentAnchoredEquivalent(); |
| 230 return EphemeralRange(start, end); |
| 231 } |
| 232 |
| 224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) | 233 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) |
| 225 { | 234 { |
| 226 if (selection.isNone()) | 235 return createRange(firstEphemeralRangeOf(selection)); |
| 227 return nullptr; | |
| 228 Position start = selection.start().parentAnchoredEquivalent(); | |
| 229 Position end = selection.end().parentAnchoredEquivalent(); | |
| 230 return Range::create(*start.document(), start, end); | |
| 231 } | 236 } |
| 232 | 237 |
| 233 EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const | 238 EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const |
| 234 { | 239 { |
| 235 if (isNone()) | 240 if (isNone()) |
| 236 return EphemeralRange(); | 241 return EphemeralRange(); |
| 237 | 242 |
| 238 // Make sure we have an updated layout since this function is called | 243 // Make sure we have an updated layout since this function is called |
| 239 // in the course of running edit commands which modify the DOM. | 244 // in the course of running edit commands which modify the DOM. |
| 240 // Failing to call this can result in equivalentXXXPosition calls returning | 245 // Failing to call this can result in equivalentXXXPosition calls returning |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 sel.showTreeForThis(); | 1225 sel.showTreeForThis(); |
| 1221 } | 1226 } |
| 1222 | 1227 |
| 1223 void showTree(const blink::VisibleSelection* sel) | 1228 void showTree(const blink::VisibleSelection* sel) |
| 1224 { | 1229 { |
| 1225 if (sel) | 1230 if (sel) |
| 1226 sel->showTreeForThis(); | 1231 sel->showTreeForThis(); |
| 1227 } | 1232 } |
| 1228 | 1233 |
| 1229 #endif | 1234 #endif |
| OLD | NEW |