Bug 214315 - [css-grid] CSSOM gridTemplateColumns/Rows reports wrong line names when leading implicit tracks are present
Summary: [css-grid] CSSOM gridTemplateColumns/Rows reports wrong line names when leadi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Oriol Brufau
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-14 13:08 PDT by Oriol Brufau
Modified: 2020-07-16 10:00 PDT (History)
13 users (show)

See Also:


Attachments
Patch (30.93 KB, patch)
2020-07-14 13:31 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (20.63 KB, patch)
2020-07-15 05:27 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (20.57 KB, patch)
2020-07-15 14:17 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (20.62 KB, patch)
2020-07-16 05:33 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (20.64 KB, patch)
2020-07-16 09:33 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oriol Brufau 2020-07-14 13:08:12 PDT
These WPT are failing:
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-implicit-track.html
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-implicit-track.html

They were added in https://crbug.com/790988, the Chromium patch needs to be ported to WebKit.
Comment 1 Oriol Brufau 2020-07-14 13:31:17 PDT
Created attachment 404272 [details]
Patch
Comment 2 Manuel Rego Casasnovas 2020-07-15 01:07:53 PDT
Comment on attachment 404272 [details]
Patch

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

On a quick look, it seems good. But I'd split it in 2 patches (one for the refactoring and another for the actual fix). Thanks!

> Source/WebCore/ChangeLog:20
> +        This patch also renames SmallestTrackStart to ExplicitGridStart.
> +        The SmallestTrackStart method used to return a signed int which was
> +        never positive, representing the smallest untranslated start among all
> +        grid items, clamped by 0 as a maximum.

Can we do this change on a different patch?

This is basically a refactoring and should have no behavior changes, so we can land that one first, and then the actual fix for this bug. WDYT?
Comment 3 Oriol Brufau 2020-07-15 05:09:21 PDT
(In reply to Manuel Rego Casasnovas from comment #2)
> This is basically a refactoring and should have no behavior changes, so we
> can land that one first, and then the actual fix for this bug. WDYT?
OK, filed bug 214347.
Comment 4 Oriol Brufau 2020-07-15 05:27:53 PDT
Created attachment 404335 [details]
Patch
Comment 5 Manuel Rego Casasnovas 2020-07-15 13:56:28 PDT
Comment on attachment 404335 [details]
Patch

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

Thanks for the fix.

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:875
> +    ASSERT((unsigned)end <= tracks.size());

Do we need this cast?

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:920
> +        // Named grid line indices are relative to the explicit grid, but we are
> +        // including all tracks. So we need to subtract the number of leading
> +        // implicit tracks in order to get the proper line index.

Nit: Comments lines can be longer in WebKit, no need to wrap to 80-chars.
Comment 6 Oriol Brufau 2020-07-15 14:17:03 PDT
Created attachment 404393 [details]
Patch
Comment 7 Manuel Rego Casasnovas 2020-07-16 00:49:31 PDT
Comment on attachment 404393 [details]
Patch

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

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:875
>      ASSERT(end <= tracks.size());

So it looks like the cast was actually needed:
./css/CSSComputedStyleDeclaration.cpp:875:16: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
    ASSERT(end <= tracks.size());

Probably you can do something like:
    ASSERT(end <= static_cast<int>(tracks.size()));
Comment 8 Oriol Brufau 2020-07-16 05:33:40 PDT
Created attachment 404435 [details]
Patch
Comment 9 Oriol Brufau 2020-07-16 09:33:55 PDT
Created attachment 404451 [details]
Patch
Comment 10 EWS 2020-07-16 09:59:23 PDT
Committed r264465: <https://trac.webkit.org/changeset/264465>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 404451 [details].
Comment 11 Radar WebKit Bug Importer 2020-07-16 10:00:24 PDT
<rdar://problem/65672557>