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

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

Issue 1563783003: Optimizations to Spellchecking Chunk Generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 misspelling.decoration = TextDecorationTypeSpelling; 88 misspelling.decoration = TextDecorationTypeSpelling;
89 misspelling.location = start + wordStart + misspellingLocation; 89 misspelling.location = start + wordStart + misspellingLocation;
90 misspelling.length = misspellingLength; 90 misspelling.length = misspellingLength;
91 results.append(misspelling); 91 results.append(misspelling);
92 } 92 }
93 93
94 wordStart = wordEnd; 94 wordStart = wordEnd;
95 } 95 }
96 } 96 }
97 97
98 // TODO(yosin): We should move |expandRangeToSentenceBoundary()| to
99 // "SpellChcker.cpp" as static function, since there is only one call site in
100 // |SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar()|.
101 EphemeralRange expandRangeToSentenceBoundary(const EphemeralRange& range)
102 {
103 ASSERT(range.isNotNull());
104 const VisiblePosition& visibleStart = createVisiblePosition(range.startPosit ion());
105 ASSERT(visibleStart.isNotNull());
106 const Position& sentenceStart = startOfSentence(visibleStart).deepEquivalent ();
107 const VisiblePosition& visibleEnd = createVisiblePosition(range.endPosition( ));
108 ASSERT(visibleEnd.isNotNull());
109 const Position& sentenceEnd = endOfSentence(visibleEnd).deepEquivalent();
110 return EphemeralRange(sentenceStart.isNull() ? range.startPosition() : sente nceStart, sentenceEnd.isNull() ? range.endPosition() : sentenceEnd);
111 }
112
113 static EphemeralRange expandToParagraphBoundary(const EphemeralRange& range) 98 static EphemeralRange expandToParagraphBoundary(const EphemeralRange& range)
114 { 99 {
115 return EphemeralRange(startOfParagraph(createVisiblePosition(range.startPosi tion())).deepEquivalent(), endOfParagraph(createVisiblePosition(range.endPositio n())).deepEquivalent()); 100 return EphemeralRange(startOfParagraph(createVisiblePosition(range.startPosi tion())).deepEquivalent(), endOfParagraph(createVisiblePosition(range.endPositio n())).deepEquivalent());
116 } 101 }
117 102
118 TextCheckingParagraph::TextCheckingParagraph(const EphemeralRange& checkingRange ) 103 TextCheckingParagraph::TextCheckingParagraph(const EphemeralRange& checkingRange )
119 : m_checkingRange(checkingRange) 104 : m_checkingRange(checkingRange)
120 , m_checkingStart(-1) 105 , m_checkingStart(-1)
121 , m_checkingEnd(-1) 106 , m_checkingEnd(-1)
122 , m_checkingLength(-1) 107 , m_checkingLength(-1)
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 return false; 564 return false;
580 565
581 const Settings* settings = frame->settings(); 566 const Settings* settings = frame->settings();
582 if (!settings) 567 if (!settings)
583 return false; 568 return false;
584 569
585 return settings->unifiedTextCheckerEnabled(); 570 return settings->unifiedTextCheckerEnabled();
586 } 571 }
587 572
588 } 573 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698