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

Unified Diff: Source/platform/fonts/Font.h

Issue 1192223002: Optimize Complex Text Shaping and Caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressing review comments Created 5 years, 6 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: Source/platform/fonts/Font.h
diff --git a/Source/platform/fonts/Font.h b/Source/platform/fonts/Font.h
index 5460b6a0d2c0370a1f65f2531bc62b47f8c834e5..91e021b40ad68a17fd72da21f83ff2a4037a8b7f 100644
--- a/Source/platform/fonts/Font.h
+++ b/Source/platform/fonts/Font.h
@@ -30,6 +30,7 @@
#include "platform/fonts/FontFallbackList.h"
#include "platform/fonts/SimpleFontData.h"
#include "platform/fonts/TextBlob.h"
+#include "platform/text/TabSize.h"
#include "platform/text/TextDirection.h"
#include "platform/text/TextPath.h"
#include "wtf/HashMap.h"
@@ -105,6 +106,17 @@ public:
GlyphData glyphDataForCharacter(UChar32&, bool mirror, bool normalizeSpace = false, FontDataVariant = AutoVariant) const;
CodePath codePath(const TextRunPaintInfo&) const;
+ // Whether the font supports shaping word by word instead of shaping the
+ // full run in one go. Allows better caching for fonts where space cannot
+ // participate in kerning and/or ligatures.
+ bool canShapeWordByWord() const;
+
+ void setCanShapeWordByWordForTesting(bool b)
+ {
+ m_canShapeWordByWord = b;
+ m_shapeWordByWordComputed = true;
+ }
+
private:
enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
@@ -129,6 +141,8 @@ private:
int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;
FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const;
+ bool computeCanShapeWordByWord() const;
+
friend struct SimpleShaper;
public:
@@ -147,6 +161,8 @@ private:
FontDescription m_fontDescription;
mutable RefPtr<FontFallbackList> m_fontFallbackList;
+ mutable unsigned m_canShapeWordByWord : 1;
+ mutable unsigned m_shapeWordByWordComputed : 1;
};
inline Font::~Font()

Powered by Google App Engine
This is Rietveld 408576698