Bug 115931

Summary: REGRESSION: Lines jump up and down while typing Chinese or Japanese
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: Layout and RenderingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, enrica, esprehn+autocc, glenn, hyatt, mitz
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fix (without change log)
none
Fixes one bug
none
Reverted erroneous test change
darin: review+
More comprehensive WIP fix
none
Fixes the bug
darin: review+
A/B test results none

Description Ryosuke Niwa 2013-05-10 13:32:08 PDT
Fallback fonts are not used when computing line heights in some cases.
Comment 1 Ryosuke Niwa 2013-05-10 13:35:22 PDT
Created attachment 201416 [details]
Fix (without change log)
Comment 2 Ryosuke Niwa 2013-05-10 13:35:32 PDT
<rdar://problem/12803147>
Comment 3 Ryosuke Niwa 2013-05-10 17:09:46 PDT
Created attachment 201441 [details]
Fixes one bug
Comment 4 Ryosuke Niwa 2013-05-10 17:10:39 PDT
Created attachment 201442 [details]
Reverted erroneous test change
Comment 5 Darin Adler 2013-05-10 17:55:38 PDT
Comment on attachment 201442 [details]
Reverted erroneous test change

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

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:3094
> +                    if (wordMeasurement.fallbackFonts.isEmpty() && !fallbackFonts.isEmpty())
> +                        wordMeasurement.fallbackFonts.swap(fallbackFonts);

Sure could use a why comment.
Comment 6 Ryosuke Niwa 2013-06-05 17:17:24 PDT
Created attachment 203893 [details]
More comprehensive WIP fix

There was more fundamental flaw in our code.
Comment 7 Ryosuke Niwa 2013-06-06 19:12:16 PDT
Created attachment 203991 [details]
Fixes the bug
Comment 8 mitz 2013-06-06 19:18:56 PDT
I thought passing a NULL fallbackFonts pointer into floatWidthFor{Simple,Complex}Text was a significant optimization. Have you checked whether this patch has any impact performance?
Comment 9 Ryosuke Niwa 2013-06-06 19:41:41 PDT
(In reply to comment #8)
> I thought passing a NULL fallbackFonts pointer into floatWidthFor{Simple,Complex}Text was a significant optimization. Have you checked whether this patch has any impact performance?

Yeah, I'm getting the numbers now.
Comment 10 Ryosuke Niwa 2013-06-06 21:31:52 PDT
Created attachment 203994 [details]
A/B test results

Thankfully I don't see any regression from running some perf. tests but please let me know if there is some other benchmark or page where this patch may cause a regression.
Comment 11 Darin Adler 2013-06-07 07:15:05 PDT
Comment on attachment 203991 [details]
Fixes the bug

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

I hope creating and destroying these empty hash sets is inexpensive enough.

> Source/WebCore/platform/graphics/Font.cpp:325
> +    ASSERT(fallbackFonts);

This assertion is really unnecessary. The code that guarantees this is non-zero is just a couple lines up from here.
Comment 12 Ryosuke Niwa 2013-06-07 10:58:36 PDT
(In reply to comment #11)
> (From update of attachment 203991 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=203991&action=review
> 
> I hope creating and destroying these empty hash sets is inexpensive enough.

I think andersca optimized empty hash maps recently to reduce the memory usage, etc... so HashTable only initializes various member variables to 0 now.

> > Source/WebCore/platform/graphics/Font.cpp:325
> > +    ASSERT(fallbackFonts);
> 
> This assertion is really unnecessary. The code that guarantees this is non-zero is just a couple lines up from here.

Removed.
Comment 13 Ryosuke Niwa 2013-06-07 10:58:59 PDT
Committed r151327: <http://trac.webkit.org/changeset/151327>