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

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

Issue 1878473002: ASSERT -> DCHECK in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Output info for some DCHECKs, add TODOs. Created 4 years, 8 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
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 28 matching lines...) Expand all
39 PlainTextRange::PlainTextRange() 39 PlainTextRange::PlainTextRange()
40 : m_start(kNotFound) 40 : m_start(kNotFound)
41 , m_end(kNotFound) 41 , m_end(kNotFound)
42 { 42 {
43 } 43 }
44 44
45 PlainTextRange::PlainTextRange(int location) 45 PlainTextRange::PlainTextRange(int location)
46 : m_start(location) 46 : m_start(location)
47 , m_end(location) 47 , m_end(location)
48 { 48 {
49 ASSERT(location >= 0); 49 DCHECK_GE(location, 0);
50 } 50 }
51 51
52 PlainTextRange::PlainTextRange(int start, int end) 52 PlainTextRange::PlainTextRange(int start, int end)
53 : m_start(start) 53 : m_start(start)
54 , m_end(end) 54 , m_end(end)
55 { 55 {
56 ASSERT(start >= 0); 56 DCHECK_GE(start, 0);
57 ASSERT(end >= 0); 57 DCHECK_GE(end, 0);
58 ASSERT(start <= end); 58 DCHECK_LE(start, end);
59 } 59 }
60 60
61 EphemeralRange PlainTextRange::createRange(const ContainerNode& scope) const 61 EphemeralRange PlainTextRange::createRange(const ContainerNode& scope) const
62 { 62 {
63 return createRangeFor(scope, ForGeneric); 63 return createRangeFor(scope, ForGeneric);
64 } 64 }
65 65
66 EphemeralRange PlainTextRange::createRangeForSelection(const ContainerNode& scop e) const 66 EphemeralRange PlainTextRange::createRangeForSelection(const ContainerNode& scop e) const
67 { 67 {
68 return createRangeFor(scope, ForSelection); 68 return createRangeFor(scope, ForSelection);
69 } 69 }
70 70
71 EphemeralRange PlainTextRange::createRangeFor(const ContainerNode& scope, GetRan geFor getRangeFor) const 71 EphemeralRange PlainTextRange::createRangeFor(const ContainerNode& scope, GetRan geFor getRangeFor) const
72 { 72 {
73 ASSERT(isNotNull()); 73 DCHECK(isNotNull());
74 74
75 size_t docTextPosition = 0; 75 size_t docTextPosition = 0;
76 bool startRangeFound = false; 76 bool startRangeFound = false;
77 77
78 Position textRunStartPosition; 78 Position textRunStartPosition;
79 Position textRunEndPosition; 79 Position textRunEndPosition;
80 80
81 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character; 81 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character;
82 if (getRangeFor == ForSelection) 82 if (getRangeFor == ForSelection)
83 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; 83 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 return PlainTextRange(start, end); 181 return PlainTextRange(start, end);
182 } 182 }
183 183
184 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Range& r ange) 184 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Range& r ange)
185 { 185 {
186 return create(scope, EphemeralRange(&range)); 186 return create(scope, EphemeralRange(&range));
187 } 187 }
188 188
189 } // namespace blink 189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698