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

Issue 2230233002: Skip redundant fonts returned by FontFallbackIterator (Closed)

Created:
4 years, 4 months ago by drott
Modified:
4 years, 3 months ago
Reviewers:
kojii, eae, behdad
CC:
ajuma+watch_chromium.org, blink-reviews, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, dshwang, drott+blinkwatch_chromium.org, krit, f(malita), jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Skip redundant fonts returned by FontFallbackIterator HarfBuzzShaper asks FontFallbackIterator::next for a font by calling next() each time it is done shaping with this font and still has non-rendered glyphs. Depending on what the font-stack, user-preference font, and fallback fonts returned by the system are, the shaper may try to shape with the same font several times, and still end up not finding a result before the LastResort font. Since HarfBuzzFace objects are cached internally to that class and unified using Skia unique SkTypeface IDs, we can filter for SkTypeFace uniqueIds earlier in FontFallbackIterator and skip redundant shaping. Examples would be: Empty font-family CSS, but CSS code seems to set the default serif font before we reach shaping, then we try with that, and afterwards attempt to shape with the users default font again, which is the same, Times New Roman in both cases. Similarly, a font-family: that has Times or Times New Roman which we alias to the same font, etc. BUG=636347 TEST=Manually tested this by adding debug code to HarfBuzzShaper and detecting incoming duplicates. Committed: https://crrev.com/5fdb26babe2d64e6f09175edffd5efe4abf220d8 Cr-Commit-Position: refs/heads/master@{#411164}

Patch Set 1 #

Patch Set 2 : Don't skip subsetted ranges, plus minor fix in FontDataForRangeSet #

Patch Set 3 : Logging removed #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -26 lines) Patch
M third_party/WebKit/Source/platform/fonts/FontDataForRangeSet.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontFallbackIterator.h View 3 chunks +8 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp View 1 2 7 chunks +26 lines, -14 lines 2 comments Download
M third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp View 3 chunks +2 lines, -4 lines 0 comments Download

Messages

Total messages: 22 (14 generated)
eae
LGTM
4 years, 4 months ago (2016-08-10 14:13:24 UTC) #4
drott
Hmh, I was hoping the Linux failure was due to my local font configuration but ...
4 years, 4 months ago (2016-08-10 14:42:18 UTC) #7
drott
On 2016/08/10 at 14:42:18, drott wrote: > Hmh, I was hoping the Linux failure was ...
4 years, 4 months ago (2016-08-10 15:05:53 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2230233002/40001
4 years, 4 months ago (2016-08-10 20:50:10 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 4 months ago (2016-08-10 22:29:51 UTC) #18
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/5fdb26babe2d64e6f09175edffd5efe4abf220d8 Cr-Commit-Position: refs/heads/master@{#411164}
4 years, 4 months ago (2016-08-10 22:31:39 UTC) #20
behdad
https://codereview.chromium.org/2230233002/diff/40001/third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp File third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp (right): https://codereview.chromium.org/2230233002/diff/40001/third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp#newcode74 third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp:74: if (m_uniqueFontDataForRangeSetsReturned.contains(candidateId)) { Shouldn't this be a while loop, ...
4 years, 4 months ago (2016-08-15 21:09:19 UTC) #21
drott
4 years, 4 months ago (2016-08-23 18:20:31 UTC) #22
Message was sent while issue was closed.
https://codereview.chromium.org/2230233002/diff/40001/third_party/WebKit/Sour...
File third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp (right):

https://codereview.chromium.org/2230233002/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp:74: if
(m_uniqueFontDataForRangeSetsReturned.contains(candidateId)) {
On 2016/08/15 at 21:09:19, behdad wrote:
> Shouldn't this be a while loop, skipping until something unseen is seen?

Can you explain a bit more what you were expecting instead? I am using the
uniqueOrNext() as a wrapper for the return of the next() iterator call. If the
next() iterator has found a font, but filtering it in uniqueOrNext() finds that
this font has already been returned, we continue the recursion and call next()
to continue searching for a new font.

Powered by Google App Engine
This is Rietveld 408576698