Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 | 276 |
| 277 while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->i sDescendantOf(highestRoot)) | 277 while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->i sDescendantOf(highestRoot)) |
| 278 p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(*p.depr ecatedNode()) : nextVisuallyDistinctCandidate(p); | 278 p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(*p.depr ecatedNode()) : nextVisuallyDistinctCandidate(p); |
| 279 | 279 |
| 280 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated Node()->isDescendantOf(highestRoot)) | 280 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated Node()->isDescendantOf(highestRoot)) |
| 281 return VisiblePosition(); | 281 return VisiblePosition(); |
| 282 | 282 |
| 283 return VisiblePosition(p); | 283 return VisiblePosition(p); |
| 284 } | 284 } |
| 285 | 285 |
| 286 VisiblePosition lastEditablePositionBeforePositionInRoot(const Position& positio n, Node* highestRoot) | 286 Position lastEditablePositionBeforePositionInRoot(const Position& position, Node * highestRoot) |
| 287 { | 287 { |
| 288 // When position falls after highestRoot, the result is easy to compute. | 288 // When position falls after highestRoot, the result is easy to compute. |
| 289 if (comparePositions(position, lastPositionInNode(highestRoot)) == 1) | 289 if (comparePositions(position, lastPositionInNode(highestRoot)) == 1) |
| 290 return VisiblePosition(lastPositionInNode(highestRoot)); | 290 return lastPositionInNode(highestRoot); |
| 291 | 291 |
| 292 Position p = position; | 292 Position p = position; |
| 293 | 293 |
| 294 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { | 294 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { |
| 295 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.de precatedNode()); | 295 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.de precatedNode()); |
| 296 if (!shadowAncestor) | 296 if (!shadowAncestor) |
| 297 return VisiblePosition(); | 297 return Position(); |
| 298 | 298 |
| 299 p = firstPositionInOrBeforeNode(shadowAncestor); | 299 p = firstPositionInOrBeforeNode(shadowAncestor); |
| 300 } | 300 } |
| 301 | 301 |
| 302 while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->i sDescendantOf(highestRoot)) | 302 while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->i sDescendantOf(highestRoot)) |
| 303 p = isAtomicNode(p.deprecatedNode()) ? positionInParentBeforeNode(*p.dep recatedNode()) : previousVisuallyDistinctCandidate(p); | 303 p = isAtomicNode(p.deprecatedNode()) ? positionInParentBeforeNode(*p.dep recatedNode()) : previousVisuallyDistinctCandidate(p); |
| 304 | 304 |
| 305 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated Node()->isDescendantOf(highestRoot)) | 305 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated Node()->isDescendantOf(highestRoot)) |
| 306 return VisiblePosition(); | 306 return Position(); |
| 307 | 307 |
| 308 return VisiblePosition(p); | 308 return p; |
|
Yuta Kitamura
2014/06/18 08:08:11
Let's stop using abbreviated names.
yosin_UTC9
2014/06/19 07:36:57
Done by http://crrev.com/342553008/
| |
| 309 } | 309 } |
| 310 | 310 |
| 311 // FIXME: The method name, comment, and code say three different things here! | 311 // FIXME: The method name, comment, and code say three different things here! |
| 312 // Whether or not content before and after this node will collapse onto the same line as it. | 312 // Whether or not content before and after this node will collapse onto the same line as it. |
| 313 bool isBlock(const Node* node) | 313 bool isBlock(const Node* node) |
| 314 { | 314 { |
| 315 return node && node->renderer() && !node->renderer()->isInline() && !node->r enderer()->isRubyText(); | 315 return node && node->renderer() && !node->renderer()->isInline() && !node->r enderer()->isRubyText(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool isInline(const Node* node) | 318 bool isInline(const Node* node) |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1115 // if the selection starts just before a paragraph break, skip over it | 1115 // if the selection starts just before a paragraph break, skip over it |
| 1116 if (isEndOfParagraph(visiblePosition)) | 1116 if (isEndOfParagraph(visiblePosition)) |
| 1117 return visiblePosition.next().deepEquivalent().downstream(); | 1117 return visiblePosition.next().deepEquivalent().downstream(); |
| 1118 | 1118 |
| 1119 // otherwise, make sure to be at the start of the first selected node, | 1119 // otherwise, make sure to be at the start of the first selected node, |
| 1120 // instead of possibly at the end of the last node before the selection | 1120 // instead of possibly at the end of the last node before the selection |
| 1121 return visiblePosition.deepEquivalent().downstream(); | 1121 return visiblePosition.deepEquivalent().downstream(); |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 } // namespace WebCore | 1124 } // namespace WebCore |
| OLD | NEW |