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

Issue 382793004: RenderTextWin: Unroll the loop in LayoutTextRun for clarity (Closed)

Created:
6 years, 5 months ago by ckocagil
Modified:
6 years, 5 months ago
CC:
chromium-reviews
Project:
chromium
Visibility:
Public.

Description

RenderTextWin: Unroll the loop in LayoutTextRun for clarity BUG= R=msw TBR=asvitkine Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=282550

Patch Set 1 #

Total comments: 9

Patch Set 2 : comments addressed #

Total comments: 2

Patch Set 3 : nit #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -55 lines) Patch
M ui/gfx/render_text_win.h View 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/render_text_win.cc View 1 2 2 chunks +60 lines, -54 lines 4 comments Download

Messages

Total messages: 9 (0 generated)
ckocagil
6 years, 5 months ago (2014-07-10 15:58:25 UTC) #1
msw
https://codereview.chromium.org/382793004/diff/1/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): https://codereview.chromium.org/382793004/diff/1/ui/gfx/render_text_win.cc#newcode1079 ui/gfx/render_text_win.cc:1079: return; Should we ever add the original font to ...
6 years, 5 months ago (2014-07-10 22:59:50 UTC) #2
ckocagil
https://codereview.chromium.org/382793004/diff/1/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): https://codereview.chromium.org/382793004/diff/1/ui/gfx/render_text_win.cc#newcode1079 ui/gfx/render_text_win.cc:1079: return; On 2014/07/10 22:59:50, msw wrote: > Should we ...
6 years, 5 months ago (2014-07-10 23:41:33 UTC) #3
msw
Despite some duplicated code, this make the current (imperfect) fallback logic a bit clearer, so ...
6 years, 5 months ago (2014-07-11 00:08:39 UTC) #4
ckocagil
Alexei: TBRing to you, can you take a look when you're back? https://codereview.chromium.org/382793004/diff/20001/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc ...
6 years, 5 months ago (2014-07-11 01:29:25 UTC) #5
ckocagil
The CQ bit was checked by ckocagil@chromium.org
6 years, 5 months ago (2014-07-11 01:29:50 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ckocagil@chromium.org/382793004/40001
6 years, 5 months ago (2014-07-11 01:30:43 UTC) #7
commit-bot: I haz the power
Change committed as 282550
6 years, 5 months ago (2014-07-11 04:57:46 UTC) #8
Alexei Svitkine (slow)
6 years, 5 months ago (2014-07-15 19:48:20 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/382793004/diff/40001/ui/gfx/render_text_win.cc
File ui/gfx/render_text_win.cc (right):

https://codereview.chromium.org/382793004/diff/40001/ui/gfx/render_text_win.c...
ui/gfx/render_text_win.cc:1102: ShapeTextRunWithFont(run, current_font));
If these two functions are always called together now, just move the inner call
inside the outer and rename the outer function.

I also wonder if the other parts of the logic can be added to the function (i.e.
it could be responsible for updating best_partial_font and
best_partial_font_missing_char_count). It could take those vars as extra params
or perhaps you could introduce a State struct and pass that instead? Would make
it even more readable.

Maybe just make a new short function:

size_t RenderTextWin::TryFallbackFont(const Font& font,
                                      FontFallbackState* state) {
  HRESULT shaping_result = ShapeTextRunWithFont(state->run, font);
  size_t missing_count = (shaping_result != S_OK) ? INT_MAX :
      CountCharsWithMissingGlyphs(state->run);
  if (missing_count < state->best_partial_font_missing_char_count) {
    state->best_partial_font_missing_char_count = missing_count;
    state->best_partial_font = current_font;
  }
  return missing_count;
}

https://codereview.chromium.org/382793004/diff/40001/ui/gfx/render_text_win.c...
ui/gfx/render_text_win.cc:1114: while (fonts.NextFont(&current_font)) {
Now that you're not calling SetNextFont() on |fonts|, can that method be
removed?

https://codereview.chromium.org/382793004/diff/40001/ui/gfx/render_text_win.c...
ui/gfx/render_text_win.cc:1217: DCHECK_EQ(shaping_result,
USP_E_SCRIPT_NOT_IN_FONT);
Nit: The expected value constant should be the first param to DCHECK_EQ.

https://codereview.chromium.org/382793004/diff/40001/ui/gfx/render_text_win.c...
ui/gfx/render_text_win.cc:1218: return INT_MAX;
What does it mean for INT_MAX to be returned by this? Please document in the
header comment.

Powered by Google App Engine
This is Rietveld 408576698