OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 case Position::PositionIsAfterAnchor: | 818 case Position::PositionIsAfterAnchor: |
819 return Position(position.anchorNode(), Position::PositionIsBeforeAnc
hor); | 819 return Position(position.anchorNode(), Position::PositionIsBeforeAnc
hor); |
820 case Position::PositionIsBeforeAnchor: | 820 case Position::PositionIsBeforeAnchor: |
821 return previousIfPositionIsAfterLineBreak(endOfPrevious(*position.an
chorNode(), innerEditor), innerEditor); | 821 return previousIfPositionIsAfterLineBreak(endOfPrevious(*position.an
chorNode(), innerEditor), innerEditor); |
822 default: | 822 default: |
823 ASSERT_NOT_REACHED(); | 823 ASSERT_NOT_REACHED(); |
824 } | 824 } |
825 } else if (position.anchorNode()->isTextNode()) { | 825 } else if (position.anchorNode()->isTextNode()) { |
826 Text* textNode = toText(position.anchorNode()); | 826 Text* textNode = toText(position.anchorNode()); |
827 unsigned offset = position.offsetInContainerNode(); | 827 unsigned offset = position.offsetInContainerNode(); |
828 if (textNode->length() == 0 || offset <= 0) { | 828 if (textNode->length() == 0 || offset == 0) { |
829 return previousIfPositionIsAfterLineBreak(endOfPrevious(*position.an
chorNode(), innerEditor), innerEditor); | 829 return previousIfPositionIsAfterLineBreak(endOfPrevious(*position.an
chorNode(), innerEditor), innerEditor); |
830 } | 830 } |
831 | 831 |
832 if (offset <= textNode->length() && textNode->data()[offset - 1] == '\n'
) { | 832 if (offset <= textNode->length() && textNode->data()[offset - 1] == '\n'
) { |
833 return Position(textNode, offset - 1); | 833 return Position(textNode, offset - 1); |
834 } | 834 } |
835 } | 835 } |
836 | 836 |
837 return position; | 837 return position; |
838 } | 838 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 Text* textNode = toText(node); | 901 Text* textNode = toText(node); |
902 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi
votPosition.offsetInContainerNode() : 0); | 902 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi
votPosition.offsetInContainerNode() : 0); |
903 if (firstLineBreak != kNotFound) | 903 if (firstLineBreak != kNotFound) |
904 return Position(textNode, firstLineBreak + 1); | 904 return Position(textNode, firstLineBreak + 1); |
905 } | 905 } |
906 } | 906 } |
907 return endOfInnerText(textFormControl); | 907 return endOfInnerText(textFormControl); |
908 } | 908 } |
909 | 909 |
910 } // namespace Webcore | 910 } // namespace Webcore |
OLD | NEW |