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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 if (n == startNode && o < i) | 1130 if (n == startNode && o < i) |
1131 i = max(0, o); | 1131 i = max(0, o); |
1132 while (--i >= 0) { | 1132 while (--i >= 0) { |
1133 if ((*text)[i] == '\n') | 1133 if ((*text)[i] == '\n') |
1134 return VisiblePosition(Position(toText(n), i + 1), DOWNS
TREAM); | 1134 return VisiblePosition(Position(toText(n), i + 1), DOWNS
TREAM); |
1135 } | 1135 } |
1136 } | 1136 } |
1137 node = n; | 1137 node = n; |
1138 offset = 0; | 1138 offset = 0; |
1139 n = NodeTraversal::previousPostOrder(*n, startBlock); | 1139 n = NodeTraversal::previousPostOrder(*n, startBlock); |
1140 } else if (editingIgnoresContent(n) || isRenderedTable(n)) { | 1140 } else if (editingIgnoresContent(n) || isRenderedTableElement(n)) { |
1141 node = n; | 1141 node = n; |
1142 type = Position::PositionIsBeforeAnchor; | 1142 type = Position::PositionIsBeforeAnchor; |
1143 n = n->previousSibling() ? n->previousSibling() : NodeTraversal::pre
viousPostOrder(*n, startBlock); | 1143 n = n->previousSibling() ? n->previousSibling() : NodeTraversal::pre
viousPostOrder(*n, startBlock); |
1144 } else { | 1144 } else { |
1145 n = NodeTraversal::previousPostOrder(*n, startBlock); | 1145 n = NodeTraversal::previousPostOrder(*n, startBlock); |
1146 } | 1146 } |
1147 } | 1147 } |
1148 | 1148 |
1149 if (type == Position::PositionIsOffsetInAnchor) { | 1149 if (type == Position::PositionIsOffsetInAnchor) { |
1150 ASSERT(type == Position::PositionIsOffsetInAnchor || !offset); | 1150 ASSERT(type == Position::PositionIsOffsetInAnchor || !offset); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 RenderText* text = toRenderText(r); | 1208 RenderText* text = toRenderText(r); |
1209 int o = n == startNode ? offset : 0; | 1209 int o = n == startNode ? offset : 0; |
1210 for (int i = o; i < length; ++i) { | 1210 for (int i = o; i < length; ++i) { |
1211 if ((*text)[i] == '\n') | 1211 if ((*text)[i] == '\n') |
1212 return VisiblePosition(Position(toText(n), i), DOWNSTREA
M); | 1212 return VisiblePosition(Position(toText(n), i), DOWNSTREA
M); |
1213 } | 1213 } |
1214 } | 1214 } |
1215 node = n; | 1215 node = n; |
1216 offset = r->caretMaxOffset(); | 1216 offset = r->caretMaxOffset(); |
1217 n = NodeTraversal::next(*n, stayInsideBlock); | 1217 n = NodeTraversal::next(*n, stayInsideBlock); |
1218 } else if (editingIgnoresContent(n) || isRenderedTable(n)) { | 1218 } else if (editingIgnoresContent(n) || isRenderedTableElement(n)) { |
1219 node = n; | 1219 node = n; |
1220 type = Position::PositionIsAfterAnchor; | 1220 type = Position::PositionIsAfterAnchor; |
1221 n = NodeTraversal::nextSkippingChildren(*n, stayInsideBlock); | 1221 n = NodeTraversal::nextSkippingChildren(*n, stayInsideBlock); |
1222 } else { | 1222 } else { |
1223 n = NodeTraversal::next(*n, stayInsideBlock); | 1223 n = NodeTraversal::next(*n, stayInsideBlock); |
1224 } | 1224 } |
1225 } | 1225 } |
1226 | 1226 |
1227 if (type == Position::PositionIsOffsetInAnchor) | 1227 if (type == Position::PositionIsOffsetInAnchor) |
1228 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); | 1228 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 int caretOffset; | 1402 int caretOffset; |
1403 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca
retOffset); | 1403 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca
retOffset); |
1404 | 1404 |
1405 if (inlineBox) | 1405 if (inlineBox) |
1406 renderer = &inlineBox->renderer(); | 1406 renderer = &inlineBox->renderer(); |
1407 | 1407 |
1408 return renderer->localCaretRect(inlineBox, caretOffset); | 1408 return renderer->localCaretRect(inlineBox, caretOffset); |
1409 } | 1409 } |
1410 | 1410 |
1411 } | 1411 } |
OLD | NEW |