Bug 156794 - Make glyphToWidth cache correctly
Summary: Make glyphToWidth cache correctly
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hyungwook Lee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-20 05:59 PDT by Hyungwook Lee
Modified: 2016-05-02 18:44 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.55 KB, patch)
2016-04-20 06:13 PDT, Hyungwook Lee
mmaxfield: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hyungwook Lee 2016-04-20 05:59:10 PDT
Currently only English can use glyphToWidth cache so another language's text layout and drawing performance is not good.
Comment 1 Hyungwook Lee 2016-04-20 06:13:48 PDT
Created attachment 276820 [details]
Patch
Comment 2 Myles C. Maxfield 2016-04-20 09:11:15 PDT
Comment on attachment 276820 [details]
Patch

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

> Source/WebCore/platform/graphics/GlyphMetricsMap.h:109
> +                return page;

Why do you skip the page filling for the non-primary pages, but not skip page filling for the primary page? These two should be the same (the zero page is just used as a cache)
Comment 3 Myles C. Maxfield 2016-04-20 09:12:02 PDT
(In reply to comment #2)
> Comment on attachment 276820 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=276820&action=review
> 
> > Source/WebCore/platform/graphics/GlyphMetricsMap.h:109
> > +                return page;
> 
> Why do you skip the page filling for the non-primary pages, but not skip
> page filling for the primary page? These two should be the same (the zero
> page is just used as a cache)

Also, please add a test.
Comment 4 Hyungwook Lee 2016-04-20 20:44:01 PDT
(In reply to comment #2)
> Comment on attachment 276820 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=276820&action=review
> 
> > Source/WebCore/platform/graphics/GlyphMetricsMap.h:109
> > +                return page;
> 
> Why do you skip the page filling for the non-primary pages, but not skip
> page filling for the primary page? These two should be the same (the zero
> page is just used as a cache)

Current patch doesn't skip the page filling for the non-primary pages.
I just prevent the page re-filling that already filled when we create it.

I think the root cause of current issue is that we always re-filling non-primary pages even if we set glyph's width in Font::widthForGlyph()
Comment 5 Hyungwook Lee 2016-04-21 23:24:43 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > Comment on attachment 276820 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=276820&action=review
> > 
> > > Source/WebCore/platform/graphics/GlyphMetricsMap.h:109
> > > +                return page;
> > 
> > Why do you skip the page filling for the non-primary pages, but not skip
> > page filling for the primary page? These two should be the same (the zero
> > page is just used as a cache)
> 
> Also, please add a test.

GlyphMetricsMap is not public API and it is related to Cache operation.
Do you have idea to make a test?
Comment 6 Myles C. Maxfield 2016-05-02 18:44:48 PDT
(In reply to comment #5)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > Comment on attachment 276820 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=276820&action=review
> > > 
> > > > Source/WebCore/platform/graphics/GlyphMetricsMap.h:109
> > > > +                return page;
> > > 
> > > Why do you skip the page filling for the non-primary pages, but not skip
> > > page filling for the primary page? These two should be the same (the zero
> > > page is just used as a cache)
> > 
> > Also, please add a test.
> 
> GlyphMetricsMap is not public API and it is related to Cache operation.
> Do you have idea to make a test?

I think we should make a layout test (not a unit test). Therefore, we should find a way that a webpage can cause this code to be invoked, and we should make a test page that does so, and make sure the result is as expected.

If you have more questions about how to do this, I am happy to answer them.