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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) | 224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) |
225 { | 225 { |
226 if (selection.isNone()) | 226 if (selection.isNone()) |
227 return nullptr; | 227 return nullptr; |
228 Position start = selection.start().parentAnchoredEquivalent(); | 228 Position start = selection.start().parentAnchoredEquivalent(); |
229 Position end = selection.end().parentAnchoredEquivalent(); | 229 Position end = selection.end().parentAnchoredEquivalent(); |
230 return Range::create(*start.document(), start, end); | 230 return Range::create(*start.document(), start, end); |
231 } | 231 } |
232 | 232 |
233 bool VisibleSelection::intersectsNode(Node* node) const | 233 // TODO(yosin) We should move |intersectsNode()| to "FrameSelection.cpp". |
| 234 bool intersectsNode(const VisibleSelection& selection, Node* node) |
234 { | 235 { |
235 if (isNone()) | 236 if (selection.isNone()) |
236 return false; | 237 return false; |
237 Position start = m_start.parentAnchoredEquivalent(); | 238 Position start = selection.start().parentAnchoredEquivalent(); |
238 Position end = m_end.parentAnchoredEquivalent(); | 239 Position end = selection.end().parentAnchoredEquivalent(); |
239 TrackExceptionState exceptionState; | 240 TrackExceptionState exceptionState; |
| 241 // TODO(yosin) We should avoid to use |Range::intersectsNode()|. |
240 return Range::intersectsNode(node, start, end, exceptionState) && !exception
State.hadException(); | 242 return Range::intersectsNode(node, start, end, exceptionState) && !exception
State.hadException(); |
241 } | 243 } |
242 | 244 |
243 template <typename Strategy> | 245 template <typename Strategy> |
244 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) | 246 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) |
245 { | 247 { |
246 ASSERT(range.isNotNull()); | 248 ASSERT(range.isNotNull()); |
247 range.document().updateLayoutIgnorePendingStylesheets(); | 249 range.document().updateLayoutIgnorePendingStylesheets(); |
248 | 250 |
249 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is | 251 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 sel.showTreeForThis(); | 1246 sel.showTreeForThis(); |
1245 } | 1247 } |
1246 | 1248 |
1247 void showTree(const blink::VisibleSelection* sel) | 1249 void showTree(const blink::VisibleSelection* sel) |
1248 { | 1250 { |
1249 if (sel) | 1251 if (sel) |
1250 sel->showTreeForThis(); | 1252 sel->showTreeForThis(); |
1251 } | 1253 } |
1252 | 1254 |
1253 #endif | 1255 #endif |
OLD | NEW |