Bug 238181 - Parsing of contain-intrinsic-size and adding a runtime flag for it
Summary: Parsing of contain-intrinsic-size and adding a runtime flag for it
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: cathiechen
URL:
Keywords: InRadar
: 204316 (view as bug list)
Depends on:
Blocks: 236707
  Show dependency treegraph
 
Reported: 2022-03-21 18:30 PDT by cathiechen
Modified: 2022-07-01 15:12 PDT (History)
16 users (show)

See Also:


Attachments
Patch (42.93 KB, patch)
2022-03-21 19:18 PDT, cathiechen
no flags Details | Formatted Diff | Diff
Patch (118.13 KB, patch)
2022-03-22 06:14 PDT, cathiechen
no flags Details | Formatted Diff | Diff
Patch (171.87 KB, patch)
2022-03-25 07:36 PDT, cathiechen
no flags Details | Formatted Diff | Diff
Patch (171.27 KB, patch)
2022-03-28 06:18 PDT, cathiechen
no flags Details | Formatted Diff | Diff
Patch (171.17 KB, patch)
2022-04-06 07:54 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (171.11 KB, patch)
2022-04-06 10:48 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (172.23 KB, patch)
2022-04-07 01:38 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (170.80 KB, patch)
2022-04-08 01:29 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (170.90 KB, patch)
2022-04-13 10:09 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (170.97 KB, patch)
2022-04-15 11:37 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (170.97 KB, patch)
2022-04-20 03:05 PDT, cathiechen
no flags Details | Formatted Diff | Diff
Patch (171.03 KB, patch)
2022-04-20 03:30 PDT, cathiechen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 cathiechen 2022-03-21 19:18:59 PDT
Created attachment 455318 [details]
Patch
Comment 2 cathiechen 2022-03-22 06:14:02 PDT
Created attachment 455367 [details]
Patch
Comment 3 Rob Buis 2022-03-23 04:10:14 PDT
Comment on attachment 455367 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        value for Length and AutoAndLenght type.

AutoAndLength.

> Source/WebCore/css/parser/CSSPropertyParser.cpp:4101
> +    list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueAuto));

Better here to use autoValue I think.
Comment 4 cathiechen 2022-03-25 07:36:38 PDT
Created attachment 455758 [details]
Patch
Comment 5 Rob Buis 2022-03-25 10:26:53 PDT
Patch LGTM to me :) I will leave it for an Apple person to do the final review though.
Comment 6 Simon Fraser (smfr) 2022-03-25 10:53:48 PDT
Comment on attachment 455758 [details]
Patch

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

> Source/WebCore/css/parser/CSSParserContext.cpp:219
> +    uint64_t bits2 = context.containIntrinsicSizeEnabled    << 0
> +        | (unsigned long long)context.mode                  << 1; // This is multiple bits, so keep it last.

Why the need for bits2? bits is 64 bit, so we should be able to go up to 1 << 63.
Comment 7 cathiechen 2022-03-28 05:37:37 PDT
Comment on attachment 455758 [details]
Patch

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

>> Source/WebCore/css/parser/CSSParserContext.cpp:219
>> +        | (unsigned long long)context.mode                  << 1; // This is multiple bits, so keep it last.
> 
> Why the need for bits2? bits is 64 bit, so we should be able to go up to 1 << 63.

Yes, sizeof(uint64_t) is 8. But I got this compiling error, not sure why...

```
./css/parser/CSSParserContext.cpp:217:61: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
        | context.containIntrinsicSizeEnabled               << 32
                                                            ^  ~~
1 error generated
```
Comment 8 cathiechen 2022-03-28 06:05:18 PDT
Comment on attachment 455758 [details]
Patch

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

>>> Source/WebCore/css/parser/CSSParserContext.cpp:219
>>> +        | (unsigned long long)context.mode                  << 1; // This is multiple bits, so keep it last.
>> 
>> Why the need for bits2? bits is 64 bit, so we should be able to go up to 1 << 63.
> 
> Yes, sizeof(uint64_t) is 8. But I got this compiling error, not sure why...
> 
> ```
> ./css/parser/CSSParserContext.cpp:217:61: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
>         | context.containIntrinsicSizeEnabled               << 32
>                                                             ^  ~~
> 1 error generated
> ```

Done! Thanks, Rob, for pointing out context.containIntrinsicSizeEnabled is only 32 bit, I just need to add a cast here.
Comment 9 cathiechen 2022-03-28 06:18:59 PDT
Created attachment 455911 [details]
Patch
Comment 10 Radar WebKit Bug Importer 2022-03-28 06:41:43 PDT
<rdar://problem/90919423>
Comment 11 cathiechen 2022-03-29 06:31:55 PDT
Comment on attachment 455911 [details]
Patch

Hi,
I think the patch is ready for review, please take a look. Thanks!
Comment 12 Rob Buis 2022-04-06 07:54:47 PDT
Created attachment 456820 [details]
Patch
Comment 13 Rob Buis 2022-04-06 10:48:30 PDT
Created attachment 456837 [details]
Patch
Comment 15 Rob Buis 2022-04-07 01:38:13 PDT
Created attachment 456899 [details]
Patch
Comment 16 Rob Buis 2022-04-07 01:39:06 PDT
(In reply to Tim Nguyen (:ntim) from comment #14)
> Can you fix the assert:
> 
> https://ews-build.s3-us-west-2.amazonaws.com/macOS-AppleSilicon-Big-Sur-
> Debug-WK2-Tests-EWS/456837-28300-rerun/accessibility/mac/media-role-
> descriptions-stderr.txt
> 
> ? Seems like this needs animation support.

Thanks for the heads up, the latest patch should fix it.
Comment 17 Rob Buis 2022-04-08 01:29:21 PDT
Created attachment 457027 [details]
Patch
Comment 18 Rob Buis 2022-04-13 10:09:41 PDT
Created attachment 457541 [details]
Patch
Comment 19 Rob Buis 2022-04-14 11:01:14 PDT
This is now ready for review :)
Comment 20 Tim Nguyen (:ntim) 2022-04-15 09:58:27 PDT
Comment on attachment 457541 [details]
Patch

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

