Bug 233109 - Implement parsing and animation support for offset shorthand
Summary: Implement parsing and animation support for offset shorthand
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kiet Ho
URL:
Keywords: InRadar
: 232760 (view as bug list)
Depends on: 233108
Blocks: 203847
  Show dependency treegraph
 
Reported: 2021-11-14 13:39 PST by Kiet Ho
Modified: 2022-02-15 21:28 PST (History)
15 users (show)

See Also:


Attachments
WIP (45.46 KB, patch)
2021-11-15 16:38 PST, Kiet Ho
no flags Details | Formatted Diff | Diff
WIP (45.33 KB, patch)
2021-11-15 18:00 PST, Kiet Ho
no flags Details | Formatted Diff | Diff
WIP (46.45 KB, patch)
2021-11-19 10:54 PST, Kiet Ho
no flags Details | Formatted Diff | Diff
Patch (46.90 KB, patch)
2022-02-10 23:56 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (48.27 KB, patch)
2022-02-11 10:58 PST, Nikos Mouchtaris
dino: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (47.78 KB, patch)
2022-02-15 15:03 PST, Nikos Mouchtaris
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (47.78 KB, patch)
2022-02-15 16:47 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kiet Ho 2021-11-14 13:39:55 PST
Implement parsing and animation support for offset shorthand
Comment 1 Kiet Ho 2021-11-15 16:38:06 PST
Created attachment 444318 [details]
WIP
Comment 2 EWS Watchlist 2021-11-15 16:38:55 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 3 Kiet Ho 2021-11-15 16:40:35 PST
*** Bug 232760 has been marked as a duplicate of this bug. ***
Comment 4 Kiet Ho 2021-11-15 18:00:24 PST
Created attachment 444324 [details]
WIP
Comment 5 Kiet Ho 2021-11-19 10:54:34 PST
Created attachment 444836 [details]
WIP
Comment 6 Kiet Ho 2021-11-19 10:58:56 PST
Still needs to figure out what is the correct serialization format. In particular, is it needed to make the serialization as short as possible?

For example, Chrome and this patch serializes "auto none" to "auto none". However, "auto" is equivalent and shorter.

On the other hand, "auto none reverse" must be serialized to "auto none reverse" and not "auto reverse", because according to the grammar, if offset-rotate is serialized, then so is offset-path.
Comment 7 Radar WebKit Bug Importer 2021-11-19 11:06:18 PST
<rdar://problem/85611877>
Comment 8 Nikos Mouchtaris 2022-02-10 23:56:01 PST
Created attachment 451649 [details]
Patch
Comment 9 Nikos Mouchtaris 2022-02-11 10:58:37 PST
Created attachment 451727 [details]
Patch
Comment 10 Dean Jackson 2022-02-15 12:57:26 PST
Comment on attachment 451727 [details]
Patch

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

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:2640
> +    {
> +        auto innerList = CSSValueList::createSpaceSeparated();
> +        innerList->append(valueForPositionOrAuto(style, style.offsetPosition()));
> +        innerList->append(valueForPathOperation(style, style.offsetPath(), SVGPathConversion::ForceAbsolute));
> +        innerList->append(CSSValuePool::singleton().createValue(style.offsetDistance(), style));
> +        innerList->append(valueForOffsetRotate(style.offsetRotate()));
> +
> +        outerList->append(WTFMove(innerList));
> +    }

Any reason for this being in its own  scope?

> Source/WebCore/css/StyleProperties.cpp:466
> +static bool isAutoKeyword(const CSSValue& value)
> +{
> +    if (!is<CSSPrimitiveValue>(value))
> +        return false;
> +
> +    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
> +    return primitiveValue.isValueID() && primitiveValue.valueID() == CSSValueAuto;
> +}

Is this really the first/only time we're checking for this keyword in the file?

> Source/WebCore/css/StyleProperties.cpp:508
> +            if (!offsetDistance.value() || !is<CSSPrimitiveValue>(offsetDistance.value()))

Maybe a local variable for offsetDistance.value() to avoid calling it multiple times?

> Source/WebCore/css/StyleProperties.cpp:527
> +            if (!offsetRotate.value() || !is<CSSOffsetRotateValue>(offsetRotate.value()))

Same with this .value()
Comment 11 Nikos Mouchtaris 2022-02-15 15:03:13 PST
Created attachment 452096 [details]
Patch
Comment 12 Nikos Mouchtaris 2022-02-15 15:04:32 PST
(In reply to Dean Jackson from comment #10)
> Comment on attachment 451727 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=451727&action=review
> 
> > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:2640
> > +    {
> > +        auto innerList = CSSValueList::createSpaceSeparated();
> > +        innerList->append(valueForPositionOrAuto(style, style.offsetPosition()));
> > +        innerList->append(valueForPathOperation(style, style.offsetPath(), SVGPathConversion::ForceAbsolute));
> > +        innerList->append(CSSValuePool::singleton().createValue(style.offsetDistance(), style));
> > +        innerList->append(valueForOffsetRotate(style.offsetRotate()));
> > +
> > +        outerList->append(WTFMove(innerList));
> > +    }
> 
> Any reason for this being in its own  scope?
Fixed.
> 
> > Source/WebCore/css/StyleProperties.cpp:466
> > +static bool isAutoKeyword(const CSSValue& value)
> > +{
> > +    if (!is<CSSPrimitiveValue>(value))
> > +        return false;
> > +
> > +    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
> > +    return primitiveValue.isValueID() && primitiveValue.valueID() == CSSValueAuto;
> > +}
> 
> Is this really the first/only time we're checking for this keyword in the
> file?
No reason for this to be its own function.
> 
> > Source/WebCore/css/StyleProperties.cpp:508
> > +            if (!offsetDistance.value() || !is<CSSPrimitiveValue>(offsetDistance.value()))
> 
> Maybe a local variable for offsetDistance.value() to avoid calling it
> multiple times?
Fixed.
> 
> > Source/WebCore/css/StyleProperties.cpp:527
> > +            if (!offsetRotate.value() || !is<CSSOffsetRotateValue>(offsetRotate.value()))
> 
> Same with this .value()
Fixed.
Comment 13 Nikos Mouchtaris 2022-02-15 16:47:47 PST
Created attachment 452109 [details]
Patch
Comment 14 EWS 2022-02-15 21:28:19 PST
Committed r289876 (247314@main): <https://commits.webkit.org/247314@main>

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