| 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 // TODO(yosin) We should move |intersectsNode()| to "FrameSelection.cpp". | |
| 234 bool intersectsNode(const VisibleSelection& selection, Node* node) | |
| 235 { | |
| 236 if (selection.isNone()) | |
| 237 return false; | |
| 238 Position start = selection.start().parentAnchoredEquivalent(); | |
| 239 Position end = selection.end().parentAnchoredEquivalent(); | |
| 240 TrackExceptionState exceptionState; | |
| 241 // TODO(yosin) We should avoid to use |Range::intersectsNode()|. | |
| 242 return Range::intersectsNode(node, start, end, exceptionState) && !exception
State.hadException(); | |
| 243 } | |
| 244 | |
| 245 template <typename Strategy> | 233 template <typename Strategy> |
| 246 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) | 234 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) |
| 247 { | 235 { |
| 248 ASSERT(range.isNotNull()); | 236 ASSERT(range.isNotNull()); |
| 249 range.document().updateLayoutIgnorePendingStylesheets(); | 237 range.document().updateLayoutIgnorePendingStylesheets(); |
| 250 | 238 |
| 251 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is | 239 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is |
| 252 // redundant. | 240 // redundant. |
| 253 const PositionAlgorithm<Strategy> normalizedStart = mostForwardCaretPosition
(range.startPosition()).parentAnchoredEquivalent(); | 241 const PositionAlgorithm<Strategy> normalizedStart = mostForwardCaretPosition
(range.startPosition()).parentAnchoredEquivalent(); |
| 254 const PositionAlgorithm<Strategy> normalizedEnd = mostBackwardCaretPosition(
range.endPosition()).parentAnchoredEquivalent(); | 242 const PositionAlgorithm<Strategy> normalizedEnd = mostBackwardCaretPosition(
range.endPosition()).parentAnchoredEquivalent(); |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 sel.showTreeForThis(); | 1247 sel.showTreeForThis(); |
| 1260 } | 1248 } |
| 1261 | 1249 |
| 1262 void showTree(const blink::VisibleSelection* sel) | 1250 void showTree(const blink::VisibleSelection* sel) |
| 1263 { | 1251 { |
| 1264 if (sel) | 1252 if (sel) |
| 1265 sel->showTreeForThis(); | 1253 sel->showTreeForThis(); |
| 1266 } | 1254 } |
| 1267 | 1255 |
| 1268 #endif | 1256 #endif |
| OLD | NEW |