Bug 197840 - [css-grid] specified value for (eg.) grid-template-columns expands repeat()
Summary: [css-grid] specified value for (eg.) grid-template-columns expands repeat()
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: 2019-05-13 09:53 PDT by Oriol Brufau
Modified: 2019-05-27 14:28 PDT (History)
4 users (show)

See Also:


Attachments
Patch (20.38 KB, patch)
2019-05-13 10:02 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (35.57 KB, patch)
2019-05-13 10:44 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (38.39 KB, patch)
2019-05-13 12:36 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (42.59 KB, patch)
2019-05-13 15:14 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (44.77 KB, patch)
2019-05-13 17:48 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (44.85 KB, patch)
2019-05-14 13:07 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 2019-05-13 09:53:39 PDT
Steps to reproduce the problem:
1. write a short document with an element having specified 'grid-template-columns' property to 'repeat(2, [e] 40px)' through a style rule
2. query, through the CSS OM, the specified value for that property on that element
3. show the value

Here's a reduced testcase:

<!DOCTYPE html>
<body>
<script>
document.body.style.gridTemplateColumns = "repeat(2, [e] 40px)"
console.log(document.body.style.gridTemplateColumns);
</script>

What is the expected behavior?
The value should be the specified value, exactly.

What went wrong?
The displayed value is `[e] 40px [e] 40px` ; that behaviour breaks CSS editor that want to preserve precisely what the CSS author specified.

Has been fixed in Blink: https://crbug.com/716114
Comment 1 Oriol Brufau 2019-05-13 10:02:10 PDT
Created attachment 369742 [details]
Patch
Comment 2 Oriol Brufau 2019-05-13 10:44:28 PDT
Created attachment 369747 [details]
Patch
Comment 3 Oriol Brufau 2019-05-13 12:36:51 PDT
Created attachment 369762 [details]
Patch
Comment 4 Oriol Brufau 2019-05-13 15:14:19 PDT
Created attachment 369785 [details]
Patch
Comment 5 Oriol Brufau 2019-05-13 17:48:45 PDT
Created attachment 369804 [details]
Patch
Comment 6 Javier Fernandez 2019-05-14 02:01:56 PDT
Comment on attachment 369804 [details]
Patch

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

> Source/WebCore/css/parser/CSSPropertyParser.cpp:3432
> +        list.append(*integerRepeatedValues);

I think you should use integerRepeatedValues.releaseNonNull() instead of deref the RefPtr

> Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp:28
> +#include <WebCore/CSSGridIntegerRepeatValue.h>

The CSSGridIntegerRepeatValue.h is under the WebCore/css folder.
Comment 7 Oriol Brufau 2019-05-14 11:47:44 PDT
Comment on attachment 369804 [details]
Patch

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

>> Source/WebCore/css/parser/CSSPropertyParser.cpp:3432
>> +        list.append(*integerRepeatedValues);
> 
> I think you should use integerRepeatedValues.releaseNonNull() instead of deref the RefPtr

You are right, thanks

>> Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp:28
>> +#include <WebCore/CSSGridIntegerRepeatValue.h>
> 
> The CSSGridIntegerRepeatValue.h is under the WebCore/css folder.

But if I use WebCore/css/CSSGridIntegerRepeatValue.h, it doesn't compile locally. And for example the StyleProperties.h below is also inside the css folder
Comment 8 Oriol Brufau 2019-05-14 13:07:50 PDT
Created attachment 369887 [details]
Patch
Comment 9 Oriol Brufau 2019-05-14 13:12:36 PDT
I added "settings = {ATTRIBUTES = (Private, ); };" in project.pbxproj, now it seems to compile on Mac.
Comment 10 Manuel Rego Casasnovas 2019-05-27 13:54:21 PDT
Comment on attachment 369887 [details]
Patch

Thanks for fixing this.
Comment 11 WebKit Commit Bot 2019-05-27 14:27:22 PDT
Comment on attachment 369887 [details]
Patch

Clearing flags on attachment: 369887

Committed r245798: <https://trac.webkit.org/changeset/245798>
Comment 12 WebKit Commit Bot 2019-05-27 14:27:24 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2019-05-27 14:28:17 PDT
<rdar://problem/51163602>