| 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 return Range::intersectsNode(node, start, end, exceptionState) && !exception
State.hadException(); |
| 203 } |
| 204 |
| 195 PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const | 205 PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const |
| 196 { | 206 { |
| 197 if (isNone()) | 207 if (isNone()) |
| 198 return nullptr; | 208 return nullptr; |
| 199 | 209 |
| 200 // Make sure we have an updated layout since this function is called | 210 // Make sure we have an updated layout since this function is called |
| 201 // in the course of running edit commands which modify the DOM. | 211 // in the course of running edit commands which modify the DOM. |
| 202 // Failing to call this can result in equivalentXXXPosition calls returning | 212 // Failing to call this can result in equivalentXXXPosition calls returning |
| 203 // incorrect results. | 213 // incorrect results. |
| 204 m_start.document()->updateLayout(); | 214 m_start.document()->updateLayout(); |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 sel.showTreeForThis(); | 866 sel.showTreeForThis(); |
| 857 } | 867 } |
| 858 | 868 |
| 859 void showTree(const blink::VisibleSelection* sel) | 869 void showTree(const blink::VisibleSelection* sel) |
| 860 { | 870 { |
| 861 if (sel) | 871 if (sel) |
| 862 sel->showTreeForThis(); | 872 sel->showTreeForThis(); |
| 863 } | 873 } |
| 864 | 874 |
| 865 #endif | 875 #endif |
| OLD | NEW |