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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 if (n == startNode && o < i) | 1143 if (n == startNode && o < i) |
1144 i = max(0, o); | 1144 i = max(0, o); |
1145 while (--i >= 0) { | 1145 while (--i >= 0) { |
1146 if ((*text)[i] == '\n') | 1146 if ((*text)[i] == '\n') |
1147 return VisiblePosition(Position(toText(n), i + 1), DOWNS
TREAM); | 1147 return VisiblePosition(Position(toText(n), i + 1), DOWNS
TREAM); |
1148 } | 1148 } |
1149 } | 1149 } |
1150 node = n; | 1150 node = n; |
1151 offset = 0; | 1151 offset = 0; |
1152 n = NodeTraversal::previousPostOrder(n, startBlock); | 1152 n = NodeTraversal::previousPostOrder(n, startBlock); |
1153 } else if (editingIgnoresContent(n) || isTableElement(n)) { | 1153 } else if (editingIgnoresContent(n) || isRenderedTable(n)) { |
1154 node = n; | 1154 node = n; |
1155 type = Position::PositionIsBeforeAnchor; | 1155 type = Position::PositionIsBeforeAnchor; |
1156 n = n->previousSibling() ? n->previousSibling() : NodeTraversal::pre
viousPostOrder(n, startBlock); | 1156 n = n->previousSibling() ? n->previousSibling() : NodeTraversal::pre
viousPostOrder(n, startBlock); |
1157 } else | 1157 } else |
1158 n = NodeTraversal::previousPostOrder(n, startBlock); | 1158 n = NodeTraversal::previousPostOrder(n, startBlock); |
1159 } | 1159 } |
1160 | 1160 |
1161 if (type == Position::PositionIsOffsetInAnchor) { | 1161 if (type == Position::PositionIsOffsetInAnchor) { |
1162 ASSERT(type == Position::PositionIsOffsetInAnchor || !offset); | 1162 ASSERT(type == Position::PositionIsOffsetInAnchor || !offset); |
1163 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); | 1163 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 RenderText* text = toRenderText(r); | 1219 RenderText* text = toRenderText(r); |
1220 int o = n == startNode ? offset : 0; | 1220 int o = n == startNode ? offset : 0; |
1221 for (int i = o; i < length; ++i) { | 1221 for (int i = o; i < length; ++i) { |
1222 if ((*text)[i] == '\n') | 1222 if ((*text)[i] == '\n') |
1223 return VisiblePosition(Position(toText(n), i), DOWNSTREA
M); | 1223 return VisiblePosition(Position(toText(n), i), DOWNSTREA
M); |
1224 } | 1224 } |
1225 } | 1225 } |
1226 node = n; | 1226 node = n; |
1227 offset = r->caretMaxOffset(); | 1227 offset = r->caretMaxOffset(); |
1228 n = NodeTraversal::next(n, stayInsideBlock); | 1228 n = NodeTraversal::next(n, stayInsideBlock); |
1229 } else if (editingIgnoresContent(n) || isTableElement(n)) { | 1229 } else if (editingIgnoresContent(n) || isRenderedTable(n)) { |
1230 node = n; | 1230 node = n; |
1231 type = Position::PositionIsAfterAnchor; | 1231 type = Position::PositionIsAfterAnchor; |
1232 n = NodeTraversal::nextSkippingChildren(n, stayInsideBlock); | 1232 n = NodeTraversal::nextSkippingChildren(n, stayInsideBlock); |
1233 } else | 1233 } else |
1234 n = NodeTraversal::next(n, stayInsideBlock); | 1234 n = NodeTraversal::next(n, stayInsideBlock); |
1235 } | 1235 } |
1236 | 1236 |
1237 if (type == Position::PositionIsOffsetInAnchor) | 1237 if (type == Position::PositionIsOffsetInAnchor) |
1238 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); | 1238 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); |
1239 | 1239 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 { | 1408 { |
1409 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1409 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
1410 } | 1410 } |
1411 | 1411 |
1412 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1412 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
1413 { | 1413 { |
1414 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1414 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
1415 } | 1415 } |
1416 | 1416 |
1417 } | 1417 } |
OLD | NEW |