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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.cpp b/third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.cpp
index 19c2e950996a6907d6b75d0e184389b3bfc88e0f..7ba54bf4aacd1a37851e81d99304929ca4abce93 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/TextCheckingHelper.cpp
@@ -199,9 +199,16 @@ bool TextCheckingParagraph::isEmpty() const
EphemeralRange TextCheckingParagraph::offsetAsRange() const
{
DCHECK(m_checkingRange.isNotNull());
- if (m_offsetAsRange.isNull())
- m_offsetAsRange = EphemeralRange(paragraphRange().startPosition(), checkingRange().startPosition());
-
+ if (m_offsetAsRange.isNotNull())
+ return m_offsetAsRange;
+ const Position& paragraphStart = paragraphRange().startPosition();
+ const Position& checkingStart = checkingRange().startPosition();
+ if (paragraphStart <= checkingStart) {
+ m_offsetAsRange = EphemeralRange(paragraphStart, checkingStart);
+ return m_offsetAsRange;
+ }
+ // editing/pasteboard/paste-table-001.html and more reach here.
+ m_offsetAsRange = EphemeralRange(checkingStart, paragraphStart);
return m_offsetAsRange;
}
« 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