| 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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 node = n; | 1190 node = n; |
| 1191 type = Position::PositionIsBeforeAnchor; | 1191 type = Position::PositionIsBeforeAnchor; |
| 1192 n = n->previousSibling() ? n->previousSibling() : NodeTraversal::pre
viousPostOrder(*n, startBlock); | 1192 n = n->previousSibling() ? n->previousSibling() : NodeTraversal::pre
viousPostOrder(*n, startBlock); |
| 1193 } else { | 1193 } else { |
| 1194 n = NodeTraversal::previousPostOrder(*n, startBlock); | 1194 n = NodeTraversal::previousPostOrder(*n, startBlock); |
| 1195 } | 1195 } |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 if (type == Position::PositionIsOffsetInAnchor) { | 1198 if (type == Position::PositionIsOffsetInAnchor) { |
| 1199 ASSERT(type == Position::PositionIsOffsetInAnchor || !offset); | 1199 ASSERT(type == Position::PositionIsOffsetInAnchor || !offset); |
| 1200 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); | 1200 return VisiblePosition(Position(node, offset), DOWNSTREAM); |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 return VisiblePosition(Position(node, type), DOWNSTREAM); | 1203 return VisiblePosition(Position(node, type), DOWNSTREAM); |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 VisiblePosition endOfParagraph(const VisiblePosition &c, EditingBoundaryCrossing
Rule boundaryCrossingRule) | 1206 VisiblePosition endOfParagraph(const VisiblePosition &c, EditingBoundaryCrossing
Rule boundaryCrossingRule) |
| 1207 { | 1207 { |
| 1208 if (c.isNull()) | 1208 if (c.isNull()) |
| 1209 return VisiblePosition(); | 1209 return VisiblePosition(); |
| 1210 | 1210 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 } else if (editingIgnoresContent(n) || isRenderedTableElement(n)) { | 1267 } else if (editingIgnoresContent(n) || isRenderedTableElement(n)) { |
| 1268 node = n; | 1268 node = n; |
| 1269 type = Position::PositionIsAfterAnchor; | 1269 type = Position::PositionIsAfterAnchor; |
| 1270 n = NodeTraversal::nextSkippingChildren(*n, stayInsideBlock); | 1270 n = NodeTraversal::nextSkippingChildren(*n, stayInsideBlock); |
| 1271 } else { | 1271 } else { |
| 1272 n = NodeTraversal::next(*n, stayInsideBlock); | 1272 n = NodeTraversal::next(*n, stayInsideBlock); |
| 1273 } | 1273 } |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 if (type == Position::PositionIsOffsetInAnchor) | 1276 if (type == Position::PositionIsOffsetInAnchor) |
| 1277 return VisiblePosition(Position(node, offset, type), DOWNSTREAM); | 1277 return VisiblePosition(Position(node, offset), DOWNSTREAM); |
| 1278 | 1278 |
| 1279 return VisiblePosition(Position(node, type), DOWNSTREAM); | 1279 return VisiblePosition(Position(node, type), DOWNSTREAM); |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 // FIXME: isStartOfParagraph(startOfNextParagraph(pos)) is not always true | 1282 // FIXME: isStartOfParagraph(startOfNextParagraph(pos)) is not always true |
| 1283 VisiblePosition startOfNextParagraph(const VisiblePosition& visiblePosition) | 1283 VisiblePosition startOfNextParagraph(const VisiblePosition& visiblePosition) |
| 1284 { | 1284 { |
| 1285 VisiblePosition paragraphEnd(endOfParagraph(visiblePosition, CanSkipOverEdit
ingBoundary)); | 1285 VisiblePosition paragraphEnd(endOfParagraph(visiblePosition, CanSkipOverEdit
ingBoundary)); |
| 1286 VisiblePosition afterParagraphEnd(paragraphEnd.next(CannotCrossEditingBounda
ry)); | 1286 VisiblePosition afterParagraphEnd(paragraphEnd.next(CannotCrossEditingBounda
ry)); |
| 1287 // The position after the last position in the last cell of a table | 1287 // The position after the last position in the last cell of a table |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H
itTestRequest::Active | HitTestRequest::IgnoreClipping; | 1462 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H
itTestRequest::Active | HitTestRequest::IgnoreClipping; |
| 1463 HitTestResult result(request, contentsPoint); | 1463 HitTestResult result(request, contentsPoint); |
| 1464 frame->document()->layoutView()->hitTest(result); | 1464 frame->document()->layoutView()->hitTest(result); |
| 1465 | 1465 |
| 1466 if (Node* node = result.innerNode()) | 1466 if (Node* node = result.innerNode()) |
| 1467 return frame->selection().selection().visiblePositionRespectingEditingBo
undary(result.localPoint(), node); | 1467 return frame->selection().selection().visiblePositionRespectingEditingBo
undary(result.localPoint(), node); |
| 1468 return VisiblePosition(); | 1468 return VisiblePosition(); |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 } | 1471 } |
| OLD | NEW |