Bug 141140

Summary: ComplexTextController::offsetForPosition() might erroneously detect a ligature when instead CT simply omitted an invisible glyph
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: Layout and RenderingAssignee: Myles C. Maxfield <mmaxfield>
Status: NEW ---    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Reproduction screenshot
none
Reduction none

Description Myles C. Maxfield 2015-02-01 11:46:07 PST
Created attachment 245837 [details]
Reproduction screenshot

https://www.opengl.org/wiki/Geometry_Shader
Double click on "triangle_strip" (see screenshot)
Version 8.0.3 (10600.3.18, r179440)
14C109
Comment 1 Myles C. Maxfield 2015-08-27 00:17:16 PDT
Created attachment 260046 [details]
Reduction
Comment 2 Myles C. Maxfield 2015-08-27 00:20:15 PDT
Not due to simple line layout
Comment 3 Myles C. Maxfield 2015-08-27 00:22:14 PDT
For some reason the ZWS is being layed out to be the right half of the "p"
Comment 4 Myles C. Maxfield 2015-08-27 00:44:05 PDT
offsetForPosition() uses the complex text code path. In this code path, when the string ends with a ZWS, CoreText simply doesn't return a glyph for that character.

However, this means that in ComplexTextController::offsetForPosition(), it appears that the last glyph corresponds with two characters (since that ZWS doesn't get its own glyph). This makes us think that we are encountering a ligature, and we put the break between the two code points in the middle of the last glyph.

When you double click, you select the word, without the ZWS. Therefore, the caret gets placed in the middle of the last glyph.