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

Side by Side Diff: third_party/WebKit/public/web/WebRange.h

Issue 2316423002: Introduce WebRange::isEmpty. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class WebRange final { 46 class WebRange final {
47 public: 47 public:
48 BLINK_EXPORT WebRange(int start, int length); 48 BLINK_EXPORT WebRange(int start, int length);
49 BLINK_EXPORT WebRange() {} 49 BLINK_EXPORT WebRange() {}
50 50
51 int startOffset() const { return m_start; } 51 int startOffset() const { return m_start; }
52 int endOffset() const { return m_end; } 52 int endOffset() const { return m_end; }
53 int length() const { return m_end - m_start; } 53 int length() const { return m_end - m_start; }
54 54
55 bool isNull() const { return m_start == -1 && m_end == -1; } 55 bool isNull() const { return m_start == -1 && m_end == -1; }
56 bool isEmpty() const { return m_start == m_end; }
56 57
57 #if BLINK_IMPLEMENTATION 58 #if BLINK_IMPLEMENTATION
58 WebRange(const EphemeralRange&); 59 WebRange(const EphemeralRange&);
59 WebRange(const PlainTextRange&); 60 WebRange(const PlainTextRange&);
60 61
61 EphemeralRange createEphemeralRange(LocalFrame*) const; 62 EphemeralRange createEphemeralRange(LocalFrame*) const;
62 #endif 63 #endif
63 64
64 private: 65 private:
65 // Note that this also matches the values for gfx::Range::InvalidRange 66 // Note that this also matches the values for gfx::Range::InvalidRange
66 // for easy conversion. 67 // for easy conversion.
67 int m_start = -1; 68 int m_start = -1;
68 int m_end = -1; 69 int m_end = -1;
69 }; 70 };
70 71
71 } // namespace blink 72 } // namespace blink
72 73
73 #endif 74 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698