Bug 228130 - [css-logical] Simplify logical property groups
Summary: [css-logical] Simplify logical property groups
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: 2021-07-20 15:58 PDT by Oriol Brufau
Modified: 2022-01-18 04:29 PST (History)
8 users (show)

See Also:


Attachments
Patch (6.64 KB, patch)
2021-07-20 16:02 PDT, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (6.66 KB, patch)
2022-01-17 11:33 PST, 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 2021-07-20 15:58:44 PDT
Currently, makeprop.pl has

    my %resolverKinds = (
        "logical" => {
            "block" => "axis",
            "inline" => "axis",
            "block-start" => "side",
            "block-end" => "side",
            "inline-start" => "side",
            "inline-end" => "side",
            "start-start" => "corner",
            "start-end" => "corner",
            "end-start" => "corner",
            "end-end" => "corner",
        },
        "physical" => {
            "horizontal" => "axis",
            "vertical" => "axis",
            "top" => "side",
            "right" => "side",
            "bottom" => "side",
            "left" => "side",
            "top-left" => "corner",
            "top-right" => "corner",
            "bottom-right" => "corner",
            "bottom-left" => "corner",
        },
    );

So many repeated values, it would be better to structure it like:

    my %logicalPropertyResolvers = (
        "logical" => {
            "axis" => ["inline", "block"],
            "side" => ["block-start", "inline-end", "block-end", "inline-start"],
            "corner" => ["start-start", "start-end", "end-start", "end-end"],
        },
        "physical" => {
            "axis" => ["horizontal", "vertical"],
            "side" => ["top", "right", "bottom", "left"],
            "corner" => ["top-left", "top-right", "bottom-right", "bottom-left"],
        },
    );

And this would avoid having to hardcode the lists in this other piece of code:

        if ($kind eq "side") {
            @physicals = ("top", "right", "bottom", "left");
        } elsif ($kind eq "corner") {
            @physicals = ("top-left", "top-right", "bottom-right", "bottom-left");
        } elsif ($kind eq "axis") {
            @physicals = ("horizontal", "vertical");
        }
Comment 1 Oriol Brufau 2021-07-20 16:02:05 PDT
Created attachment 433905 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2021-07-27 15:59:21 PDT
<rdar://problem/81187057>
Comment 3 Oriol Brufau 2022-01-17 11:33:13 PST
Created attachment 449343 [details]
Patch
Comment 4 Oriol Brufau 2022-01-17 16:06:33 PST
Antti, can you take a look? Not urgent.
Comment 5 Antti Koivisto 2022-01-17 23:31:02 PST
Comment on attachment 449343 [details]
Patch

rs=me
Comment 6 EWS 2022-01-18 04:29:53 PST
Committed r288114 (246128@main): <https://commits.webkit.org/246128@main>

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