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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 594683002: RTHB: Limit text to 10k code units (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 7994a804373d56df4d23ae02ed7bc543fe9aa1e8..442199a6d7f69b837645513e8f4b722b37f1df93 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -28,6 +28,9 @@ namespace gfx {
namespace {
+// Text length limit. Longer strings are slow and not fully tested.
+const size_t kMaxTextLength = 10000;
+
// The maximum number of scripts a Unicode character can belong to. This value
// is arbitrarily chosen to be a good limit because it is unlikely for a single
// character to belong to more scripts.
@@ -572,7 +575,9 @@ Range TextRunHarfBuzz::GetGraphemeBounds(
RenderTextHarfBuzz::RenderTextHarfBuzz()
: RenderText(),
- needs_layout_(false) {}
+ needs_layout_(false) {
+ set_truncate_length(kMaxTextLength);
+}
RenderTextHarfBuzz::~RenderTextHarfBuzz() {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698