Skip to content

Commit

Permalink
Reduce the number of text reshaping in RenderText
Browse files Browse the repository at this point in the history
Short Design Doc: http://goo.gl/w6Q9k8
1) Compute ElidedText on demand
2) Separate elided text and non elided text. Create elided text and runs only when necessary.
3) Use known width in RenderText::Elide
4) Don't reshape to get GetGraphemeIterator.

This CL also adds a few trace event so that we can identify the UI jank caused by text rendering performance.

BUG=451459
R=msw@chromium.org

Review URL: https://codereview.chromium.org/916203002

Cr-Commit-Position: refs/heads/master@{#316375}
  • Loading branch information
mitoshima authored and Commit bot committed Feb 14, 2015
1 parent 973842b commit 0a243a4
Show file tree
Hide file tree
Showing 11 changed files with 698 additions and 389 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/omnibox/omnibox_result_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ int OmniboxResultView::DrawRenderText(
// vertically stack the ellipsis by restricting the end edge (right_x).
const bool is_ui_rtl = base::i18n::IsRTL();
const bool is_match_contents_rtl =
(render_text->GetTextDirection() == base::i18n::RIGHT_TO_LEFT);
(render_text->GetDisplayTextDirection() == base::i18n::RIGHT_TO_LEFT);
const int offset =
GetDisplayOffset(match, is_ui_rtl, is_match_contents_rtl);

Expand Down
2 changes: 1 addition & 1 deletion ui/gfx/canvas_skia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void Canvas::DrawStringRectWithShadows(const base::string16& text,
// for LTR text. RTL text is still elided (on the left) with "...".
if (elide_text) {
render_text->SetText(adjusted_text);
if (render_text->GetTextDirection() == base::i18n::LEFT_TO_RIGHT) {
if (render_text->GetDisplayTextDirection() == base::i18n::LEFT_TO_RIGHT) {
render_text->SetElideBehavior(FADE_TAIL);
elide_text = false;
}
Expand Down
Loading

0 comments on commit 0a243a4

Please sign in to comment.