Bug 220607

Summary: Elements in a table are incorrectly selected in JavaScript.
Product: WebKit Reporter: Megan Gardner <megan_gardner>
Component: New BugsAssignee: Megan Gardner <megan_gardner>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, esprehn+autocc, ews-watchlist, kangil.han, mifenton, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing none

Description Megan Gardner 2021-01-13 15:55:35 PST
Elements in a table are incorrectly selected in JavaScript.
Comment 1 Megan Gardner 2021-01-13 16:05:07 PST
rdar://69916897
Comment 2 Megan Gardner 2021-01-13 16:11:42 PST
Created attachment 417576 [details]
Patch
Comment 3 Megan Gardner 2021-01-13 17:42:14 PST
Created attachment 417587 [details]
Patch
Comment 4 Megan Gardner 2021-01-14 15:55:34 PST
Created attachment 417663 [details]
Patch
Comment 5 Megan Gardner 2021-01-19 13:56:14 PST
Created attachment 417909 [details]
Patch
Comment 6 Wenson Hsieh 2021-01-19 17:05:24 PST
Comment on attachment 417909 [details]
Patch

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

> LayoutTests/editing/selection/editable-table-cell-selection.html:13
> +            if (!testRunner.runUIScript)

I don't see any (direct or indirect) uses of runUIScript in this test…can we just remove this early return and make the test manually runnable?

> LayoutTests/editing/selection/editable-table-cell-selection.html:18
> +            function select( element ) {

Nit - lots of extra spaces in function calls in runTest().

> LayoutTests/editing/selection/editable-table-cell-selection.html:21
> +                range.setStartBefore( element );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:22
> +                range.setEndAfter( element );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:27
> +                selection.addRange( range );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:30
> +            select( document.querySelector( 'thead tr' ) );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:37
> +            const lastHeadCell = [ ...document.querySelectorAll( 'thead th' ) ].pop();

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:38
> +            select( lastHeadCell );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:45
> +            select( document.querySelector( 'tbody tr' ) );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:47
> +                output += 'PASS: Correctly Selects row in tboyd';

Nit - tbody.

> LayoutTests/editing/selection/editable-table-cell-selection.html:52
> +            const lastBodyCell = [ ...document.querySelectorAll( 'tbody td' ) ].pop();

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:53
> +            select( lastBodyCell );

(Ditto)

> LayoutTests/editing/selection/editable-table-cell-selection.html:123
> +        This test requires UIScriptController to run.

Hm…is this true? I don't see any UIScriptController bits in this test.
Comment 7 Megan Gardner 2021-01-19 17:28:33 PST
Created attachment 417931 [details]
Patch for landing
Comment 8 EWS 2021-01-19 18:00:10 PST
Committed r271635: <https://trac.webkit.org/changeset/271635>

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