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

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

Issue 2341053002: Mark the createVisiblePosition overloads as deprecated (Closed)
Patch Set: minor revision Created 4 years, 3 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 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 17 matching lines...) Expand all
28 28
29 #include "core/dom/Range.h" 29 #include "core/dom/Range.h"
30 #include "core/editing/VisiblePosition.h" 30 #include "core/editing/VisiblePosition.h"
31 #include "core/editing/VisibleUnits.h" 31 #include "core/editing/VisibleUnits.h"
32 #include "core/editing/iterators/CharacterIterator.h" 32 #include "core/editing/iterators/CharacterIterator.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 static EphemeralRange expandToParagraphBoundary(const EphemeralRange& range) 36 static EphemeralRange expandToParagraphBoundary(const EphemeralRange& range)
37 { 37 {
38 const VisiblePosition& start = createVisiblePosition(range.startPosition()); 38 const VisiblePosition& start = createVisiblePositionDeprecated(range.startPo sition());
39 DCHECK(start.isNotNull()) << range.startPosition(); 39 DCHECK(start.isNotNull()) << range.startPosition();
40 const Position& paragraphStart = startOfParagraph(start).deepEquivalent(); 40 const Position& paragraphStart = startOfParagraph(start).deepEquivalent();
41 DCHECK(paragraphStart.isNotNull()) << range.startPosition(); 41 DCHECK(paragraphStart.isNotNull()) << range.startPosition();
42 42
43 const VisiblePosition& end = createVisiblePosition(range.endPosition()); 43 const VisiblePosition& end = createVisiblePositionDeprecated(range.endPositi on());
44 DCHECK(end.isNotNull()) << range.endPosition(); 44 DCHECK(end.isNotNull()) << range.endPosition();
45 const Position& paragraphEnd = endOfParagraph(end).deepEquivalent(); 45 const Position& paragraphEnd = endOfParagraph(end).deepEquivalent();
46 DCHECK(paragraphEnd.isNotNull()) << range.endPosition(); 46 DCHECK(paragraphEnd.isNotNull()) << range.endPosition();
47 47
48 // TODO(xiaochengh): There are some cases (crbug.com/640112) where we get 48 // TODO(xiaochengh): There are some cases (crbug.com/640112) where we get
49 // |paragraphStart > paragraphEnd|, which is the reason we cannot directly 49 // |paragraphStart > paragraphEnd|, which is the reason we cannot directly
50 // return |EphemeralRange(paragraphStart, paragraphEnd)|. This is not 50 // return |EphemeralRange(paragraphStart, paragraphEnd)|. This is not
51 // desired, though. We should do more investigation to ensure that why 51 // desired, though. We should do more investigation to ensure that why
52 // |paragraphStart <= paragraphEnd| is violated. 52 // |paragraphStart <= paragraphEnd| is violated.
53 const Position& resultStart = paragraphStart.isNotNull() && paragraphStart < = range.startPosition() ? paragraphStart : range.startPosition(); 53 const Position& resultStart = paragraphStart.isNotNull() && paragraphStart < = range.startPosition() ? paragraphStart : range.startPosition();
(...skipping 27 matching lines...) Expand all
81 { 81 {
82 } 82 }
83 83
84 TextCheckingParagraph::~TextCheckingParagraph() 84 TextCheckingParagraph::~TextCheckingParagraph()
85 { 85 {
86 } 86 }
87 87
88 void TextCheckingParagraph::expandRangeToNextEnd() 88 void TextCheckingParagraph::expandRangeToNextEnd()
89 { 89 {
90 DCHECK(m_checkingRange.isNotNull()); 90 DCHECK(m_checkingRange.isNotNull());
91 setParagraphRange(EphemeralRange(paragraphRange().startPosition(), endOfPara graph(startOfNextParagraph(createVisiblePosition(paragraphRange().startPosition( )))).deepEquivalent())); 91 setParagraphRange(EphemeralRange(paragraphRange().startPosition(), endOfPara graph(startOfNextParagraph(createVisiblePositionDeprecated(paragraphRange().star tPosition()))).deepEquivalent()));
92 invalidateParagraphRangeValues(); 92 invalidateParagraphRangeValues();
93 } 93 }
94 94
95 void TextCheckingParagraph::invalidateParagraphRangeValues() 95 void TextCheckingParagraph::invalidateParagraphRangeValues()
96 { 96 {
97 m_checkingStart = m_checkingEnd = -1; 97 m_checkingStart = m_checkingEnd = -1;
98 m_offsetAsRange = EphemeralRange(); 98 m_offsetAsRange = EphemeralRange();
99 m_text = String(); 99 m_text = String();
100 } 100 }
101 101
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 int TextCheckingParagraph::checkingLength() const 180 int TextCheckingParagraph::checkingLength() const
181 { 181 {
182 DCHECK(m_checkingRange.isNotNull()); 182 DCHECK(m_checkingRange.isNotNull());
183 if (-1 == m_checkingLength) 183 if (-1 == m_checkingLength)
184 m_checkingLength = TextIterator::rangeLength(checkingRange().startPositi on(), checkingRange().endPosition()); 184 m_checkingLength = TextIterator::rangeLength(checkingRange().startPositi on(), checkingRange().endPosition());
185 return m_checkingLength; 185 return m_checkingLength;
186 } 186 }
187 187
188 } // namespace blink 188 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698