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

Unified Diff: third_party/WebKit/Source/platform/text/Hyphenation.cpp

Issue 1994483002: Compute min-content width when hyphenation is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix 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/platform/text/Hyphenation.cpp
diff --git a/third_party/WebKit/Source/platform/text/Hyphenation.cpp b/third_party/WebKit/Source/platform/text/Hyphenation.cpp
index 563b60f101c31bf096436336029030a7dfc7ab43..370b52270fa0eba2bdf222487029c8dca4dae2ae 100644
--- a/third_party/WebKit/Source/platform/text/Hyphenation.cpp
+++ b/third_party/WebKit/Source/platform/text/Hyphenation.cpp
@@ -34,4 +34,19 @@ void Hyphenation::clearForTesting()
getHyphenationMap().clear();
}
+Vector<size_t, 8> Hyphenation::hyphenLocations(const StringView& text,
+ size_t minimumPrefixLength, size_t minimumSuffixLength) const
+{
+ Vector<size_t, 8> hyphenLocations;
+ size_t hyphenLocation = text.length();
+ if (hyphenLocation <= minimumSuffixLength)
+ return hyphenLocations;
+ hyphenLocation -= minimumSuffixLength;
+
+ while ((hyphenLocation = lastHyphenLocation(text, hyphenLocation)) >= minimumPrefixLength)
+ hyphenLocations.append(hyphenLocation);
+
+ return hyphenLocations;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698