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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (comparePositions(s, e) > 0) { | 166 if (comparePositions(s, e) > 0) { |
167 // Make sure the start is before the end. | 167 // Make sure the start is before the end. |
168 // The end can wind up before the start if collapsed whitespace is t
he only thing selected. | 168 // The end can wind up before the start if collapsed whitespace is t
he only thing selected. |
169 Position tmp = s; | 169 Position tmp = s; |
170 s = e; | 170 s = e; |
171 e = tmp; | 171 e = tmp; |
172 } | 172 } |
173 s = s.parentAnchoredEquivalent(); | 173 s = s.parentAnchoredEquivalent(); |
174 e = e.parentAnchoredEquivalent(); | 174 e = e.parentAnchoredEquivalent(); |
175 } | 175 } |
| 176 |
| 177 if (s.isNull() || e.isNull()) |
| 178 return 0; |
176 | 179 |
177 // VisibleSelections are supposed to always be valid. This constructor will
ASSERT | 180 // VisibleSelections are supposed to always be valid. This constructor will
ASSERT |
178 // if a valid range could not be created, which is fine for this callsite. | 181 // if a valid range could not be created, which is fine for this callsite. |
179 return Range::create(s.node()->document(), s, e); | 182 return Range::create(s.node()->document(), s, e); |
180 } | 183 } |
181 | 184 |
182 bool VisibleSelection::expandUsingGranularity(TextGranularity granularity) | 185 bool VisibleSelection::expandUsingGranularity(TextGranularity granularity) |
183 { | 186 { |
184 if (isNone()) | 187 if (isNone()) |
185 return false; | 188 return false; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 sel.showTreeForThis(); | 641 sel.showTreeForThis(); |
639 } | 642 } |
640 | 643 |
641 void showTree(const WebCore::VisibleSelection* sel) | 644 void showTree(const WebCore::VisibleSelection* sel) |
642 { | 645 { |
643 if (sel) | 646 if (sel) |
644 sel->showTreeForThis(); | 647 sel->showTreeForThis(); |
645 } | 648 } |
646 | 649 |
647 #endif | 650 #endif |
OLD | NEW |