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

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: Change CachingWordShaperTest as suggested Created 5 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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/fonts/Font.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.h
diff --git a/Source/platform/fonts/Font.h b/Source/platform/fonts/Font.h
index 9eb7ef52309e592f92084dc0038192325a64ea6c..79fe3513cf5438b3955d6961460b8b9fdea745a9 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()
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/fonts/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698