Bug 248311 - Reuse the StylePropertyShorthand in StyleProperties::getPropertyValue()
Summary: Reuse the StylePropertyShorthand in StyleProperties::getPropertyValue()
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: 2022-11-24 09:04 PST by Oriol Brufau
Modified: 2022-11-25 00:57 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oriol Brufau 2022-11-24 09:04:27 PST
StyleProperties::getPropertyValue() has a big switch like this:

    switch (propertyID) {
    case CSSPropertyAll:
        return getCommonValue(allShorthand());
    case CSSPropertyAnimation:
        return getLayeredShorthandValue(animationShorthand());
    case CSSPropertyBorderSpacing:
        return borderSpacingValue(borderSpacingShorthand());
    case CSSPropertyBackgroundPosition:
        return getLayeredShorthandValue(backgroundPositionShorthand());
    case CSSPropertyBackground:
        return getLayeredShorthandValue(backgroundShorthand());
    ...

Most shorthands need to get the StylePropertyShorthand using allShorthand(), animationShorthand(), ...

But before the switch it calls commonShorthandChecks(), which uses shorthandForProperty(propertyID) to get the StylePropertyShorthand.

So this StylePropertyShorthand can be reused.
Comment 1 Oriol Brufau 2022-11-24 09:16:49 PST
Pull request: https://github.com/WebKit/WebKit/pull/6787
Comment 2 EWS 2022-11-25 00:56:09 PST
Committed 257011@main (70230d10f272): <https://commits.webkit.org/257011@main>

Reviewed commits have been landed. Closing PR #6787 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2022-11-25 00:57:19 PST
<rdar://problem/102659948>