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

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

Issue 2124213002: Make EphemeralRange constructor not to accept invalid start and end positions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-07T18:31:23 Created 4 years, 5 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/SpellChecker.cpp ('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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 bool TextCheckingParagraph::isEmpty() const 192 bool TextCheckingParagraph::isEmpty() const
193 { 193 {
194 // Both predicates should have same result, but we check both just to be sur e. 194 // Both predicates should have same result, but we check both just to be sur e.
195 // We need to investigate to remove this redundancy. 195 // We need to investigate to remove this redundancy.
196 return isRangeEmpty() || isTextEmpty(); 196 return isRangeEmpty() || isTextEmpty();
197 } 197 }
198 198
199 EphemeralRange TextCheckingParagraph::offsetAsRange() const 199 EphemeralRange TextCheckingParagraph::offsetAsRange() const
200 { 200 {
201 DCHECK(m_checkingRange.isNotNull()); 201 DCHECK(m_checkingRange.isNotNull());
202 if (m_offsetAsRange.isNull()) 202 if (m_offsetAsRange.isNotNull())
203 m_offsetAsRange = EphemeralRange(paragraphRange().startPosition(), check ingRange().startPosition()); 203 return m_offsetAsRange;
204 204 const Position& paragraphStart = paragraphRange().startPosition();
205 const Position& checkingStart = checkingRange().startPosition();
206 if (paragraphStart <= checkingStart) {
207 m_offsetAsRange = EphemeralRange(paragraphStart, checkingStart);
208 return m_offsetAsRange;
209 }
210 // editing/pasteboard/paste-table-001.html and more reach here.
211 m_offsetAsRange = EphemeralRange(checkingStart, paragraphStart);
205 return m_offsetAsRange; 212 return m_offsetAsRange;
206 } 213 }
207 214
208 const String& TextCheckingParagraph::text() const 215 const String& TextCheckingParagraph::text() const
209 { 216 {
210 DCHECK(m_checkingRange.isNotNull()); 217 DCHECK(m_checkingRange.isNotNull());
211 if (m_text.isEmpty()) 218 if (m_text.isEmpty())
212 m_text = plainText(paragraphRange()); 219 m_text = plainText(paragraphRange());
213 return m_text; 220 return m_text;
214 } 221 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return false; 593 return false;
587 594
588 const Settings* settings = frame->settings(); 595 const Settings* settings = frame->settings();
589 if (!settings) 596 if (!settings)
590 return false; 597 return false;
591 598
592 return settings->unifiedTextCheckerEnabled(); 599 return settings->unifiedTextCheckerEnabled();
593 } 600 }
594 601
595 } // namespace blink 602 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698