Skip to content

layout: Treat <audio> as replaced and do not display when there is no controls attribute#56739

Merged
Loirooriol merged 1 commit intoweb-platform-tests:masterfrom
servo:servo_export_41262
Dec 15, 2025
Merged

layout: Treat <audio> as replaced and do not display when there is no controls attribute#56739
Loirooriol merged 1 commit intoweb-platform-tests:masterfrom
servo:servo_export_41262

Conversation

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

@servo-wpt-sync servo-wpt-sync commented Dec 15, 2025

Add an important UA style to ensure that <audio> isn't displayed at all when it doesn't have the controls attribute. This matches Gecko, Blink and WebKit.

When it does have the attribute, then treat it as replaced. For example, this means that it won't stretch by default if it's block-level, that it will be atomic if inline-level, and that it won't generate boxes for its children (including ::before and ::after).

Previously we were generating ::before and ::after, but there was a bug: if they had some replaced content, the controls of the <audio> would be duplicated, and also appear on the pseudo-element. Then, since the various boxes for the controls would be backed by the same elements, Servo could panic because of a double borrow. This is now avoided.

Testing: Some WPT are now passing, also adding a new crashtest. There is one failure about innerText, but the test is probably wrong, now we match other browsers.
Fixes: #40693
Fixes: #41183

Reviewed in servo/servo#41262

Copy link
Copy Markdown
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

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

The review process for this patch is being conducted in the Servo project.

@servo-wpt-sync servo-wpt-sync added stale-servo-export PRs that were supposed to merge but were not able to do so. and removed do not merge yet labels Dec 15, 2025
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator Author

⛔ The downstream PR has merged (servo/servo#41262), but these changes could not be merged properly. Please address any CI issues and try to merge manually.

Add an important UA style to ensure that `<audio>` isn't displayed at
all when it doesn't have the `controls` attribute. This matches Gecko,
Blink and WebKit.

When it does have the attribute, then treat it as replaced. For example,
this means that it won't stretch by default if it's block-level, that it
will be atomic if inline-level, and that it won't generate `::before` or
`::after`.

Previously we were generating `::before` and `::after`, but there was a
bug: if they had some replaced content, the controls of the `<audio>`
would be duplicated, and also appear on the pseudo-element. Then, since
the various boxes for the controls would be backed by the same elements,
Servo could panic because of a double borrow. This is now avoided.

Signed-off-by: Oriol Brufau <[email protected]>
@Loirooriol Loirooriol enabled auto-merge (rebase) December 15, 2025 15:14
@Loirooriol Loirooriol merged commit be58421 into web-platform-tests:master Dec 15, 2025
24 checks passed
@Loirooriol Loirooriol deleted the servo_export_41262 branch January 14, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

html servo-export stale-servo-export PRs that were supposed to merge but were not able to do so.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants