Bug 199211 - Selection highlight not shown on programmatic focus after initial load
Summary: Selection highlight not shown on programmatic focus after initial load
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Nobody
URL: data:text/html,<p>Hello World</p><scr...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-06-25 16:38 PDT by Daniel Bates
Modified: 2019-06-26 16:29 PDT (History)
4 users (show)

See Also:


Attachments
First stab (3.68 KB, patch)
2019-06-25 16:39 PDT, Daniel Bates
ews: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews121 for ios-simulator-wk2 (3.80 MB, application/zip)
2019-06-25 18:39 PDT, Build Bot
no flags Details
Simpler fix, let's see what happens (3.65 KB, patch)
2019-06-26 11:51 PDT, Daniel Bates
ews: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews126 for ios-simulator-wk2 (4.25 MB, application/zip)
2019-06-26 13:36 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2019-06-25 16:38:34 PDT
Steps to reproduce:

Visit <data:text/html,<p>Hello World</p><script>let p = document.querySelector("p"); window.getSelection().setBaseAndExtent(p.firstChild, 0, p.firstChild, 2)</script>>
Comment 1 Daniel Bates 2019-06-25 16:39:24 PDT
Created attachment 372874 [details]
First stab
Comment 2 Build Bot 2019-06-25 18:39:46 PDT
Comment on attachment 372874 [details]
First stab

Attachment 372874 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12575966

New failing tests:
editing/selection/selection-across-shadow-boundaries-readonly-2.html
imported/mozilla/svg/text/selectSubString-3.svg
fast/flexbox/flexbox-fail-to-select-same-line.html
editing/selection/update-selection-by-style-change.html
fast/text/international/hebrew-selection.html
fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html
svg/masking/mask-should-not-paint-selection.html
imported/blink/editing/selection/deleteFromDocument-crash.html
imported/mozilla/svg/text/multiple-chunks-selection.svg
fast/dynamic/remove-invisible-node-inside-selection.html
imported/mozilla/svg/text/selectSubString.svg
fast/dynamic/remove-node-inside-selection.html
Comment 3 Build Bot 2019-06-25 18:39:48 PDT
Created attachment 372890 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 4 Daniel Bates 2019-06-26 10:49:07 PDT
(In reply to Build Bot from comment #2)
> Comment on attachment 372874 [details]
> First stab
> 
> Attachment 372874 [details] did not pass ios-sim-ews (ios-simulator-wk2):
> Output: https://webkit-queues.webkit.org/results/12575966
> 
> New failing tests:
> editing/selection/selection-across-shadow-boundaries-readonly-2.html
> imported/mozilla/svg/text/selectSubString-3.svg
> fast/flexbox/flexbox-fail-to-select-same-line.html
> editing/selection/update-selection-by-style-change.html
> fast/text/international/hebrew-selection.html
> fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html
> svg/masking/mask-should-not-paint-selection.html
> imported/blink/editing/selection/deleteFromDocument-crash.html
> imported/mozilla/svg/text/multiple-chunks-selection.svg
> fast/dynamic/remove-invisible-node-inside-selection.html
> imported/mozilla/svg/text/selectSubString.svg
> fast/dynamic/remove-node-inside-selection.html

These "failures" reveal various bugs in our code! Only one of the failures may indicate the patch is not quite right: svg/masking/mask-should-not-paint-selection.html, but quick glance at this test makes me think the mechanism to prevent selection is not enabled on iOS and the only reason we've been passing this test is because we do not paint selection on first load.

^^^ that last part is the reason for other failures in this list like fast/text/international/hebrew-selection.html. That is, we've been passing this test because both sides of the comparison have been broken. I fixed the -expected.html side, which uses programmatic selection API. The non-expected side used window.eventSender, which is known to be broken in WebKit2 on iOS. Haha
Comment 5 Daniel Bates 2019-06-26 10:49:30 PDT
Forgot to mention, other failure indicate a timing difference when we snapshot.
Comment 6 Daniel Bates 2019-06-26 11:51:41 PDT
Created attachment 372939 [details]
Simpler fix, let's see what happens
Comment 7 Build Bot 2019-06-26 13:36:49 PDT
Comment on attachment 372939 [details]
Simpler fix, let's see what happens

Attachment 372939 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12582947

New failing tests:
editing/selection/selection-across-shadow-boundaries-readonly-2.html
editing/selection/selection-across-shadow-boundaries-readonly-3.html
imported/mozilla/svg/text/selectSubString-3.svg
fast/flexbox/flexbox-fail-to-select-same-line.html
fast/text/international/hebrew-selection.html
editing/selection/update-selection-by-style-change.html
editing/selection/selection-across-shadow-boundaries-readonly-1.html
fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html
imported/blink/fast/text/international/repaint-glyph-bounds.html
svg/masking/mask-should-not-paint-selection.html
imported/mozilla/svg/text/multiple-chunks-selection.svg
imported/blink/editing/style/justify-left-crash.html
fast/dynamic/remove-invisible-node-inside-selection.html
imported/mozilla/svg/text/selectSubString.svg
svg/foreignObject/viewport-foreignobject-crash.html
fast/dynamic/remove-node-inside-selection.html
Comment 8 Build Bot 2019-06-26 13:36:51 PDT
Created attachment 372945 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 9 Radar WebKit Bug Importer 2019-06-26 16:29:23 PDT
<rdar://problem/52217858>