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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 | 185 |
186 PassRefPtrWillBeRawPtr<Range> VisibleSelection::firstRange() const | 186 PassRefPtrWillBeRawPtr<Range> VisibleSelection::firstRange() const |
187 { | 187 { |
188 if (isNone()) | 188 if (isNone()) |
189 return nullptr; | 189 return nullptr; |
190 Position start = m_start.parentAnchoredEquivalent(); | 190 Position start = m_start.parentAnchoredEquivalent(); |
191 Position end = m_end.parentAnchoredEquivalent(); | 191 Position end = m_end.parentAnchoredEquivalent(); |
192 return Range::create(*start.document(), start, end); | 192 return Range::create(*start.document(), start, end); |
193 } | 193 } |
194 | 194 |
195 bool VisibleSelection::intersectsNode(Node* node) const | |
196 { | |
197 if (isNone()) | |
198 return false; | |
199 Position start = m_start.parentAnchoredEquivalent(); | |
200 Position end = m_end.parentAnchoredEquivalent(); | |
201 TrackExceptionState exceptionState; | |
202 if (Range::intersectsNode(node, start, end, exceptionState)) | |
yosin_UTC9
2014/09/05 01:07:56
nit: Just |return Range::intersectsNode(node, star
yosin_UTC9
2014/09/05 01:07:56
Can we use |ASSERT_NO_EXCEPTION| instead of |excep
Mads Ager (chromium)
2014/09/05 08:22:52
Hmm, good point. I thought we could as well, but i
Mads Ager (chromium)
2014/09/05 08:22:52
Yes! Thanks! :)
| |
203 return true; | |
204 return false; | |
205 } | |
206 | |
195 PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const | 207 PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const |
196 { | 208 { |
197 if (isNone()) | 209 if (isNone()) |
198 return nullptr; | 210 return nullptr; |
199 | 211 |
200 // Make sure we have an updated layout since this function is called | 212 // Make sure we have an updated layout since this function is called |
201 // in the course of running edit commands which modify the DOM. | 213 // in the course of running edit commands which modify the DOM. |
202 // Failing to call this can result in equivalentXXXPosition calls returning | 214 // Failing to call this can result in equivalentXXXPosition calls returning |
203 // incorrect results. | 215 // incorrect results. |
204 m_start.document()->updateLayout(); | 216 m_start.document()->updateLayout(); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 sel.showTreeForThis(); | 868 sel.showTreeForThis(); |
857 } | 869 } |
858 | 870 |
859 void showTree(const blink::VisibleSelection* sel) | 871 void showTree(const blink::VisibleSelection* sel) |
860 { | 872 { |
861 if (sel) | 873 if (sel) |
862 sel->showTreeForThis(); | 874 sel->showTreeForThis(); |
863 } | 875 } |
864 | 876 |
865 #endif | 877 #endif |
OLD | NEW |