> Source/WebCore/css/parser/CSSParserContext.cpp:217
> +        | (unsigned long long)context.containIntrinsicSizeEnabled << 32

Why does this need to be (unsigned long long)? I assume this is bad copy paste?

> Source/WebCore/css/parser/CSSPropertyParser.cpp:4097
> +            break;

Why not `return nullptr;`?

> Source/WebCore/rendering/style/StyleRareNonInheritedData.h:240
> +    unsigned containIntrinsicWidthType : 3;
> +    unsigned containIntrinsicHeightType : 3;

Does this not fit in 2? The enum only has 3 values and 2**2 == 4
Comment 21 Rob Buis 2022-04-15 11:37:07 PDT
Created attachment 457708 [details]
Patch
Comment 22 Rob Buis 2022-04-15 11:38:06 PDT
Comment on attachment 457541 [details]
Patch

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

>> Source/WebCore/css/parser/CSSParserContext.cpp:217
>> +        | (unsigned long long)context.containIntrinsicSizeEnabled << 32
> 
> Why does this need to be (unsigned long long)? I assume this is bad copy paste?

Yes that was a bit lazy, fixed.

>> Source/WebCore/css/parser/CSSPropertyParser.cpp:4097
>> +            break;
> 
> Why not `return nullptr;`?

Why not indeed. Fixed.

>> Source/WebCore/rendering/style/StyleRareNonInheritedData.h:240
>> +    unsigned containIntrinsicHeightType : 3;
> 
> Does this not fit in 2? The enum only has 3 values and 2**2 == 4

It should fit indeed. Fixed.
Comment 23 Simon Fraser (smfr) 2022-04-19 11:43:07 PDT
Comment on attachment 457708 [details]
Patch

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

Don't forget to fix RenderStyle::diff() in this or a future patch.

> Source/WebCore/rendering/style/StyleRareNonInheritedData.h:240
> +    unsigned containIntrinsicWidthType : 2;
> +    unsigned containIntrinsicHeightType : 2;

Add a `// ContainIntrinsicSizeType` comment on both lines

> Source/WebCore/style/StyleBuilderCustom.h:2167
> +    CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(CSSPropertyContainIntrinsicBlockSize, style.direction(), style.writingMode());

Maybe `auto resolvedID = `
Comment 24 Tim Nguyen (:ntim) 2022-04-19 12:43:49 PDT
Comment on attachment 457708 [details]
Patch

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

> Source/WebCore/css/parser/CSSParserContext.cpp:217
> +        | (uint64_t)context.containIntrinsicSizeEnabled     << 32

Does: 
| context.containIntrinsicSizeEnabled << 32

just work here? (just for consistency for the other *Enabled flags)
Comment 25 cathiechen 2022-04-19 23:05:18 PDT
Comment on attachment 457708 [details]
Patch

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

>> Source/WebCore/css/parser/CSSParserContext.cpp:217
>> +        | (uint64_t)context.containIntrinsicSizeEnabled     << 32
> 
> Does: 
> | context.containIntrinsicSizeEnabled << 32
> 
> just work here? (just for consistency for the other *Enabled flags)

Looks like not, we will get the following error:
```
./css/parser/CSSParserContext.cpp:217:61: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
        | context.containIntrinsicSizeEnabled               << 32
                                                            ^  ~~
1 error generated
```

For context.containIntrinsicSizeEnabled is 32 bit, we need to extend it to 64 bit, then it could be moved 32.
Comment 26 cathiechen 2022-04-20 02:59:05 PDT
Comment on attachment 457708 [details]
Patch

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

>> Source/WebCore/rendering/style/StyleRareNonInheritedData.h:240
>> +    unsigned containIntrinsicHeightType : 2;
> 
> Add a `// ContainIntrinsicSizeType` comment on both lines

Done

>> Source/WebCore/style/StyleBuilderCustom.h:2167
>> +    CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(CSSPropertyContainIntrinsicBlockSize, style.direction(), style.writingMode());
> 
> Maybe `auto resolvedID = `

Done
Comment 27 cathiechen 2022-04-20 03:00:03 PDT
(In reply to Simon Fraser (smfr) from comment #23)
> Comment on attachment 457708 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=457708&action=review
> 
> Don't forget to fix RenderStyle::diff() in this or a future patch.
> 

Thanks! We will handle this in the implementing patch:)
Comment 28 cathiechen 2022-04-20 03:05:45 PDT
Created attachment 457970 [details]
Patch
Comment 29 cathiechen 2022-04-20 03:30:37 PDT
Created attachment 457971 [details]
Patch
Comment 30 EWS 2022-04-20 04:52:56 PDT
Committed r293090 (249801@main): <https://commits.webkit.org/249801@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 457971 [details].
Comment 31 Oriol Brufau 2022-05-30 09:47:03 PDT
Comment on attachment 457971 [details]
Patch

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

> Source/WebCore/css/CSSProperties.json:5327
> +                "logical-property-group": {

Logical properties are resolved into physical before being applied. So you can use skip-builder:true and then remove the logical BuilderCustom methods. That's what other logical properties do.
Comment 32 Brent Fulgham 2022-07-01 15:12:39 PDT
*** Bug 204316 has been marked as a duplicate of this bug. ***