Bug 185933 - Improve the performance of Font::canRenderCombiningCharacterSequence()
Summary: Improve the performance of Font::canRenderCombiningCharacterSequence()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-05-23 20:07 PDT by Myles C. Maxfield
Modified: 2018-05-26 13:43 PDT (History)
9 users (show)

See Also:


Attachments
Patch (7.11 KB, patch)
2018-05-23 20:09 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (7.18 KB, patch)
2018-05-23 20:54 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews205 for win-future (12.79 MB, application/zip)
2018-05-23 23:20 PDT, EWS Watchlist
no flags Details
Patch (12.12 KB, patch)
2018-05-25 13:58 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (12.63 KB, patch)
2018-05-25 15:19 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (14.65 KB, patch)
2018-05-25 15:23 PDT, Myles C. Maxfield
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-sierra (2.42 MB, application/zip)
2018-05-25 16:36 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews126 for ios-simulator-wk2 (2.35 MB, application/zip)
2018-05-25 16:59 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews114 for mac-sierra (3.13 MB, application/zip)
2018-05-25 17:05 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews106 for mac-sierra-wk2 (2.88 MB, application/zip)
2018-05-25 17:16 PDT, EWS Watchlist
no flags Details
Patch (9.35 KB, patch)
2018-05-25 18:13 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2018-05-23 20:07:09 PDT
Improve the performance of Font::canRenderCombiningCharacterSequence()
Comment 1 Myles C. Maxfield 2018-05-23 20:09:19 PDT
Created attachment 341162 [details]
Patch
Comment 2 Myles C. Maxfield 2018-05-23 20:53:01 PDT
The patch has a 2% progression on the attached performance test.
Comment 3 Myles C. Maxfield 2018-05-23 20:54:54 PDT
Created attachment 341167 [details]
Patch
Comment 4 Radar WebKit Bug Importer 2018-05-23 20:55:36 PDT
<rdar://problem/40509552>
Comment 5 EWS Watchlist 2018-05-23 23:20:10 PDT
Comment on attachment 341167 [details]
Patch

Attachment 341167 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/7785152

New failing tests:
http/tests/security/canvas-remote-read-remote-video-localhost.html
Comment 6 EWS Watchlist 2018-05-23 23:20:21 PDT
Created attachment 341177 [details]
Archive of layout-test-results from ews205 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews205  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 7 Myles C. Maxfield 2018-05-25 13:58:03 PDT
Created attachment 341323 [details]
Patch
Comment 8 Myles C. Maxfield 2018-05-25 15:19:08 PDT
Created attachment 341335 [details]
Patch
Comment 9 Myles C. Maxfield 2018-05-25 15:23:34 PDT
Created attachment 341337 [details]
Patch
Comment 10 EWS Watchlist 2018-05-25 16:36:10 PDT
Comment on attachment 341337 [details]
Patch

Attachment 341337 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/7805023

New failing tests:
fast/text/arabic-zwj-and-zwnj.html
fast/text/format-control.html
Comment 11 EWS Watchlist 2018-05-25 16:36:12 PDT
Created attachment 341353 [details]
Archive of layout-test-results from ews100 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 12 EWS Watchlist 2018-05-25 16:59:00 PDT
Comment on attachment 341337 [details]
Patch

Attachment 341337 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/7804981

New failing tests:
imported/blink/fast/text/international/zerowidthjoiner-should-not-render.html
Comment 13 EWS Watchlist 2018-05-25 16:59:02 PDT
Created attachment 341358 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.4
Comment 14 EWS Watchlist 2018-05-25 17:05:30 PDT
Comment on attachment 341337 [details]
Patch

Attachment 341337 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/7805225

New failing tests:
fast/text/arabic-zwj-and-zwnj.html
fast/text/format-control.html
Comment 15 EWS Watchlist 2018-05-25 17:05:32 PDT
Created attachment 341360 [details]
Archive of layout-test-results from ews114 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 16 EWS Watchlist 2018-05-25 17:16:33 PDT
Comment on attachment 341337 [details]
Patch

Attachment 341337 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/7805687

