| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 while (previousNode && (!previousNode->layoutObject() || inSameLine(VisibleP
osition(firstPositionInOrBeforeNode(previousNode)), visiblePosition))) | 100 while (previousNode && (!previousNode->layoutObject() || inSameLine(VisibleP
osition(firstPositionInOrBeforeNode(previousNode)), visiblePosition))) |
| 101 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); | 101 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); |
| 102 | 102 |
| 103 while (previousNode && !previousNode->isShadowRoot()) { | 103 while (previousNode && !previousNode->isShadowRoot()) { |
| 104 if (highestEditableRoot(firstPositionInOrBeforeNode(previousNode), edita
bleType) != highestRoot) | 104 if (highestEditableRoot(firstPositionInOrBeforeNode(previousNode), edita
bleType) != highestRoot) |
| 105 break; | 105 break; |
| 106 | 106 |
| 107 Position pos = isHTMLBRElement(*previousNode) ? positionBeforeNode(previ
ousNode) : | 107 Position pos = isHTMLBRElement(*previousNode) ? positionBeforeNode(previ
ousNode) : |
| 108 Position::editingPositionOf(previousNode, caretMaxOffset(previousNod
e)); | 108 Position::editingPositionOf(previousNode, caretMaxOffset(previousNod
e)); |
| 109 | 109 |
| 110 if (pos.isCandidate()) | 110 if (isVisuallyEquivalentCandidate(pos)) |
| 111 return pos; | 111 return pos; |
| 112 | 112 |
| 113 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); | 113 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); |
| 114 } | 114 } |
| 115 return Position(); | 115 return Position(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 static Position nextRootInlineBoxCandidatePosition(Node* node, const VisiblePosi
tion& visiblePosition, EditableType editableType) | 118 static Position nextRootInlineBoxCandidatePosition(Node* node, const VisiblePosi
tion& visiblePosition, EditableType editableType) |
| 119 { | 119 { |
| 120 ContainerNode* highestRoot = highestEditableRoot(visiblePosition.deepEquival
ent(), editableType); | 120 ContainerNode* highestRoot = highestEditableRoot(visiblePosition.deepEquival
ent(), editableType); |
| 121 Node* nextNode = nextLeafWithSameEditability(node, editableType); | 121 Node* nextNode = nextLeafWithSameEditability(node, editableType); |
| 122 while (nextNode && (!nextNode->layoutObject() || inSameLine(VisiblePosition(
firstPositionInOrBeforeNode(nextNode)), visiblePosition))) | 122 while (nextNode && (!nextNode->layoutObject() || inSameLine(VisiblePosition(
firstPositionInOrBeforeNode(nextNode)), visiblePosition))) |
| 123 nextNode = nextLeafWithSameEditability(nextNode, ContentIsEditable); | 123 nextNode = nextLeafWithSameEditability(nextNode, ContentIsEditable); |
| 124 | 124 |
| 125 while (nextNode && !nextNode->isShadowRoot()) { | 125 while (nextNode && !nextNode->isShadowRoot()) { |
| 126 if (highestEditableRoot(firstPositionInOrBeforeNode(nextNode), editableT
ype) != highestRoot) | 126 if (highestEditableRoot(firstPositionInOrBeforeNode(nextNode), editableT
ype) != highestRoot) |
| 127 break; | 127 break; |
| 128 | 128 |
| 129 Position pos; | 129 Position pos; |
| 130 pos = Position::editingPositionOf(nextNode, caretMinOffset(nextNode)); | 130 pos = Position::editingPositionOf(nextNode, caretMinOffset(nextNode)); |
| 131 | 131 |
| 132 if (pos.isCandidate()) | 132 if (isVisuallyEquivalentCandidate(pos)) |
| 133 return pos; | 133 return pos; |
| 134 | 134 |
| 135 nextNode = nextLeafWithSameEditability(nextNode, editableType); | 135 nextNode = nextLeafWithSameEditability(nextNode, editableType); |
| 136 } | 136 } |
| 137 return Position(); | 137 return Position(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 class CachedLogicallyOrderedLeafBoxes { | 140 class CachedLogicallyOrderedLeafBoxes { |
| 141 public: | 141 public: |
| 142 CachedLogicallyOrderedLeafBoxes(); | 142 CachedLogicallyOrderedLeafBoxes(); |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 if (isHTMLBRElement(*position1.anchorNode())) | 1588 if (isHTMLBRElement(*position1.anchorNode())) |
| 1589 return false; | 1589 return false; |
| 1590 | 1590 |
| 1591 if (position1.computeEditingOffset() == position2.computeEditingOffset()
) | 1591 if (position1.computeEditingOffset() == position2.computeEditingOffset()
) |
| 1592 return false; | 1592 return false; |
| 1593 | 1593 |
| 1594 if (!position1.anchorNode()->isTextNode() && !position2.anchorNode()->is
TextNode()) | 1594 if (!position1.anchorNode()->isTextNode() && !position2.anchorNode()->is
TextNode()) |
| 1595 return true; | 1595 return true; |
| 1596 } | 1596 } |
| 1597 | 1597 |
| 1598 if (isHTMLBRElement(*position1.anchorNode()) && position2.isCandidate()) | 1598 if (isHTMLBRElement(*position1.anchorNode()) && isVisuallyEquivalentCandidat
e(position2)) |
| 1599 return true; | 1599 return true; |
| 1600 | 1600 |
| 1601 if (isHTMLBRElement(*position2.anchorNode()) && position1.isCandidate()) | 1601 if (isHTMLBRElement(*position2.anchorNode()) && isVisuallyEquivalentCandidat
e(position1)) |
| 1602 return true; | 1602 return true; |
| 1603 | 1603 |
| 1604 if (!inSameContainingBlockFlowElement(position1.anchorNode(), position2.anch
orNode())) | 1604 if (!inSameContainingBlockFlowElement(position1.anchorNode(), position2.anch
orNode())) |
| 1605 return true; | 1605 return true; |
| 1606 | 1606 |
| 1607 if (position1.anchorNode()->isTextNode() && !inRenderedText(position1)) | 1607 if (position1.anchorNode()->isTextNode() && !inRenderedText(position1)) |
| 1608 return false; | 1608 return false; |
| 1609 | 1609 |
| 1610 if (position2.anchorNode()->isTextNode() && !inRenderedText(position2)) | 1610 if (position2.anchorNode()->isTextNode() && !inRenderedText(position2)) |
| 1611 return false; | 1611 return false; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1946 { | 1946 { |
| 1947 return mostBackwardCaretPosition<EditingStrategy>(position, rule); | 1947 return mostBackwardCaretPosition<EditingStrategy>(position, rule); |
| 1948 } | 1948 } |
| 1949 | 1949 |
| 1950 PositionInComposedTree mostBackwardCaretPosition(const PositionInComposedTree& p
osition, EditingBoundaryCrossingRule rule) | 1950 PositionInComposedTree mostBackwardCaretPosition(const PositionInComposedTree& p
osition, EditingBoundaryCrossingRule rule) |
| 1951 { | 1951 { |
| 1952 return mostBackwardCaretPosition<EditingInComposedTreeStrategy>(position, ru
le); | 1952 return mostBackwardCaretPosition<EditingInComposedTreeStrategy>(position, ru
le); |
| 1953 } | 1953 } |
| 1954 | 1954 |
| 1955 } | 1955 } |
| OLD | NEW |