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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |