Bug 188099

Summary: [WIN] Fix tests for text with initial advances
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, darin, ews-watchlist, pvollan, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=188032
Attachments:
Description Flags
Test patch
none
Archive of layout-test-results from ews206 for win-future
none
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews200 for win-future
none
Patch none

Description Myles C. Maxfield 2018-07-27 11:27:11 PDT
[WIN] Fix text with initial advance tests
Comment 1 Myles C. Maxfield 2018-07-27 11:27:27 PDT
Created attachment 345931 [details]
Test patch
Comment 2 EWS Watchlist 2018-07-27 11:29:54 PDT
Attachment 345931 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Brent Fulgham 2018-07-27 12:16:56 PDT
Comment on attachment 345931 [details]
Test patch

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

> Source/WebCore/platform/graphics/FontCascade.cpp:1437
> +    float initialYPosition = point.y();

Does the Windows Glyph concept not track or deal with initial advance? I wonder if it could just always be set to a height of zero so there is no difference in the code here?
Comment 4 Myles C. Maxfield 2018-07-27 13:36:52 PDT
Comment on attachment 345931 [details]
Test patch

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

>> Source/WebCore/platform/graphics/FontCascade.cpp:1437
>> +    float initialYPosition = point.y();
> 
> Does the Windows Glyph concept not track or deal with initial advance? I wonder if it could just always be set to a height of zero so there is no difference in the code here?

Windows does deal with initial advances.
Comment 5 EWS Watchlist 2018-07-27 15:37:35 PDT
Comment on attachment 345931 [details]
Test patch

Attachment 345931 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8677106

New failing tests:
http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html
Comment 6 EWS Watchlist 2018-07-27 15:37:46 PDT
Created attachment 345961 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 7 Myles C. Maxfield 2018-07-27 18:19:31 PDT
Created attachment 345983 [details]
Patch
Comment 8 Radar WebKit Bug Importer 2018-07-27 18:23:18 PDT
<rdar://problem/42682699>
Comment 9 Myles C. Maxfield 2018-07-27 22:47:37 PDT
Created attachment 345988 [details]
Patch
Comment 10 Myles C. Maxfield 2018-07-28 11:05:56 PDT
Created attachment 345995 [details]
Patch
Comment 11 Myles C. Maxfield 2018-07-28 18:42:27 PDT
Created attachment 346007 [details]
Patch
Comment 12 Darin Adler 2018-07-28 20:51:09 PDT
Comment on attachment 346007 [details]
Patch

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

> Source/WebCore/platform/graphics/ComplexTextController.cpp:49
> +    WTF_MAKE_FAST_ALLOCATED;

Seems like this is unneeded, since we won‘t ever allocate one.

> Source/WebCore/platform/graphics/FontCascade.cpp:1436
> +    FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height());

This can be written like this:

    FloatPoint startPoint { point + glyphBuffer.initialAdvance() };

Or any variant using { }, (), or =, and either FloatPoint or auto. But no reason to do the x and y separately.
Comment 13 EWS Watchlist 2018-07-29 05:39:26 PDT
Comment on attachment 346007 [details]
Patch

Attachment 346007 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8690617

New failing tests:
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
Comment 14 EWS Watchlist 2018-07-29 05:39:37 PDT
Created attachment 346027 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 15 Brent Fulgham 2018-07-30 09:44:19 PDT
*** Bug 188168 has been marked as a duplicate of this bug. ***
Comment 16 Myles C. Maxfield 2018-07-31 11:53:19 PDT
Created attachment 346184 [details]
Patch
Comment 17 Myles C. Maxfield 2018-07-31 19:03:36 PDT
Comment on attachment 346007 [details]
Patch

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

>> Source/WebCore/platform/graphics/FontCascade.cpp:1436
>> +    FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height());
> 
> This can be written like this:
> 
>     FloatPoint startPoint { point + glyphBuffer.initialAdvance() };
> 
> Or any variant using { }, (), or =, and either FloatPoint or auto. But no reason to do the x and y separately.

Looks like Windows can't handle that :(
Comment 18 Myles C. Maxfield 2018-07-31 22:11:56 PDT
Committed r234448: <https://trac.webkit.org/changeset/234448>
Comment 19 Darin Adler 2018-08-01 09:57:06 PDT
Comment on attachment 346007 [details]
Patch

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

>>> Source/WebCore/platform/graphics/FontCascade.cpp:1436
>>> +    FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height());
>> 
>> This can be written like this:
>> 
>>     FloatPoint startPoint { point + glyphBuffer.initialAdvance() };
>> 
>> Or any variant using { }, (), or =, and either FloatPoint or auto. But no reason to do the x and y separately.
> 
> Looks like Windows can't handle that :(

I’d like to know more. Can you show me which version you tried and how Windows failed?
Comment 20 Myles C. Maxfield 2018-08-02 16:18:32 PDT
(In reply to Darin Adler from comment #19)
> Comment on attachment 346007 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=346007&action=review
> 
> >>> Source/WebCore/platform/graphics/FontCascade.cpp:1436
> >>> +    FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height());
> >> 
> >> This can be written like this:
> >> 
> >>     FloatPoint startPoint { point + glyphBuffer.initialAdvance() };
> >> 
> >> Or any variant using { }, (), or =, and either FloatPoint or auto. But no reason to do the x and y separately.
> > 
> > Looks like Windows can't handle that :(
> 
> I’d like to know more. Can you show me which version you tried and how
> Windows failed?

FloatPoint startPoint { point + glyphBuffer.initialAdvance() };

https://webkit-queues.webkit.org/patch/346184/win-ews

c:\cygwin\home\buildbot\webkit\source\webcore\platform\graphics\fontcascade.cpp(1436): error C2678: binary '+': no operator found which takes a left-hand operand of type 'WebCore::FloatPoint' (or there is no acceptable conversion) (compiling source file C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource330.cpp) [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
Comment 21 Darin Adler 2018-08-03 07:13:46 PDT
Yes, I see what the issue is. I thought that initialAdvance() returned a FloatSize. But even though this is Windows, we have USE(CG) true, so GlyphBufferAdvance is not a FloatSize, it's a struct derived from CGSize instead. The comment says:

// CG uses CGSize instead of FloatSize so that the result of advances()
// can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm

That comment points to some things that are not quite right. For one thing, there is no call to CGContextShowGlyphsWithAdvances any more so the comment is not correct. I am not at all sure that using CGSize instead of FloatSize here is a good idea. And I’m even more unsure that using a struct derived from CGSize with added functions is a good style choice.

So I think this is something worth cleaning up eventually.
Comment 22 Darin Adler 2018-08-03 07:14:02 PDT
And of course FontMac.mm is not used on Windows.
Comment 23 Darin Adler 2018-08-03 07:14:55 PDT
I see the code taking advantage of this now.

It’s Font::applyTransforms, and it’s inside #if PLATFORM(COCOA), not #if USE(CG).