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

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShapeIterator.h

Issue 1894863002: (CANCELED) Limit word length to shape when !getTypesettingFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 4 years, 8 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 | « no previous file | third_party/WebKit/Source/platform/fonts/shaping/ShapeCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShapeIterator.h
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShapeIterator.h b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShapeIterator.h
index 4a3512485dde4a463beb0dcbfd11d824560bade1..133ee97afbf26cebc70bcbff2199ba07b4bf499e 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShapeIterator.h
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShapeIterator.h
@@ -53,6 +53,10 @@ public:
// use the cache or if the font doesn't support word by word shaping
// fall back on shaping the entire run.
m_shapeByWord = m_font->canShapeWordByWord();
+
+ // Minified JS/CSS and hex/base64 data have extraordinary long "words".
+ m_limitWordLength = m_shapeByWord && m_textRun.is8Bit()
+ && !m_font->getFontDescription().getTypesettingFeatures();
}
bool next(RefPtr<ShapeResult>* wordResult)
@@ -148,10 +152,13 @@ private:
}
}
+ const unsigned limit = m_limitWordLength
+ ? std::min(length, m_startIndex + ShapeCache::maxLengthToCache())
+ : length;
for (unsigned i = m_startIndex + 1; ; i++) {
- if (i == length || isWordDelimiter(m_textRun[i])) {
+ if (i == limit || isWordDelimiter(m_textRun[i]))
return i;
- }
+
if (!m_textRun.is8Bit()) {
UChar32 nextChar;
U16_GET(m_textRun.characters16(), 0, i, length, nextChar);
@@ -220,8 +227,9 @@ private:
const Font* m_font;
ShapeResultSpacing m_spacing;
float m_widthSoFar; // Used only when allowTabs()
- unsigned m_startIndex : 31;
+ unsigned m_startIndex : 30;
unsigned m_shapeByWord : 1;
+ unsigned m_limitWordLength : 1;
};
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/fonts/shaping/ShapeCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698