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

Side by Side Diff: third_party/WebKit/Source/core/testing/MockHyphenation.cpp

Issue 2025503002: Revert of Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/testing/MockHyphenation.h" 5 #include "core/testing/MockHyphenation.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 size_t MockHyphenation::lastHyphenLocation(const StringView& text, 9 size_t MockHyphenation::lastHyphenLocation(const StringView& text,
10 size_t beforeIndex) const 10 size_t beforeIndex) const
11 { 11 {
12 String str = text.toString(); 12 RefPtr<StringImpl> str = text.toString();
13 if (str.endsWith("phenation", TextCaseASCIIInsensitive)) { 13 if (str->endsWithIgnoringASCIICase("phenation", 9)) {
14 if (beforeIndex - (str.length() - 9) > 4) 14 if (beforeIndex - (str->length() - 9) > 4)
15 return 4 + (str.length() - 9); 15 return 4 + (str->length() - 9);
16 if (str.endsWith("hyphenation", TextCaseASCIIInsensitive) 16 if (str->endsWithIgnoringASCIICase("hyphenation", 11)
17 && beforeIndex - (str.length() - 11) > 2) { 17 && beforeIndex - (str->length() - 11) > 2) {
18 return 2 + (str.length() - 11); 18 return 2 + (str->length() - 11);
19 } 19 }
20 } 20 }
21 return 0; 21 return 0;
22 } 22 }
23 23
24 } // namespace blink 24 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698