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

Unified Diff: Source/platform/text/TextRun.h

Issue 567543002: Avoid re-parsing of string in fillText and measureText in Canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating code and adding Layout test case Created 6 years, 3 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/text/TextRun.h
diff --git a/Source/platform/text/TextRun.h b/Source/platform/text/TextRun.h
index d5f6be43cf44bf269d5c09084f216684d87fb4bd..eaa57675a567739fe367bb6cf97a97a687c2d7c3 100644
--- a/Source/platform/text/TextRun.h
+++ b/Source/platform/text/TextRun.h
@@ -68,6 +68,7 @@ public:
, m_characterScanForCodePath(characterScanForCodePath)
, m_disableSpacing(false)
, m_tabSize(0)
+ , m_spaceNormalize(false)
{
m_data.characters8 = c;
}
@@ -86,11 +87,12 @@ public:
, m_characterScanForCodePath(characterScanForCodePath)
, m_disableSpacing(false)
, m_tabSize(0)
+ , m_spaceNormalize(false)
{
m_data.characters16 = c;
}
- TextRun(const String& string, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true)
+ TextRun(const String& string, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, bool spaceNormalize = false)
: m_charactersLength(string.length())
, m_len(string.length())
, m_xpos(xpos)
@@ -103,6 +105,7 @@ public:
, m_characterScanForCodePath(characterScanForCodePath)
, m_disableSpacing(false)
, m_tabSize(0)
+ , m_spaceNormalize(spaceNormalize)
{
if (!m_charactersLength) {
m_is8Bit = true;
@@ -116,7 +119,7 @@ public:
}
}
- TextRun(const StringView& string, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true)
+ TextRun(const StringView& string, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, bool spaceNormalize = false)
: m_charactersLength(string.length())
, m_len(string.length())
, m_xpos(xpos)
@@ -129,6 +132,7 @@ public:
, m_characterScanForCodePath(characterScanForCodePath)
, m_disableSpacing(false)
, m_tabSize(0)
+ , m_spaceNormalize(spaceNormalize)
{
if (!m_charactersLength) {
m_is8Bit = true;
@@ -167,6 +171,9 @@ public:
int length() const { return m_len; }
int charactersLength() const { return m_charactersLength; }
+ bool isSpaceNormalize() const { return m_spaceNormalize; }
eae 2014/09/16 00:46:34 bool normalizeSpace() void setNormalizeSpace
h.joshi 2014/09/16 05:48:11 Done.
+ void setSpaceNormalize(bool spaceNormalize) { m_spaceNormalize = spaceNormalize; }
+
void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;}
void setText(const UChar* c, unsigned len) { m_data.characters16 = c; m_len = len; m_is8Bit = false;}
void setText(const String&);
@@ -231,6 +238,7 @@ private:
unsigned m_characterScanForCodePath : 1;
unsigned m_disableSpacing : 1;
unsigned m_tabSize;
+ bool m_spaceNormalize;
RefPtr<RenderingContext> m_renderingContext;
};

Powered by Google App Engine
This is Rietveld 408576698