OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 Position currentPos = position; | 1114 Position currentPos = position; |
1115 while (!currentPos.atStartOfTree()) { | 1115 while (!currentPos.atStartOfTree()) { |
1116 currentPos = currentPos.previous(); | 1116 currentPos = currentPos.previous(); |
1117 | 1117 |
1118 if (currentPos.anchorNode()->rootEditableElement() != fromRootEditableEl
ement) | 1118 if (currentPos.anchorNode()->rootEditableElement() != fromRootEditableEl
ement) |
1119 return position; | 1119 return position; |
1120 | 1120 |
1121 if (atStartOfLine || !rendered) { | 1121 if (atStartOfLine || !rendered) { |
1122 if (currentPos.isCandidate()) | 1122 if (currentPos.isCandidate()) |
1123 return currentPos; | 1123 return currentPos; |
1124 } else if (position.rendersInDifferentPosition(currentPos)) { | 1124 } else if (rendersInDifferentPosition(position, currentPos)) { |
1125 return currentPos; | 1125 return currentPos; |
1126 } | 1126 } |
1127 } | 1127 } |
1128 | 1128 |
1129 return position; | 1129 return position; |
1130 } | 1130 } |
1131 | 1131 |
1132 // This assumes that it starts in editable content. | 1132 // This assumes that it starts in editable content. |
1133 Position leadingWhitespacePosition(const Position& position, EAffinity affinity,
WhitespacePositionOption option) | 1133 Position leadingWhitespacePosition(const Position& position, EAffinity affinity,
WhitespacePositionOption option) |
1134 { | 1134 { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 // if the selection starts just before a paragraph break, skip over it | 1407 // if the selection starts just before a paragraph break, skip over it |
1408 if (isEndOfParagraph(visiblePosition)) | 1408 if (isEndOfParagraph(visiblePosition)) |
1409 return visiblePosition.next().deepEquivalent().downstream(); | 1409 return visiblePosition.next().deepEquivalent().downstream(); |
1410 | 1410 |
1411 // otherwise, make sure to be at the start of the first selected node, | 1411 // otherwise, make sure to be at the start of the first selected node, |
1412 // instead of possibly at the end of the last node before the selection | 1412 // instead of possibly at the end of the last node before the selection |
1413 return visiblePosition.deepEquivalent().downstream(); | 1413 return visiblePosition.deepEquivalent().downstream(); |
1414 } | 1414 } |
1415 | 1415 |
1416 } // namespace blink | 1416 } // namespace blink |
OLD | NEW |