Bug 227158 - [IFC][Integration] Text selection flashing to end of paragraph
Summary: [IFC][Integration] Text selection flashing to end of paragraph
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
Keywords: InRadar
Depends on:
Reported: 2021-06-17 20:42 PDT by zalan
Modified: 2021-06-24 06:50 PDT (History)
10 users (show)

See Also:

Test reduction (3.11 KB, text/html)
2021-06-17 20:42 PDT, zalan
no flags Details
Patch (9.83 KB, patch)
2021-06-17 20:59 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (3.22 KB, patch)
2021-06-23 16:55 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (7.03 KB, patch)
2021-06-23 20:47 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2021-06-17 20:42:08 PDT
Created attachment 431751 [details]
Test reduction

Comment 1 zalan 2021-06-17 20:59:28 PDT
Created attachment 431752 [details]
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]
Comment 5 zalan 2021-06-23 18:37:29 PDT
Comment on attachment 432113 [details]

will add a test case
Comment 6 zalan 2021-06-23 20:47:09 PDT
Created attachment 432129 [details]
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].