Bug 227158

Summary: [IFC][Integration] Text selection flashing to end of paragraph
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, esprehn+autocc, ews-watchlist, glenn, koivisto, kondapallykalyan, pdr, simon.fraser, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test reduction
none
Patch
none
Patch
none
Patch none

Description zalan 2021-06-17 20:42:08 PDT
Created attachment 431751 [details]
Test reduction

<rdar://79138828>
Comment 1 zalan 2021-06-17 20:59:28 PDT
Created attachment 431752 [details]
Patch
Comment 2 zalan 2021-06-18 05:56:51 PDT
Yay! WPT progressons!
Comment 3 zalan 2021-06-18 09:37:47 PDT
..and some real regressions.
The issue with precise, location based hit testing is that with (un-snapped) sub pixel positioning, we miss content between the snap points e.g.

hit test location [100px, 100px]
renderer's layout location [100.1px, 100px]
renderer's painted location after pixel-spanning [100px, 100px] 
^^ hit testing should find this renderer as the hit test location matches the renderer's visual location.
 
This works with ToT as we enlarge the hit testing area by [1px, 1px] (which is certainly a bug on non-1px displays, and this patch is addressing it), but since the input coords to the hit test intersect (see LegacyInlineTextBox::nodeAtPoint) are not pixel snapped, the non-enlarge, point based hit testing will miss content on sub pixel positions (100 vs 100.1)
Now we either pixelsnap the renderer location and use this snapped position as input to hittest intersecting (this would match our painting approach) or
go back to area based hit testing and enlarge the hit test location by 1/scale factor (1px, 0.5px 0.33px etc) -this lacks directionality and may produce incorrect results for rtl content (which the current 1px enlarging has as well).
Comment 4 zalan 2021-06-23 16:55:11 PDT
Created attachment 432113 [details]
Patch
Comment 5 zalan 2021-06-23 18:37:29 PDT
Comment on attachment 432113 [details]
Patch

will add a test case
Comment 6 zalan 2021-06-23 20:47:09 PDT
Created attachment 432129 [details]
Patch
Comment 7 EWS 2021-06-24 06:50:03 PDT
Committed r279220 (239106@main): <https://commits.webkit.org/239106@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 432129 [details].