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

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

Issue 1978683002: Enable hyphens: auto and none in BreakingContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments for heuristic, adjust widths of hyphens-auto-mock test Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/testing/MockHyphenation.h"
6
7 namespace blink {
8
9 size_t MockHyphenation::lastHyphenLocation(const StringView& text,
10 size_t beforeIndex) const
11 {
12 RefPtr<StringImpl> str = text.toString();
13 if (str->endsWithIgnoringASCIICase("phenation", 9)) {
14 if (beforeIndex - (str->length() - 9) > 4)
15 return 4 + (str->length() - 9);
16 if (str->endsWithIgnoringASCIICase("hyphenation", 11)
17 && beforeIndex - (str->length() - 11) > 2) {
18 return 2 + (str->length() - 11);
19 }
20 }
21 return 0;
22 }
23
24 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/MockHyphenation.h ('k') | third_party/WebKit/Source/platform/fonts/Font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698