Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-08T18:08:39 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DCHECK(request);
567 if (!frame().selection().isAvailable()) {
568 // "editing/spelling/spellcheck-async-remove-frame.html" reaches here.
569 return;
570 }
567 if (!request->isValid()) 571 if (!request->isValid())
568 return; 572 return;
573 if (request->rootEditableElement()->document() != frame().selection().docume nt()) {
574 // we ignore |request| made for another document.
575 // "editing/spelling/spellcheck-sequencenum.html" and others reach here.
576 return;
577 }
569 578
570 TextCheckingTypeMask textCheckingOptions = request->data().mask(); 579 TextCheckingTypeMask textCheckingOptions = request->data().mask();
571 TextCheckingParagraph paragraph(request->checkingRange(), request->paragraph Range()); 580 TextCheckingParagraph paragraph(request->checkingRange(), request->paragraph Range());
572 581
573 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling; 582 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
574 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; 583 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
575 584
576 // Expand the range to encompass entire paragraphs, since text checking need s that much context. 585 // Expand the range to encompass entire paragraphs, since text checking need s that much context.
577 int selectionOffset = 0; 586 int selectionOffset = 0;
578 int ambiguousBoundaryOffset = -1; 587 int ambiguousBoundaryOffset = -1;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 visitor->trace(m_frame); 945 visitor->trace(m_frame);
937 visitor->trace(m_spellCheckRequester); 946 visitor->trace(m_spellCheckRequester);
938 } 947 }
939 948
940 void SpellChecker::prepareForLeakDetection() 949 void SpellChecker::prepareForLeakDetection()
941 { 950 {
942 m_spellCheckRequester->prepareForLeakDetection(); 951 m_spellCheckRequester->prepareForLeakDetection();
943 } 952 }
944 953
945 } // namespace blink 954 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionEditor.cpp ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698