| 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 } | 807 } |
| 808 | 808 |
| 809 static PositionInComposedTreeWithAffinity startOfLine(const PositionInComposedTr
eeWithAffinity& currentPosition) | 809 static PositionInComposedTreeWithAffinity startOfLine(const PositionInComposedTr
eeWithAffinity& currentPosition) |
| 810 { | 810 { |
| 811 return startOfLine(currentPosition, UseInlineBoxOrdering); | 811 return startOfLine(currentPosition, UseInlineBoxOrdering); |
| 812 } | 812 } |
| 813 | 813 |
| 814 // FIXME: Rename this function to reflect the fact it ignores bidi levels. | 814 // FIXME: Rename this function to reflect the fact it ignores bidi levels. |
| 815 VisiblePosition startOfLine(const VisiblePosition& currentPosition) | 815 VisiblePosition startOfLine(const VisiblePosition& currentPosition) |
| 816 { | 816 { |
| 817 return VisiblePosition(startOfLine(currentPosition.toPositionWithAffinity(),
UseInlineBoxOrdering)); | 817 return visiblePositionOf(startOfLine(currentPosition.toPositionWithAffinity(
), UseInlineBoxOrdering)); |
| 818 } | 818 } |
| 819 | 819 |
| 820 VisiblePosition logicalStartOfLine(const VisiblePosition& currentPosition) | 820 VisiblePosition logicalStartOfLine(const VisiblePosition& currentPosition) |
| 821 { | 821 { |
| 822 return VisiblePosition(startOfLine(currentPosition.toPositionWithAffinity(),
UseLogicalOrdering)); | 822 return visiblePositionOf(startOfLine(currentPosition.toPositionWithAffinity(
), UseLogicalOrdering)); |
| 823 } | 823 } |
| 824 | 824 |
| 825 static VisiblePosition endPositionForLine(const VisiblePosition& c, LineEndpoint
ComputationMode mode) | 825 static VisiblePosition endPositionForLine(const VisiblePosition& c, LineEndpoint
ComputationMode mode) |
| 826 { | 826 { |
| 827 if (c.isNull()) | 827 if (c.isNull()) |
| 828 return VisiblePosition(); | 828 return VisiblePosition(); |
| 829 | 829 |
| 830 RootInlineBox* rootBox = RenderedPosition(c).rootBox(); | 830 RootInlineBox* rootBox = RenderedPosition(c).rootBox(); |
| 831 if (!rootBox) { | 831 if (!rootBox) { |
| 832 // There are VisiblePositions at offset 0 in blocks without | 832 // There are VisiblePositions at offset 0 in blocks without |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 } | 1022 } |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 if (root) { | 1025 if (root) { |
| 1026 // FIXME: Can be wrong for multi-column layout and with transforms. | 1026 // FIXME: Can be wrong for multi-column layout and with transforms. |
| 1027 LayoutPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(
root, lineDirectionPoint); | 1027 LayoutPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(
root, lineDirectionPoint); |
| 1028 LayoutObject& layoutObject = root->closestLeafChildForPoint(pointInLine,
isEditablePosition(p))->layoutObject(); | 1028 LayoutObject& layoutObject = root->closestLeafChildForPoint(pointInLine,
isEditablePosition(p))->layoutObject(); |
| 1029 Node* node = layoutObject.node(); | 1029 Node* node = layoutObject.node(); |
| 1030 if (node && editingIgnoresContent(node)) | 1030 if (node && editingIgnoresContent(node)) |
| 1031 return VisiblePosition(positionInParentBeforeNode(*node)); | 1031 return VisiblePosition(positionInParentBeforeNode(*node)); |
| 1032 return VisiblePosition(layoutObject.positionForPoint(pointInLine)); | 1032 return visiblePositionOf(layoutObject.positionForPoint(pointInLine)); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 // Could not find a previous line. This means we must already be on the firs
t line. | 1035 // Could not find a previous line. This means we must already be on the firs
t line. |
| 1036 // Move to the start of the content in this block, which effectively moves u
s | 1036 // Move to the start of the content in this block, which effectively moves u
s |
| 1037 // to the start of the line we're on. | 1037 // to the start of the line we're on. |
| 1038 Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEdit
ableElement(editableType) : node->document().documentElement(); | 1038 Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEdit
ableElement(editableType) : node->document().documentElement(); |
| 1039 if (!rootElement) | 1039 if (!rootElement) |
| 1040 return VisiblePosition(); | 1040 return VisiblePosition(); |
| 1041 return VisiblePosition(firstPositionInNode(rootElement)); | 1041 return VisiblePosition(firstPositionInNode(rootElement)); |
| 1042 } | 1042 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } | 1078 } |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 if (root) { | 1081 if (root) { |
| 1082 // FIXME: Can be wrong for multi-column layout and with transforms. | 1082 // FIXME: Can be wrong for multi-column layout and with transforms. |
| 1083 LayoutPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(
root, lineDirectionPoint); | 1083 LayoutPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(
root, lineDirectionPoint); |
| 1084 LayoutObject& layoutObject = root->closestLeafChildForPoint(pointInLine,
isEditablePosition(p))->layoutObject(); | 1084 LayoutObject& layoutObject = root->closestLeafChildForPoint(pointInLine,
isEditablePosition(p))->layoutObject(); |
| 1085 Node* node = layoutObject.node(); | 1085 Node* node = layoutObject.node(); |
| 1086 if (node && editingIgnoresContent(node)) | 1086 if (node && editingIgnoresContent(node)) |
| 1087 return VisiblePosition(positionInParentBeforeNode(*node)); | 1087 return VisiblePosition(positionInParentBeforeNode(*node)); |
| 1088 return VisiblePosition(layoutObject.positionForPoint(pointInLine)); | 1088 return visiblePositionOf(layoutObject.positionForPoint(pointInLine)); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 // Could not find a next line. This means we must already be on the last lin
e. | 1091 // Could not find a next line. This means we must already be on the last lin
e. |
| 1092 // Move to the end of the content in this block, which effectively moves us | 1092 // Move to the end of the content in this block, which effectively moves us |
| 1093 // to the end of the line we're on. | 1093 // to the end of the line we're on. |
| 1094 Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEdit
ableElement(editableType) : node->document().documentElement(); | 1094 Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEdit
ableElement(editableType) : node->document().documentElement(); |
| 1095 if (!rootElement) | 1095 if (!rootElement) |
| 1096 return VisiblePosition(); | 1096 return VisiblePosition(); |
| 1097 return VisiblePosition(lastPositionInNode(rootElement)); | 1097 return VisiblePosition(lastPositionInNode(rootElement)); |
| 1098 } | 1098 } |
| (...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale
nt()); | 2425 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale
nt()); |
| 2426 case CanSkipOverEditingBoundary: | 2426 case CanSkipOverEditingBoundary: |
| 2427 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent
()); | 2427 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent
()); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 ASSERT_NOT_REACHED(); | 2430 ASSERT_NOT_REACHED(); |
| 2431 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent()
); | 2431 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent()
); |
| 2432 } | 2432 } |
| 2433 | 2433 |
| 2434 } // namespace blink | 2434 } // namespace blink |
| OLD | NEW |