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

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

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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 class Range; 39 class Range;
40 40
41 class CORE_EXPORT PlainTextRange { 41 class CORE_EXPORT PlainTextRange {
42 STACK_ALLOCATED(); 42 STACK_ALLOCATED();
43 public: 43 public:
44 PlainTextRange(); 44 PlainTextRange();
45 PlainTextRange(const PlainTextRange&); 45 PlainTextRange(const PlainTextRange&);
46 explicit PlainTextRange(int location); 46 explicit PlainTextRange(int location);
47 PlainTextRange(int start, int end); 47 PlainTextRange(int start, int end);
48 48
49 size_t end() const { ASSERT(!isNull()); return m_end; } 49 size_t end() const { DCHECK(isNotNull()); return m_end; }
50 size_t start() const { ASSERT(!isNull()); return m_start; } 50 size_t start() const { DCHECK(isNotNull()); return m_start; }
51 bool isNull() const { return m_start == kNotFound; } 51 bool isNull() const { return m_start == kNotFound; }
52 bool isNotNull() const { return m_start != kNotFound; } 52 bool isNotNull() const { return m_start != kNotFound; }
53 size_t length() const { ASSERT(!isNull()); return m_end - m_start; } 53 size_t length() const { DCHECK(isNotNull()); return m_end - m_start; }
54 54
55 EphemeralRange createRange(const ContainerNode& scope) const; 55 EphemeralRange createRange(const ContainerNode& scope) const;
56 EphemeralRange createRangeForSelection(const ContainerNode& scope) const; 56 EphemeralRange createRangeForSelection(const ContainerNode& scope) const;
57 57
58 static PlainTextRange create(const ContainerNode& scope, const EphemeralRang e&); 58 static PlainTextRange create(const ContainerNode& scope, const EphemeralRang e&);
59 static PlainTextRange create(const ContainerNode& scope, const Range&); 59 static PlainTextRange create(const ContainerNode& scope, const Range&);
60 60
61 private: 61 private:
62 PlainTextRange& operator=(const PlainTextRange&) = delete; 62 PlainTextRange& operator=(const PlainTextRange&) = delete;
63 63
64 enum GetRangeFor { ForGeneric, ForSelection }; 64 enum GetRangeFor { ForGeneric, ForSelection };
65 EphemeralRange createRangeFor(const ContainerNode& scope, GetRangeFor) const ; 65 EphemeralRange createRangeFor(const ContainerNode& scope, GetRangeFor) const ;
66 66
67 const size_t m_start; 67 const size_t m_start;
68 const size_t m_end; 68 const size_t m_end;
69 }; 69 };
70 70
71 } // namespace blink 71 } // namespace blink
72 72
73 #endif // PlainTextRange_h 73 #endif // PlainTextRange_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698