Bug 216721 - Selection API: Extend lifetime of selection live range to preserve expando properties
Summary: Selection API: Extend lifetime of selection live range to preserve expando pr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks: 216325
  Show dependency treegraph
 
Reported: 2020-09-18 18:52 PDT by Darin Adler
Modified: 2020-09-19 07:49 PDT (History)
11 users (show)

See Also:


Attachments
Patch (14.85 KB, patch)
2020-09-18 18:56 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (8.64 KB, patch)
2020-09-18 19:35 PDT, Darin Adler
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2020-09-18 18:52:20 PDT
Selection API: Extend lifetime of selection live range to preserve expando properties
Comment 1 Darin Adler 2020-09-18 18:56:47 PDT Comment hidden (obsolete)
Comment 2 Darin Adler 2020-09-18 19:35:28 PDT
Created attachment 409188 [details]
Patch
Comment 3 Ryosuke Niwa 2020-09-18 23:43:57 PDT
Comment on attachment 409188 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=409188&action=review

> LayoutTests/editing/selection/expando.html:5
> +function collectGarbage()

Why not just include LayoutTests/resources/gc.js?

> LayoutTests/editing/selection/expando.html:19
> +var repetitions = 20;

Maybe use const?

> LayoutTests/editing/selection/expando.html:23
> +    var count = 0;

Maybe use let?

> LayoutTests/editing/selection/expando.html:26
> +        var range = document.createRange();

Ditto.

> LayoutTests/editing/selection/expando.html:41
> +    var count = 0;

Ditto.

> LayoutTests/editing/selection/expando.html:44
> +        getSelection().setBaseAndExtent(document, 0, document, 1);
> +        getSelection().getRangeAt(0).expando = 1;

I think another scenario we should consider is modifying selection after this.
Comment 4 Darin Adler 2020-09-19 07:20:07 PDT
Comment on attachment 409188 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=409188&action=review

>> LayoutTests/editing/selection/expando.html:5
>> +function collectGarbage()
> 
> Why not just include LayoutTests/resources/gc.js?

Done.

>> LayoutTests/editing/selection/expando.html:19
>> +var repetitions = 20;
> 
> Maybe use const?

Done.

>> LayoutTests/editing/selection/expando.html:23
>> +    var count = 0;
> 
> Maybe use let?

Done.

>> LayoutTests/editing/selection/expando.html:26
>> +        var range = document.createRange();
> 
> Ditto.

Done.

>> LayoutTests/editing/selection/expando.html:44
>> +        getSelection().getRangeAt(0).expando = 1;
> 
> I think another scenario we should consider is modifying selection after this.

OK, will add some more tests for that.
Comment 5 Darin Adler 2020-09-19 07:48:11 PDT
Committed r267313: <https://trac.webkit.org/changeset/267313>
Comment 6 Radar WebKit Bug Importer 2020-09-19 07:49:16 PDT
<rdar://problem/69213554>