| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 PositionType prev = canonicalizeCandidate(previousCandidate(position)); | 119 PositionType prev = canonicalizeCandidate(previousCandidate(position)); |
| 120 Node* nextNode = next.anchorNode(); | 120 Node* nextNode = next.anchorNode(); |
| 121 Node* prevNode = prev.anchorNode(); | 121 Node* prevNode = prev.anchorNode(); |
| 122 | 122 |
| 123 // The new position must be in the same editable element. Enforce that | 123 // The new position must be in the same editable element. Enforce that |
| 124 // first. Unless the descent is from a non-editable html element to an | 124 // first. Unless the descent is from a non-editable html element to an |
| 125 // editable body. | 125 // editable body. |
| 126 if (node && node->document().documentElement() == node && !node->hasEditable
Style() && node->document().body() && node->document().body()->hasEditableStyle(
)) | 126 if (node && node->document().documentElement() == node && !node->hasEditable
Style() && node->document().body() && node->document().body()->hasEditableStyle(
)) |
| 127 return next.isNotNull() ? next : prev; | 127 return next.isNotNull() ? next : prev; |
| 128 | 128 |
| 129 Element* editingRoot = editableRootElementForPosition(position); | 129 Element* editingRoot = rootEditableElementOf(position); |
| 130 | 130 |
| 131 // If the html element is editable, descending into its body will look like | 131 // If the html element is editable, descending into its body will look like |
| 132 // a descent from non-editable to editable content since | 132 // a descent from non-editable to editable content since |
| 133 // |rootEditableElementOf()| always stops at the body. | 133 // |rootEditableElementOf()| always stops at the body. |
| 134 if ((editingRoot && editingRoot->document().documentElement() == editingRoot
) || position.anchorNode()->isDocumentNode()) | 134 if ((editingRoot && editingRoot->document().documentElement() == editingRoot
) || position.anchorNode()->isDocumentNode()) |
| 135 return next.isNotNull() ? next : prev; | 135 return next.isNotNull() ? next : prev; |
| 136 | 136 |
| 137 bool prevIsInSameEditableElement = prevNode && editableRootElementForPositio
n(prev) == editingRoot; | 137 bool prevIsInSameEditableElement = prevNode && rootEditableElementOf(prev) =
= editingRoot; |
| 138 bool nextIsInSameEditableElement = nextNode && editableRootElementForPositio
n(next) == editingRoot; | 138 bool nextIsInSameEditableElement = nextNode && rootEditableElementOf(next) =
= editingRoot; |
| 139 if (prevIsInSameEditableElement && !nextIsInSameEditableElement) | 139 if (prevIsInSameEditableElement && !nextIsInSameEditableElement) |
| 140 return prev; | 140 return prev; |
| 141 | 141 |
| 142 if (nextIsInSameEditableElement && !prevIsInSameEditableElement) | 142 if (nextIsInSameEditableElement && !prevIsInSameEditableElement) |
| 143 return next; | 143 return next; |
| 144 | 144 |
| 145 if (!nextIsInSameEditableElement && !prevIsInSameEditableElement) | 145 if (!nextIsInSameEditableElement && !prevIsInSameEditableElement) |
| 146 return PositionType(); | 146 return PositionType(); |
| 147 | 147 |
| 148 // The new position should be in the same block flow element. Favor that. | 148 // The new position should be in the same block flow element. Favor that. |
| (...skipping 3178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3327 { | 3327 { |
| 3328 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); | 3328 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); |
| 3329 } | 3329 } |
| 3330 | 3330 |
| 3331 VisiblePositionInComposedTree previousPositionOf(const VisiblePositionInComposed
Tree& visiblePosition, EditingBoundaryCrossingRule rule) | 3331 VisiblePositionInComposedTree previousPositionOf(const VisiblePositionInComposed
Tree& visiblePosition, EditingBoundaryCrossingRule rule) |
| 3332 { | 3332 { |
| 3333 return previousPositionOfAlgorithm<EditingInComposedTreeStrategy>(visiblePos
ition, rule); | 3333 return previousPositionOfAlgorithm<EditingInComposedTreeStrategy>(visiblePos
ition, rule); |
| 3334 } | 3334 } |
| 3335 | 3335 |
| 3336 } // namespace blink | 3336 } // namespace blink |
| OLD | NEW |