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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 return 0; | 73 return 0; |
74 } | 74 } |
75 | 75 |
76 // FIXME: consolidate with code in previousLinePosition. | 76 // FIXME: consolidate with code in previousLinePosition. |
77 static Position previousRootInlineBoxCandidatePosition(Node* node, const Visible
Position& visiblePosition, EditableType editableType) | 77 static Position previousRootInlineBoxCandidatePosition(Node* node, const Visible
Position& visiblePosition, EditableType editableType) |
78 { | 78 { |
79 Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), ed
itableType); | 79 Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), ed
itableType); |
80 Node* previousNode = previousLeafWithSameEditability(node, editableType); | 80 Node* previousNode = previousLeafWithSameEditability(node, editableType); |
81 | 81 |
82 while (previousNode && inSameLine(firstPositionInOrBeforeNode(previousNode),
visiblePosition)) | 82 while (previousNode && (!previousNode->renderer() || inSameLine(firstPositio
nInOrBeforeNode(previousNode), visiblePosition))) |
83 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); | 83 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); |
84 | 84 |
85 while (previousNode && !previousNode->isShadowRoot()) { | 85 while (previousNode && !previousNode->isShadowRoot()) { |
86 if (highestEditableRoot(firstPositionInOrBeforeNode(previousNode), edita
bleType) != highestRoot) | 86 if (highestEditableRoot(firstPositionInOrBeforeNode(previousNode), edita
bleType) != highestRoot) |
87 break; | 87 break; |
88 | 88 |
89 Position pos = previousNode->hasTagName(brTag) ? positionBeforeNode(prev
iousNode) : | 89 Position pos = previousNode->hasTagName(brTag) ? positionBeforeNode(prev
iousNode) : |
90 createLegacyEditingPosition(previousNode, caretMaxOffset(previousNod
e)); | 90 createLegacyEditingPosition(previousNode, caretMaxOffset(previousNod
e)); |
91 | 91 |
92 if (pos.isCandidate()) | 92 if (pos.isCandidate()) |
93 return pos; | 93 return pos; |
94 | 94 |
95 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); | 95 previousNode = previousLeafWithSameEditability(previousNode, editableTyp
e); |
96 } | 96 } |
97 return Position(); | 97 return Position(); |
98 } | 98 } |
99 | 99 |
100 static Position nextRootInlineBoxCandidatePosition(Node* node, const VisiblePosi
tion& visiblePosition, EditableType editableType) | 100 static Position nextRootInlineBoxCandidatePosition(Node* node, const VisiblePosi
tion& visiblePosition, EditableType editableType) |
101 { | 101 { |
102 Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), ed
itableType); | 102 Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), ed
itableType); |
103 Node* nextNode = nextLeafWithSameEditability(node, editableType); | 103 Node* nextNode = nextLeafWithSameEditability(node, editableType); |
104 while (nextNode && inSameLine(firstPositionInOrBeforeNode(nextNode), visible
Position)) | 104 while (nextNode && (!nextNode->renderer() || inSameLine(firstPositionInOrBef
oreNode(nextNode), visiblePosition))) |
105 nextNode = nextLeafWithSameEditability(nextNode, ContentIsEditable); | 105 nextNode = nextLeafWithSameEditability(nextNode, ContentIsEditable); |
106 | 106 |
107 while (nextNode && !nextNode->isShadowRoot()) { | 107 while (nextNode && !nextNode->isShadowRoot()) { |
108 if (highestEditableRoot(firstPositionInOrBeforeNode(nextNode), editableT
ype) != highestRoot) | 108 if (highestEditableRoot(firstPositionInOrBeforeNode(nextNode), editableT
ype) != highestRoot) |
109 break; | 109 break; |
110 | 110 |
111 Position pos; | 111 Position pos; |
112 pos = createLegacyEditingPosition(nextNode, caretMinOffset(nextNode)); | 112 pos = createLegacyEditingPosition(nextNode, caretMinOffset(nextNode)); |
113 | 113 |
114 if (pos.isCandidate()) | 114 if (pos.isCandidate()) |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 { | 1412 { |
1413 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1413 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
1414 } | 1414 } |
1415 | 1415 |
1416 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1416 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
1417 { | 1417 { |
1418 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1418 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
1419 } | 1419 } |
1420 | 1420 |
1421 } | 1421 } |
OLD | NEW |