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

Side by Side 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: eae review 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
« no previous file with comments | « third_party/WebKit/Source/platform/text/Hyphenation.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/text/Hyphenation.h" 5 #include "platform/text/Hyphenation.h"
6 6
7 #include "wtf/text/StringView.h" 7 #include "wtf/text/StringView.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 16 matching lines...) Expand all
27 void Hyphenation::setForTesting(const AtomicString& locale, PassRefPtr<Hyphenati on> hyphenation) 27 void Hyphenation::setForTesting(const AtomicString& locale, PassRefPtr<Hyphenati on> hyphenation)
28 { 28 {
29 getHyphenationMap().set(locale, hyphenation); 29 getHyphenationMap().set(locale, hyphenation);
30 } 30 }
31 31
32 void Hyphenation::clearForTesting() 32 void Hyphenation::clearForTesting()
33 { 33 {
34 getHyphenationMap().clear(); 34 getHyphenationMap().clear();
35 } 35 }
36 36
37 Vector<size_t, 8> Hyphenation::hyphenLocations(const StringView& text) const
38 {
39 Vector<size_t, 8> hyphenLocations;
40 size_t hyphenLocation = text.length();
41 if (hyphenLocation <= minimumSuffixLength)
42 return hyphenLocations;
43 hyphenLocation -= minimumSuffixLength;
44
45 while ((hyphenLocation = lastHyphenLocation(text, hyphenLocation)) >= minimu mPrefixLength)
46 hyphenLocations.append(hyphenLocation);
47
48 return hyphenLocations;
49 }
50
37 } // namespace blink 51 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/Hyphenation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698