| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 TextCheckingParagraph paragraph(request->checkingRange(), | 633 TextCheckingParagraph paragraph(request->checkingRange(), |
| 634 request->checkingRange()); | 634 request->checkingRange()); |
| 635 | 635 |
| 636 // TODO(xiaochengh): The following comment does not match the current behavior | 636 // TODO(xiaochengh): The following comment does not match the current behavior |
| 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() |
| 644 .selection() |
| 645 .computeVisibleSelectionInDOMTreeDeprecated() |
| 646 .isCaret()) { |
| 644 // TODO(xiaochengh): The following comment does not match the current | 647 // TODO(xiaochengh): The following comment does not match the current |
| 645 // behavior and should be rewritten. | 648 // behavior and should be rewritten. |
| 646 // Attempt to save the caret position so we can restore it later if needed | 649 // Attempt to save the caret position so we can restore it later if needed |
| 647 const Position& caretPosition = frame().selection().end(); | 650 const Position& caretPosition = frame().selection().end(); |
| 648 selectionOffset = paragraph.offsetTo(caretPosition); | 651 selectionOffset = paragraph.offsetTo(caretPosition); |
| 649 if (selectionOffset > 0 && | 652 if (selectionOffset > 0 && |
| 650 static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && | 653 static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && |
| 651 isAmbiguousBoundaryCharacter( | 654 isAmbiguousBoundaryCharacter( |
| 652 paragraph.textCharAt(selectionOffset - 1))) { | 655 paragraph.textCharAt(selectionOffset - 1))) { |
| 653 ambiguousBoundaryOffset = selectionOffset - 1; | 656 ambiguousBoundaryOffset = selectionOffset - 1; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 startOfNextParagraph(createVisiblePosition(paragraphEnd)); | 1212 startOfNextParagraph(createVisiblePosition(paragraphEnd)); |
| 1210 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 1213 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
| 1211 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); | 1214 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); |
| 1212 firstIteration = false; | 1215 firstIteration = false; |
| 1213 totalLengthProcessed += currentLength; | 1216 totalLengthProcessed += currentLength; |
| 1214 } | 1217 } |
| 1215 return std::make_pair(firstFoundItem, firstFoundOffset); | 1218 return std::make_pair(firstFoundItem, firstFoundOffset); |
| 1216 } | 1219 } |
| 1217 | 1220 |
| 1218 } // namespace blink | 1221 } // namespace blink |
| OLD | NEW |