Skip to content

Do not serialize shorthands when any longhands are missing #7770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

darinadler
Copy link
Member

@darinadler darinadler commented Dec 16, 2022

a7f14bf

Do not serialize shorthands when any longhands are missing
https://bugs.webkit.org/show_bug.cgi?id=249440
rdar://problem/103423965

Reviewed by Tim Nguyen.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt:
Expect one more test to pass.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::commonShorthandChecks const): Return empty string when a longhand is
missing. Also redid the logic for values that are set by the shorthand, since it no longer needs
to compute a count.
(WebCore::StyleProperties::getPropertyValue const): Removed unneeded checks since
commonShorthandChecks handles missing longhands, and parsing makes sure things have correct types.
(WebCore::StyleProperties::offsetValue const): Ditto.
(WebCore::StyleProperties::fontVariantValue const): Ditto.
(WebCore::StyleProperties::get2Values const): Ditto.
(WebCore::StyleProperties::get4Values const): Ditto.
(WebCore::StyleProperties::getLayeredShorthandValue const): Ditto.
(WebCore::StyleProperties::getGridTemplateValue const): Ditto.
(WebCore::StyleProperties::getGridValue const): Ditto.
(WebCore::StyleProperties::getGridRowColumnShorthandValue const): Ditto.
(WebCore::StyleProperties::getGridAreaShorthandValue const): Ditto.
(WebCore::StyleProperties::getShorthandValue const): Ditto.
(WebCore::StyleProperties::getCommonValue const): Ditto.
(WebCore::StyleProperties::borderImagePropertyValue const): Ditto.
(WebCore::StyleProperties::borderRadiusShorthandValue const): Ditto.
(WebCore::StyleProperties::borderPropertyValue const): Ditto.

* Source/WebCore/css/StyleProperties.h: Removed the unneeded argument from fontVariantValue.

Canonical link: https://commits.webkit.org/258038@main

d750def

Misc iOS, tvOS & watchOS macOS Linux Windows
⏳ 🧪 style ⏳ 🛠 ios ⏳ 🛠 mac ⏳ 🛠 wpe ⏳ 🛠 🧪 win
⏳ 🧪 bindings ⏳ 🛠 ios-sim ⏳ 🛠 mac-AS-debug ⏳ 🛠 gtk ⏳ 🛠 wincairo
⏳ 🧪 webkitperl ⏳ 🧪 ios-wk2 ⏳ 🧪 api-mac ⏳ 🧪 gtk-wk2
⏳ 🧪 webkitpy ⏳ 🧪 api-ios ⏳ 🧪 mac-wk1 ⏳ 🧪 api-gtk
⏳ 🛠 🧪 jsc ⏳ 🛠 tv ⏳ 🧪 mac-wk2 ⏳ 🛠 jsc-armv7
⏳ 🛠 🧪 jsc-arm64 ⏳ 🛠 tv-sim ⏳ 🧪 mac-AS-debug-wk2 ⏳ 🧪 jsc-armv7-tests
⏳ 🧪 services ⏳ 🛠 watch ⏳ 🧪 mac-wk2-stress ⏳ 🛠 jsc-mips
❌ 🛠 🧪 merge ⏳ 🛠 watch-sim ⏳ 🧪 jsc-mips-tests
✅ 🛠 🧪 unsafe-merge

@darinadler darinadler self-assigned this Dec 16, 2022
@darinadler darinadler added the CSS Cascading Style Sheets implementation label Dec 16, 2022
if (!start.value() || !end.value())
return { };
auto start = propertyAt(findPropertyIndex(shorthand.properties()[0]));
auto end = propertyAt(findPropertyIndex(shorthand.properties()[1]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end could just use getPropertyCSSValue.

start has an isImplicit check which doesn't seem to make much sense, maybe it could use getPropertyCSSValue too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isImplicit check is going away soon.

I think I‘ll take a pass through tightening up the code again once I finish removing implicit entirely.

Copy link
Member

@nt1m nt1m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great cleanup!

Would be nice to clean up propertyAt(findPropertyIndex(X) vs. getPropertyCSSValue(X).

@darinadler
Copy link
Member Author

Would be nice to clean up propertyAt(findPropertyIndex(X) vs. getPropertyCSSValue(X).

Mostly done, will do more in follow-up.

@darinadler darinadler force-pushed the eng/Dont-serialize-shorthands-when-any-of-the-longhands-are-missing branch from 9a4c19f to d750def Compare December 17, 2022 01:31
@darinadler darinadler added the merge-queue Applied to send a pull request to merge-queue label Dec 17, 2022
@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed merge-queue Applied to send a pull request to merge-queue labels Dec 17, 2022
@darinadler darinadler added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Dec 17, 2022
https://bugs.webkit.org/show_bug.cgi?id=249440
rdar://problem/103423965

Reviewed by Tim Nguyen.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt:
Expect one more test to pass.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::commonShorthandChecks const): Return empty string when a longhand is
missing. Also redid the logic for values that are set by the shorthand, since it no longer needs
to compute a count.
(WebCore::StyleProperties::getPropertyValue const): Removed unneeded checks since
commonShorthandChecks handles missing longhands, and parsing makes sure things have correct types.
(WebCore::StyleProperties::offsetValue const): Ditto.
(WebCore::StyleProperties::fontVariantValue const): Ditto.
(WebCore::StyleProperties::get2Values const): Ditto.
(WebCore::StyleProperties::get4Values const): Ditto.
(WebCore::StyleProperties::getLayeredShorthandValue const): Ditto.
(WebCore::StyleProperties::getGridTemplateValue const): Ditto.
(WebCore::StyleProperties::getGridValue const): Ditto.
(WebCore::StyleProperties::getGridRowColumnShorthandValue const): Ditto.
(WebCore::StyleProperties::getGridAreaShorthandValue const): Ditto.
(WebCore::StyleProperties::getShorthandValue const): Ditto.
(WebCore::StyleProperties::getCommonValue const): Ditto.
(WebCore::StyleProperties::borderImagePropertyValue const): Ditto.
(WebCore::StyleProperties::borderRadiusShorthandValue const): Ditto.
(WebCore::StyleProperties::borderPropertyValue const): Ditto.

* Source/WebCore/css/StyleProperties.h: Removed the unneeded argument from fontVariantValue.

Canonical link: https://commits.webkit.org/258038@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Dont-serialize-shorthands-when-any-of-the-longhands-are-missing branch from d750def to a7f14bf Compare December 17, 2022 08:29
@webkit-early-warning-system webkit-early-warning-system merged commit a7f14bf into WebKit:main Dec 17, 2022
@webkit-commit-queue
Copy link
Collaborator

Committed 258038@main (a7f14bf): https://commits.webkit.org/258038@main

Reviewed commits have been landed. Closing PR #7770 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Dec 17, 2022
@darinadler darinadler deleted the eng/Dont-serialize-shorthands-when-any-of-the-longhands-are-missing branch December 17, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Cascading Style Sheets implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants