Fix phantom positive implicit track for auto-start/definite-end placements - #1169
Merged
Merged
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
Fix the last two failing subtests of the WPT tests
css/css-grid/parsing/grid-template-{columns,rows}-computed-implicit-track.htmlin Servo: withgrid-template-columns: noneand a child atgrid-column: auto / 1, the resolved value serialized as10px 0pxinstead of10px— a phantom zero-sized positive implicit track leaked intoDetailedGridTracksInfo.Context
The bug is in the implicit grid size estimate, not serialization. In
child_min_line_max_line_span, the(Auto, Line(track))case computedmin = track, ignoring that an auto-start/definite-end placement resolves to a span of 1 ending at that line (occupying[track - 1, track]):(The symmetric
(Line(track), Auto)max case already correctly usedtrack + 1.)With
minunder-counted, the estimate reported 0 negative implicit tracks, and the "adjust positive track estimate to fit the max span" step then compensated by adding a spurious positive implicit track. The negative track was later added correctly during placement viaexpand_to_fit_range, leaving one real track plus a phantom 0px track at the end (negative_implicit=1, explicit=0, positive_implicit=1). The wrong estimate also caused the auto-placement cursor to spuriously advance in the secondary axis (via theprimary_span.start < primary_idxcheck), creating an extra implicit row as well.Both WPT subtests are ported as gentest fixtures (
grid_template_serialization_negative_implicit_{column,row}.html) — the generated expectations from Chrome assertresolved-columns="10px"/resolved-rows="10px", matching the WPT expectations exactly.Verified:
cargo test --workspace --all-featurespasses,cargo fmt/cargo clippyclean (one pre-existing MSRV warning unrelated to this change).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/4946c92d12ba4edc933f5a8888f5584f
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/4946c92d12ba4edc933f5a8888f5584f?variant=devin-insiders
Requested by: @nicoburns