Bug 213279

Summary: [WinCairo] glyph positions differ between partially selected texts and not selected texts
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: mmaxfield
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test content
none
[screenshot] WinCairo port
none
test content (abcd) none

Description Fujii Hironori 2020-06-16 18:22:44 PDT
Created attachment 402063 [details]
test content

[WinCairo] glyph positions differ between partially selected texts and not selected texts

Even though WinCairo WebKit1 testing Buildbot doesn't fail, fast/text/international/hebrew-selection.html is failing on my PC with WinCairo WK1.

I created a test content based on fast/text/international/hebrew-selection-expected.html.
Comment 1 Fujii Hironori 2020-06-16 18:25:00 PDT
Created attachment 402064 [details]
[screenshot] WinCairo port

Both סְ should look same, but first סְ has black shadow in WinCairo port.
AppleWin doesn't have this issue.
Comment 2 Fujii Hironori 2020-06-16 18:40:56 PDT
(In reply to Fujii Hironori from comment #0)
> Even though WinCairo WebKit1 testing Buildbot doesn't fail,
> fast/text/international/hebrew-selection.html is failing on my PC with
> WinCairo WK1.

The test case is passing even on my PC with WinCairo WK2 because it has another bug repainting the entire content area by changing selection.
Bug 213277 – [WinCairo][WK2] The entire content area is unnecessarily repainted just by clicking a text
Comment 3 Fujii Hironori 2020-06-16 23:45:01 PDT
Created attachment 402082 [details]
test content (abcd)

This issue can be reproduced by using alphabet.
Comment 4 Fujii Hironori 2020-06-17 21:56:11 PDT
Because the extents of glyphs "ab" are overlapped,
_cairo_scaled_font_glyph_device_extents returns true for 'overlap_out'.
Then, texts "abcd" and "ab" are drawn by using composite_glyphs_via_mask,
while a test "cd" is drawn by composite_glyphs without a mask.
This causes the tiny difference.

I modified _cairo_compositor_glyphs to overwrite 'overlap' to TRUE or FALSE.
I confirmed the tiny difference disappeared.

diff --git a/src/cairo-compositor.c b/src/cairo-compositor.c
index b31413b99..0147ed3bc 100644
--- a/src/cairo-compositor.c
+++ b/src/cairo-compositor.c
@@ -242,6 +242,7 @@ _cairo_compositor_glyphs (const cairo_compositor_t		*compositor,
 							  clip, &overlap);
     if (unlikely (status))
 	return status;
+    overlap = TRUE;
 
     do {
 	while (compositor->glyphs == NULL)