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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 return VisiblePosition(position); | 945 return VisiblePosition(position); |
946 } | 946 } |
947 } | 947 } |
948 | 948 |
949 if (root) { | 949 if (root) { |
950 // FIXME: Can be wrong for multi-column layout and with transforms. | 950 // FIXME: Can be wrong for multi-column layout and with transforms. |
951 IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(roo
t, lineDirectionPoint); | 951 IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(roo
t, lineDirectionPoint); |
952 RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isE
ditablePosition(p))->renderer(); | 952 RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isE
ditablePosition(p))->renderer(); |
953 Node* node = renderer.node(); | 953 Node* node = renderer.node(); |
954 if (node && editingIgnoresContent(node)) | 954 if (node && editingIgnoresContent(node)) |
955 return VisiblePosition(positionInParentBeforeNode(node)); | 955 return VisiblePosition(positionInParentBeforeNode(*node)); |
956 return VisiblePosition(renderer.positionForPoint(pointInLine)); | 956 return VisiblePosition(renderer.positionForPoint(pointInLine)); |
957 } | 957 } |
958 | 958 |
959 // Could not find a previous line. This means we must already be on the firs
t line. | 959 // Could not find a previous line. This means we must already be on the firs
t line. |
960 // Move to the start of the content in this block, which effectively moves u
s | 960 // Move to the start of the content in this block, which effectively moves u
s |
961 // to the start of the line we're on. | 961 // to the start of the line we're on. |
962 Element* rootElement = node->rendererIsEditable(editableType) ? node->rootEd
itableElement(editableType) : node->document().documentElement(); | 962 Element* rootElement = node->rendererIsEditable(editableType) ? node->rootEd
itableElement(editableType) : node->document().documentElement(); |
963 if (!rootElement) | 963 if (!rootElement) |
964 return VisiblePosition(); | 964 return VisiblePosition(); |
965 return VisiblePosition(firstPositionInNode(rootElement), DOWNSTREAM); | 965 return VisiblePosition(firstPositionInNode(rootElement), DOWNSTREAM); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 return VisiblePosition(position); | 1003 return VisiblePosition(position); |
1004 } | 1004 } |
1005 } | 1005 } |
1006 | 1006 |
1007 if (root) { | 1007 if (root) { |
1008 // FIXME: Can be wrong for multi-column layout and with transforms. | 1008 // FIXME: Can be wrong for multi-column layout and with transforms. |
1009 IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(roo
t, lineDirectionPoint); | 1009 IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(roo
t, lineDirectionPoint); |
1010 RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isE
ditablePosition(p))->renderer(); | 1010 RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isE
ditablePosition(p))->renderer(); |
1011 Node* node = renderer.node(); | 1011 Node* node = renderer.node(); |
1012 if (node && editingIgnoresContent(node)) | 1012 if (node && editingIgnoresContent(node)) |
1013 return VisiblePosition(positionInParentBeforeNode(node)); | 1013 return VisiblePosition(positionInParentBeforeNode(*node)); |
1014 return VisiblePosition(renderer.positionForPoint(pointInLine)); | 1014 return VisiblePosition(renderer.positionForPoint(pointInLine)); |
1015 } | 1015 } |
1016 | 1016 |
1017 // Could not find a next line. This means we must already be on the last lin
e. | 1017 // Could not find a next line. This means we must already be on the last lin
e. |
1018 // Move to the end of the content in this block, which effectively moves us | 1018 // Move to the end of the content in this block, which effectively moves us |
1019 // to the end of the line we're on. | 1019 // to the end of the line we're on. |
1020 Element* rootElement = node->rendererIsEditable(editableType) ? node->rootEd
itableElement(editableType) : node->document().documentElement(); | 1020 Element* rootElement = node->rendererIsEditable(editableType) ? node->rootEd
itableElement(editableType) : node->document().documentElement(); |
1021 if (!rootElement) | 1021 if (!rootElement) |
1022 return VisiblePosition(); | 1022 return VisiblePosition(); |
1023 return VisiblePosition(lastPositionInNode(rootElement), DOWNSTREAM); | 1023 return VisiblePosition(lastPositionInNode(rootElement), DOWNSTREAM); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 { | 1384 { |
1385 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1385 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
1386 } | 1386 } |
1387 | 1387 |
1388 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1388 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
1389 { | 1389 { |
1390 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1390 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
1391 } | 1391 } |
1392 | 1392 |
1393 } | 1393 } |
OLD | NEW |