Bug 191042 - CSS Custom Properties API Should Support syntax="*" and "<length>", and handle cycles properly
Summary: CSS Custom Properties API Should Support syntax="*" and "<length>", and handl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Justin Michaud
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-10-29 14:39 PDT by Justin Michaud
Modified: 2018-11-04 03:05 PST (History)
8 users (show)

See Also:


Attachments
Patch (127.96 KB, patch)
2018-10-29 19:10 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Changes from last patch (3.13 KB, patch)
2018-10-30 10:23 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Patch (128.56 KB, patch)
2018-10-30 12:02 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Changes from unrolled patch (4.92 KB, patch)
2018-10-30 12:03 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Patch (128.70 KB, patch)
2018-10-31 11:36 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Changes from last patch (5.13 KB, patch)
2018-10-31 11:37 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Patch (128.58 KB, patch)
2018-10-31 20:08 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Changes from rolled out patch (7.47 KB, patch)
2018-10-31 20:09 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Patch (128.62 KB, patch)
2018-10-31 20:34 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Changes from rolled-out patch (8.45 KB, patch)
2018-10-31 20:35 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Michaud 2018-10-29 14:39:16 PDT
<https://bugs.webkit.org/show_bug.cgi?id=190039> was rolled out due to a performance regression in speedometer. Let's try this again.
Comment 1 Justin Michaud 2018-10-29 14:43:39 PDT Comment hidden (obsolete)
Comment 2 Justin Michaud 2018-10-29 14:46:36 PDT
Roll out: <rdar://problem/45546003>
Comment 3 Justin Michaud 2018-10-29 19:10:20 PDT
Created attachment 353344 [details]
Patch
Comment 4 Justin Michaud 2018-10-29 20:36:18 PDT
<rdar://45477680>
Comment 5 Justin Michaud 2018-10-30 10:23:42 PDT
Created attachment 353382 [details]
Changes from last patch
Comment 6 Antti Koivisto 2018-10-30 11:13:19 PDT
Justin said he is trying some template specialization for no-custom-properties case to eliminate the remaining regression.
Comment 7 Justin Michaud 2018-10-30 12:02:52 PDT
Created attachment 353394 [details]
Patch
Comment 8 Justin Michaud 2018-10-30 12:03:21 PDT
Created attachment 353395 [details]
Changes from unrolled patch
Comment 9 Dean Jackson 2018-10-30 12:09:13 PDT
Comment on attachment 353395 [details]
Changes from unrolled patch

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

> Source/WebCore/css/StyleResolver.cpp:2356
> +                // We are in a cycle (eg. setting font size using registered custom property value containing em)
> +                // So this value should be unset

Nit: .
Comment 10 Antti Koivisto 2018-10-31 02:58:04 PDT
Comment on attachment 353394 [details]
Patch

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

> Source/WebCore/css/StyleResolver.cpp:2336
> +        return applyCascadedPropertiesImpl<false>(firstProperty, lastProperty, state);
> +    return applyCascadedPropertiesImpl<true>(firstProperty, lastProperty, state);

It would be nicer to use enum instead of bool:

applyCascadedPropertiesImpl<CustomPropertyCycleTracking::Enabled>(..)

or similar.
Comment 11 Justin Michaud 2018-10-31 11:36:37 PDT
Created attachment 353513 [details]
Patch
Comment 12 Justin Michaud 2018-10-31 11:37:10 PDT
Created attachment 353514 [details]
Changes from last patch
Comment 13 Antti Koivisto 2018-10-31 12:21:19 PDT
Comment on attachment 353513 [details]
Patch

R=me
Comment 14 Justin Michaud 2018-10-31 20:08:25 PDT
Created attachment 353574 [details]
Patch
Comment 15 Justin Michaud 2018-10-31 20:09:20 PDT
Created attachment 353575 [details]
Changes from rolled out patch
Comment 16 Justin Michaud 2018-10-31 20:34:25 PDT
Created attachment 353576 [details]
Patch
Comment 17 Justin Michaud 2018-10-31 20:35:42 PDT
Created attachment 353577 [details]
Changes from rolled-out patch
Comment 18 Justin Michaud 2018-11-01 10:17:08 PDT
This patch seems to have fixed all of the performance regressions. Once the perf trial finishes, it looks like it should be good to land.
Comment 19 WebKit Commit Bot 2018-11-01 13:35:35 PDT
Comment on attachment 353576 [details]
Patch

Clearing flags on attachment: 353576

Committed r237697: <https://trac.webkit.org/changeset/237697>
Comment 20 WebKit Commit Bot 2018-11-01 13:35:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Antti Koivisto 2018-11-04 03:04:56 PST
Comment on attachment 353576 [details]
Patch

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

A few minor additional comments.

> Source/WebCore/css/StyleResolver.cpp:2354
> +        if (TrackCycles == CustomPropertyCycleTracking::Disabled) {
> +            // If we don't have any custom properties, then there can't be any cycles.
> +            property.apply(*this, state);
> +        } else {
> +            if (UNLIKELY(state.inProgressProperties.get(propertyID))) {

We usually try to main flow of the function the common case and use early return/continue for uncommon cases. That would suggest structure like

if (TrackCycles == CustomPropertyCycleTracking::Enabled) {
    ...
    continue;
}
property.apply(*this, state);

> Source/WebCore/css/StyleResolver.h:328
> +    enum CustomPropertyCycleTracking { Enabled = 0, Disabled };

This should be a an enum class so we don't put Enabled and Disabled to StyleResolver namespace.

No need for = 0
Comment 22 Antti Koivisto 2018-11-04 03:05:39 PST
*try to make