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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/testing/MockHyphenation.cpp
diff --git a/third_party/WebKit/Source/core/testing/MockHyphenation.cpp b/third_party/WebKit/Source/core/testing/MockHyphenation.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e166d9a0dfdbbadf403973cd5e675d18980ed1e
--- /dev/null
+++ b/third_party/WebKit/Source/core/testing/MockHyphenation.cpp
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/testing/MockHyphenation.h"
+
+namespace blink {
+
+size_t MockHyphenation::lastHyphenLocation(const StringView& text,
+ size_t beforeIndex) const
+{
+ RefPtr<StringImpl> str = text.toString();
+ if (str->endsWithIgnoringASCIICase("phenation", 9)) {
+ if (beforeIndex - (str->length() - 9) > 4)
+ return 4 + (str->length() - 9);
+ if (str->endsWithIgnoringASCIICase("hyphenation", 11)
+ && beforeIndex - (str->length() - 11) > 2) {
+ return 2 + (str->length() - 11);
+ }
+ }
+ return 0;
+}
+
+} // namespace blink
« 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