Repository navigation
css: keep <general-enclosed> media and container conditions as written
#46756
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 (optional) Stylesheets that built on the base branch now print different
@ supports selector(..)and@ import .. supports(..)text, with trailing whitespace and comments kept even under--minify. Removing the early return at src/css/css_parser.rs:3310 makes expect_no_error_token scan to the closing), so the slice taken at supports.rs:339 and supports.rs:320 now ends at)instead of right after the first nested block. Fix: trim trailing whitespace/comments from the slice at both slice_from_cloned sites (or stop the slice at the last non-whitespace token) so the Selector and Declaration text matches base for every input that already built.Why this was flagged
Input
@ supports selector(:is(a) ) {}or@ import "a.css" supports(transform: rotate(1deg) );reaches expect_no_error_token through supports.rs:339 (Selector) and supports.rs:319 (Declaration via css_parser.rs:1194). On base the loop returned Ok right after the first nested block (:is(/rotate(), so slice_from_cloned at supports.rs:340 / supports.rs:320 ended at that block's)and the trailingor/* c */was dropped by parse_entirely's expect_exhausted. With the diff at src/css/css_parser.rs:3310 the loop continues until the stop_before), so the slice now includes the trailing whitespace and any comment, and the printer writes it verbatim (supports.rs:200 write_bytes) in minified output. This runs for every @ supports/@ import supports with a function value in every build; it is a printed-output regression for input that was valid on base. Remedy: trim trailing whitespace/comments at the two slice sites.Verification: Base src/css/css_parser.rs:3310 returned right after the first nested block, so
slice_from_cloned(p)at supports.rs:340 / :320 ended at that block's);expect_exhausted(css_parser.rs:3630-3649) skipped trailingor/* c */. Now the loop (3309-3311) consumes them, so the slice is:is(a)andto_csswrites it raw viawrite_bytes(supports.rs:162, :200) under minify.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changed. This is the output of #38552, which is the same one-line change and pins
selector(:is(a) )andsupports(transform:translate(1px) )with the space. The description lists it under "@supports", and a test here pins the same text so the two PRs agree. A trim at the twoslice_from_clonedsites insupports.rsis possible, but it should be decided in one place for both PRs.