OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 // and should be rewritten. | 637 // and should be rewritten. |
638 // Expand the range to encompass entire paragraphs, since text checking needs | 638 // Expand the range to encompass entire paragraphs, since text checking needs |
639 // that much context. | 639 // that much context. |
640 int selectionOffset = 0; | 640 int selectionOffset = 0; |
641 int ambiguousBoundaryOffset = -1; | 641 int ambiguousBoundaryOffset = -1; |
642 | 642 |
643 if (frame().selection().isCaret()) { | 643 if (frame().selection().isCaret()) { |
644 // TODO(xiaochengh): The following comment does not match the current | 644 // TODO(xiaochengh): The following comment does not match the current |
645 // behavior and should be rewritten. | 645 // behavior and should be rewritten. |
646 // Attempt to save the caret position so we can restore it later if needed | 646 // Attempt to save the caret position so we can restore it later if needed |
647 const Position& caretPosition = frame().selection().end(); | 647 const Position& caretPosition = |
| 648 frame().selection().computeVisibleSelectionInDOMTreeDeprecated().end(); |
648 selectionOffset = paragraph.offsetTo(caretPosition); | 649 selectionOffset = paragraph.offsetTo(caretPosition); |
649 if (selectionOffset > 0 && | 650 if (selectionOffset > 0 && |
650 static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && | 651 static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && |
651 isAmbiguousBoundaryCharacter( | 652 isAmbiguousBoundaryCharacter( |
652 paragraph.textCharAt(selectionOffset - 1))) { | 653 paragraph.textCharAt(selectionOffset - 1))) { |
653 ambiguousBoundaryOffset = selectionOffset - 1; | 654 ambiguousBoundaryOffset = selectionOffset - 1; |
654 } | 655 } |
655 } | 656 } |
656 | 657 |
657 const int spellingRangeEndOffset = paragraph.checkingEnd(); | 658 const int spellingRangeEndOffset = paragraph.checkingEnd(); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 startOfNextParagraph(createVisiblePosition(paragraphEnd)); | 1210 startOfNextParagraph(createVisiblePosition(paragraphEnd)); |
1210 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 1211 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
1211 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); | 1212 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); |
1212 firstIteration = false; | 1213 firstIteration = false; |
1213 totalLengthProcessed += currentLength; | 1214 totalLengthProcessed += currentLength; |
1214 } | 1215 } |
1215 return std::make_pair(firstFoundItem, firstFoundOffset); | 1216 return std::make_pair(firstFoundItem, firstFoundOffset); |
1216 } | 1217 } |
1217 | 1218 |
1218 } // namespace blink | 1219 } // namespace blink |
OLD | NEW |