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

Unified Diff: third_party/WebKit/Source/wtf/text/AtomicString.h

Issue 2227903002: String::contains should use StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/Source/wtf/text/AtomicString.h
diff --git a/third_party/WebKit/Source/wtf/text/AtomicString.h b/third_party/WebKit/Source/wtf/text/AtomicString.h
index 55b612bc9a932e561e9c2cb0215064a1230c74d4..2dc75a75f35ef7499262a59cca3aedf2f9ae93e6 100644
--- a/third_party/WebKit/Source/wtf/text/AtomicString.h
+++ b/third_party/WebKit/Source/wtf/text/AtomicString.h
@@ -73,12 +73,6 @@ public:
UChar operator[](unsigned i) const { return m_string[i]; }
- bool contains(UChar c) const { return m_string.contains(c); }
- bool contains(const LChar* s, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
- { return m_string.contains(s, caseSensitivity); }
- bool contains(const String& s, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
- { return m_string.contains(s, caseSensitivity); }
-
// Find characters.
size_t find(UChar c, unsigned start = 0) const
{ return m_string.find(c, start); }
@@ -92,6 +86,10 @@ public:
size_t find(const StringView& value, unsigned start = 0, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
{ return m_string.find(value, start, caseSensitivity); }
+ bool contains(char c) const { return find(c) != kNotFound; }
+ bool contains(const StringView& value, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
+ { return find(value, 0, caseSensitivity) != kNotFound; }
+
bool startsWith(const StringView& prefix, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
{ return m_string.startsWith(prefix, caseSensitivity); }
bool startsWith(UChar character) const

Powered by Google App Engine
This is Rietveld 408576698