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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 // so comparePositions can be directly called. | 556 // so comparePositions can be directly called. |
557 if (comparePositions(chunkRange.endPosition(), checkRange.endPositio n()) < 0) | 557 if (comparePositions(chunkRange.endPosition(), checkRange.endPositio n()) < 0) |
558 checkRangeIterator.advance(TextIterator::rangeLength(chunkRange. endPosition(), checkRange.endPosition())); | 558 checkRangeIterator.advance(TextIterator::rangeLength(chunkRange. endPosition(), checkRange.endPosition())); |
559 } | 559 } |
560 } | 560 } |
561 } | 561 } |
562 | 562 |
563 void SpellChecker::markAndReplaceFor(SpellCheckRequest* request, const Vector<Te xtCheckingResult>& results) | 563 void SpellChecker::markAndReplaceFor(SpellCheckRequest* request, const Vector<Te xtCheckingResult>& results) |
564 { | 564 { |
565 TRACE_EVENT0("blink", "SpellChecker::markAndReplaceFor"); | 565 TRACE_EVENT0("blink", "SpellChecker::markAndReplaceFor"); |
566 DCHECK(request); | 566 if (!frame().selection().isAvailable()) { |
tkent
2016/06/07 23:41:59
Why do you remove the DCHECK?
yosin_UTC9
2016/06/08 04:06:10
Oops, it should be here.
Done.
| |
567 // "editing/spelling/spellcheck-async-remove-frame.html" reaches here. | |
568 return; | |
569 } | |
567 if (!request->isValid()) | 570 if (!request->isValid()) |
568 return; | 571 return; |
572 if (request->rootEditableElement()->document() != frame().selection().docume nt()) { | |
573 // we ignore |request| made for another document. | |
574 // "editing/spelling/spellcheck-sequencenum.html" and others reach here. | |
575 return; | |
576 } | |
569 | 577 |
570 TextCheckingTypeMask textCheckingOptions = request->data().mask(); | 578 TextCheckingTypeMask textCheckingOptions = request->data().mask(); |
571 TextCheckingParagraph paragraph(request->checkingRange(), request->paragraph Range()); | 579 TextCheckingParagraph paragraph(request->checkingRange(), request->paragraph Range()); |
572 | 580 |
573 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling; | 581 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling; |
574 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; | 582 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; |
575 | 583 |
576 // Expand the range to encompass entire paragraphs, since text checking need s that much context. | 584 // Expand the range to encompass entire paragraphs, since text checking need s that much context. |
577 int selectionOffset = 0; | 585 int selectionOffset = 0; |
578 int ambiguousBoundaryOffset = -1; | 586 int ambiguousBoundaryOffset = -1; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
936 visitor->trace(m_frame); | 944 visitor->trace(m_frame); |
937 visitor->trace(m_spellCheckRequester); | 945 visitor->trace(m_spellCheckRequester); |
938 } | 946 } |
939 | 947 |
940 void SpellChecker::prepareForLeakDetection() | 948 void SpellChecker::prepareForLeakDetection() |
941 { | 949 { |
942 m_spellCheckRequester->prepareForLeakDetection(); | 950 m_spellCheckRequester->prepareForLeakDetection(); |
943 } | 951 } |
944 | 952 |
945 } // namespace blink | 953 } // namespace blink |
OLD | NEW |