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

Side by Side Diff: third_party/WebKit/Source/platform/text/Hyphenation.cpp

Issue 2385283002: reflow comments in platform/{testing,text} (Closed)
Patch Set: idunnolol Created 4 years, 2 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 "platform/text/Hyphenation.h" 5 #include "platform/text/Hyphenation.h"
6 6
7 #include "platform/fonts/Font.h" 7 #include "platform/fonts/Font.h"
8 #include "wtf/text/StringView.h" 8 #include "wtf/text/StringView.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 Vector<size_t, 8> Hyphenation::hyphenLocations(const StringView& text) const { 12 Vector<size_t, 8> Hyphenation::hyphenLocations(const StringView& text) const {
13 Vector<size_t, 8> hyphenLocations; 13 Vector<size_t, 8> hyphenLocations;
14 size_t hyphenLocation = text.length(); 14 size_t hyphenLocation = text.length();
15 if (hyphenLocation <= minimumSuffixLength) 15 if (hyphenLocation <= minimumSuffixLength)
16 return hyphenLocations; 16 return hyphenLocations;
17 hyphenLocation -= minimumSuffixLength; 17 hyphenLocation -= minimumSuffixLength;
18 18
19 while ((hyphenLocation = lastHyphenLocation(text, hyphenLocation)) >= 19 while ((hyphenLocation = lastHyphenLocation(text, hyphenLocation)) >=
20 minimumPrefixLength) 20 minimumPrefixLength)
21 hyphenLocations.append(hyphenLocation); 21 hyphenLocations.append(hyphenLocation);
22 22
23 return hyphenLocations; 23 return hyphenLocations;
24 } 24 }
25 25
26 int Hyphenation::minimumPrefixWidth(const Font& font) { 26 int Hyphenation::minimumPrefixWidth(const Font& font) {
27 // If the maximum width available for the prefix before the hyphen is small, t hen it is very unlikely 27 // If the maximum width available for the prefix before the hyphen is small,
28 // that an hyphenation opportunity exists, so do not bother to look for it. 28 // then it is very unlikely that an hyphenation opportunity exists, so do not
29 // These are heuristic numbers for performance added in http://wkb.ug/45606 29 // bother to look for it. These are heuristic numbers for performance added
30 // in http://wkb.ug/45606
30 const int minimumPrefixWidthNumerator = 5; 31 const int minimumPrefixWidthNumerator = 5;
31 const int minimumPrefixWidthDenominator = 4; 32 const int minimumPrefixWidthDenominator = 4;
32 return font.getFontDescription().computedPixelSize() * 33 return font.getFontDescription().computedPixelSize() *
33 minimumPrefixWidthNumerator / minimumPrefixWidthDenominator; 34 minimumPrefixWidthNumerator / minimumPrefixWidthDenominator;
34 } 35 }
35 36
36 } // namespace blink 37 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/DecodeEscapeSequences.h ('k') | third_party/WebKit/Source/platform/text/LineEnding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698