fix(servo): enable CSS Grid so grid layouts stop collapsing
`Preferences::default()` is Servo's conservative library default and
ships `layout_grid_enabled: false`. `Servo::new` forwards prefs to Stylo
(`prefs::set` -> `stylo_static_prefs::set_pref!("layout.grid.enabled")`),
so with the gate off Stylo blockifies `display: grid`: every grid
container collapses to `display: block` and grid-based page layouts
stack into a single column — the "broken" rendering reported on modern
sites.
`ely_servo_preferences()` only flipped `dom_intersection_observer_enabled`
and inherited the grid default, so ELY rendered grid pages collapsed
while Servo's own servoshell (which enables the pref) renders them
correctly. The layout path is implemented — servo-layout drives
`DisplayInside::Grid` through Taffy — so enabling the pref is the real
fix, not a workaround.
Verified with a deterministic `display: grid; grid-template-columns:
1fr 1fr 1fr` page: 9 stacked full-width bars before, a 3x3 grid after.
Wikipedia/HN/GitHub/google.com re-checked unchanged; full workspace
test suite green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -241,7 +241,18 @@ fn install_rustls_provider() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ely_servo_preferences() -> Preferences {
|
fn ely_servo_preferences() -> Preferences {
|
||||||
Preferences { dom_intersection_observer_enabled: true, ..Preferences::default() }
|
// `Preferences::default()` is Servo's conservative *library* default and ships
|
||||||
|
// CSS Grid off. `Servo::new` forwards prefs to Stylo via `prefs::set`, and with
|
||||||
|
// `layout.grid.enabled` off Stylo blockifies `display: grid`, collapsing every
|
||||||
|
// grid container to `display: block` — modern grid layouts stack into one column
|
||||||
|
// (the "broken" rendering on grid-based sites). The layout path is implemented
|
||||||
|
// (servo-layout drives `DisplayInside::Grid` through Taffy), so an embedder
|
||||||
|
// building a browser must enable it, exactly as Servo's own servoshell does.
|
||||||
|
Preferences {
|
||||||
|
dom_intersection_observer_enabled: true,
|
||||||
|
layout_grid_enabled: true,
|
||||||
|
..Preferences::default()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServoHost for SoftwareServoHost {
|
impl ServoHost for SoftwareServoHost {
|
||||||
|
|||||||
Reference in New Issue
Block a user