Skip to content
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

audit(non-composited-animations): add UIString for custom properties #15571

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions core/audits/non-composited-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ const UIStrings = {
=1 {Unsupported CSS Property: {properties}}
other {Unsupported CSS Properties: {properties}}
}`,
/**
* @description Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the animated custom CSS property not being supported on the compositor. Shown in a table with a list of other potential failure reasons.
* @example {--my-custom-property} properties
* */
unsupportedCustomCSSProperty: 'Custom CSS properties cannot be animated on the compositor: ' +
'{properties}',
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to a `transform` property being dependent on the size of the element itself. Shown in a table with a list of other potential failure reasons. */
transformDependsBoxSize: 'Transform-related property depends on box size',
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to a `filter` property possibly moving pixels. Shown in a table with a list of other potential failure reasons. */
Expand All @@ -56,6 +62,10 @@ const ACTIONABLE_FAILURE_REASONS = [
flag: 1 << 13,
text: UIStrings.unsupportedCSSProperty,
},
{
flag: 1 << 13,
text: UIStrings.unsupportedCustomCSSProperty,
},
{
flag: 1 << 11,
text: UIStrings.transformDependsBoxSize,
Expand Down Expand Up @@ -91,9 +101,18 @@ function getActionableFailureReasons(failureCode, unsupportedProperties) {
.filter(reason => failureCode & reason.flag)
.map(reason => {
if (reason.text === UIStrings.unsupportedCSSProperty) {
const nonCustomUnSupportedProperties = unsupportedProperties
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const nonCustomUnSupportedProperties = unsupportedProperties
const nonCustomUnsupportedProperties = unsupportedProperties

.filter(property => !property.startsWith('--'));
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
.filter(property => !property.startsWith('--'));
.filter(property => !property.startsWith('--'));

Copy link
Author

Choose a reason for hiding this comment

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

sure
Will do in a bit

return str_(reason.text, {
propertyCount: unsupportedProperties.length,
properties: unsupportedProperties.join(', '),
propertyCount: nonCustomUnSupportedProperties.length,
properties: nonCustomUnSupportedProperties.join(', '),
});
}
if (reason.text === UIStrings.unsupportedCustomCSSProperty) {
const customUnsupportedProperties = unsupportedProperties
.filter(property => property.startsWith('--'));
return str_(UIStrings.unsupportedCustomCSSProperty, {
properties: customUnsupportedProperties.join(', '),
});
}
return str_(reason.text);
Expand Down
3 changes: 3 additions & 0 deletions shared/localization/locales/en-US.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions shared/localization/locales/en-XL.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.