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

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

Issue 2161683002: Add LayoutLocale class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test stability Created 4 years, 5 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.h
diff --git a/third_party/WebKit/Source/platform/text/Hyphenation.h b/third_party/WebKit/Source/platform/text/Hyphenation.h
index 2a22bfde7d2a6b5bf662cd7f60759156de52ebc7..0979cc75b7ead81ccb70e2ac7c45c85528ca7e97 100644
--- a/third_party/WebKit/Source/platform/text/Hyphenation.h
+++ b/third_party/WebKit/Source/platform/text/Hyphenation.h
@@ -6,7 +6,6 @@
#define Hyphenation_h
#include "platform/PlatformExport.h"
-#include "platform/fonts/Font.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/RefCounted.h"
@@ -15,12 +14,12 @@
namespace blink {
+class Font;
+
class PLATFORM_EXPORT Hyphenation : public RefCounted<Hyphenation> {
public:
virtual ~Hyphenation() {}
- static Hyphenation* get(const AtomicString& locale);
-
virtual size_t lastHyphenLocation(const StringView&, size_t beforeIndex) const = 0;
virtual Vector<size_t, 8> hyphenLocations(const StringView&) const;
@@ -28,27 +27,11 @@ public:
static const unsigned minimumSuffixLength = 2;
static int minimumPrefixWidth(const Font&);
- static void setForTesting(const AtomicString& locale, PassRefPtr<Hyphenation>);
- static void clearForTesting();
-
private:
- using HyphenationMap = HashMap<AtomicString, RefPtr<Hyphenation>, CaseFoldingHash>;
-
- static HyphenationMap& getHyphenationMap();
+ friend class LayoutLocale;
static PassRefPtr<Hyphenation> platformGetHyphenation(const AtomicString& locale);
};
-inline int Hyphenation::minimumPrefixWidth(const Font& font)
-{
- // If the maximum width available for the prefix before the hyphen is small, then it is very unlikely
- // that an hyphenation opportunity exists, so do not bother to look for it.
- // These are heuristic numbers for performance added in http://wkb.ug/45606
- const int minimumPrefixWidthNumerator = 5;
- const int minimumPrefixWidthDenominator = 4;
- return font.getFontDescription().computedPixelSize()
- * minimumPrefixWidthNumerator / minimumPrefixWidthDenominator;
-}
-
} // namespace blink
#endif // Hyphenation_h

Powered by Google App Engine
This is Rietveld 408576698