New failing tests:
fast/text/arabic-zwj-and-zwnj.html
fast/text/format-control.html
Comment 17 EWS Watchlist 2018-05-25 17:16:35 PDT
Created attachment 341364 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 18 Myles C. Maxfield 2018-05-25 18:13:43 PDT
Created attachment 341372 [details]
Patch
Comment 19 WebKit Commit Bot 2018-05-25 20:44:55 PDT
Comment on attachment 341372 [details]
Patch

Clearing flags on attachment: 341372

Committed r232221: <https://trac.webkit.org/changeset/232221>
Comment 20 WebKit Commit Bot 2018-05-25 20:44:57 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 mitz 2018-05-25 21:06:18 PDT
Comment on attachment 341372 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=341372&action=review

> Source/WebCore/ChangeLog:9
> +        We don't need to create a whole CTLine just to determine whether or not a font supports rendering a grapheme cluster.
> +        Instead, the right way to do it is just see if the font's cmap table supports every code point in the cluster.

How does this “right way” work for cases like bug 68287 and <rdar://problem/9394430> where the font doesn’t have a glyph for each individual code point in the cluster, but has one for the cluster?
Comment 22 mitz 2018-05-25 22:33:58 PDT
(In reply to mitz from comment #21)
> Comment on attachment 341372 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=341372&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        We don't need to create a whole CTLine just to determine whether or not a font supports rendering a grapheme cluster.
> > +        Instead, the right way to do it is just see if the font's cmap table supports every code point in the cluster.
> 
> How does this “right way” work for cases like bug 68287 and
> <rdar://problem/9394430> where the font doesn’t have a glyph for each
> individual code point in the cluster, but has one for the cluster?

In looking into this, so far I found the following things:
- this patch didn’t break the layout test from bug 68287, platform/mac/fast/text/combining-character-sequence-fallback.html
- with this patch, canRenderCombiningCharacterSequence() returns false for Verdana and the “i with U+0302” sequence, because Verdana doesn’t have a glyph for U+0302, even though it has a glyph for the cluster as a whole
- when canRenderCombiningCharacterSequence() returns false, we end up taking a “system fallback” path ends up correctly using Verdana
- however, if the test is changed to specify “font-family: verdana, times”, then we fall back to Times even though we should be able to use Verdana
- however, the modified test fails similarly (using Times) even prior to this patch
- that’s because canRenderCombiningCharacterSequence() is returning false for Verdana and the “i with U+0302” sequence even before this patch
- but that hasn’t always been the case; the modified test does pass (i.e. renders using Verdana) in OS X 10.8.5 Mountain Lion, which is the first release that included the fix for bug 68287

So in conclusion:
- the fix for bug 68287 didn’t include a good test
- at some point between OS X 10.8.5 and now a regression occurred and went undetected
- it’s possible that this patch didn’t break anything that wasn’t already broken, but this patch will need to be amended in order to fix what got broken
Comment 23 mitz 2018-05-25 22:52:56 PDT
I filed bug 186010.
Comment 24 mitz 2018-05-26 13:35:52 PDT
(In reply to mitz from comment #22)
> - when canRenderCombiningCharacterSequence() returns false, we end up taking
> a “system fallback” path ends up correctly using Verdana

I was wrong: the “system fallback” path picks Lucida Grande for i-circumflex, but it should stick with Verdana, as TextEdit does

> So in conclusion:
> - the fix for bug 68287 didn’t include a good test

I was wrong: the test from bug 68287 was sufficient to catch the regression, if we had bothered to look at the pixels.
Comment 25 mitz 2018-05-26 13:43:20 PDT
(In reply to mitz from comment #24)
> (In reply to mitz from comment #22)
> > - when canRenderCombiningCharacterSequence() returns false, we end up taking
> > a “system fallback” path ends up correctly using Verdana
> 
> I was wrong: the “system fallback” path picks Lucida Grande for
> i-circumflex, but it should stick with Verdana, as TextEdit does

Did, as of Mountain Lion. No longer does as of Mavericks.

> 
> > So in conclusion:
> > - the fix for bug 68287 didn’t include a good test
> 
> I was wrong: the test from bug 68287 was sufficient to catch the regression,
> if we had bothered to look at the pixels.

I’ll attach screenshots to bug 186010.