git.lucas.co / cce-browser
web browser (Servo)
git clone https://git.lucas.co/cce-browser.git

commit2e700feb4fcb0a3089d42c3ff4e18e329ef30ba8
parent6ff53d5eb6
authorLucas Galante <[email protected]>
date2026-08-27 08:44
feat: enable CSS Grid

Servo gates grid behind `layout.grid.enabled`, which defaults to false, so
every `display: grid` declaration was refused and the element fell back to
block flow. That is not a rare property: 33 refusals on one MDN reference
page, 175 on a GitHub repo page, 31 on a login page — a large slice of
modern layout quietly dropped, which is why so much of the web rendered as
one collapsed column here.

Measured before -> after on the same pages at the same size:

  MDN grid reference: 33 refusals -> 0. Renders as its real three-column
  layout (nav sidebar, article, "In this article" TOC) instead of a single
  column with the nav crammed into a strip and the TOC pushed to the end.

  GitHub repo page: 175 -> 4. Near-identical either way, except the
  branch/tags row now lays out horizontally rather than stacking each icon
  above its label.

Scope of that evidence, deliberately stated: two sites, spot-checked
visually, not a sweep. The one rough edge seen so far is Cloudflare's
Turnstile widget, which renders as a black blob with grid enabled — though
it was already broken without it (logo, links, clipped text, no checkbox),
so this is a different flavour of broken, not a regression.

Co-Authored-By: Claude Opus 5 <[email protected]>

 src/webview.rs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/webview.rs b/src/webview.rs
index 75c4273..2a3c909 100644
--- a/src/webview.rs
+++ b/src/webview.rs
@@ -339,7 +339,14 @@ impl ServoHost {
             use std::os::unix::fs::PermissionsExt;
             let _ = std::fs::set_permissions(&profile_dir, std::fs::Permissions::from_mode(0o700));
         }
+        // CSS Grid ships disabled in Servo (`layout.grid.enabled` defaults to
+        // false), so every `display: grid` declaration is refused and the
+        // element falls back to block flow — 31 refusals on one mainstream
+        // login page, which is a lot of modern layout quietly dropped.
+        let mut preferences = servo::Preferences::default();
+        preferences.layout_grid_enabled = true;
         let servo = ServoBuilder::default()
+            .preferences(preferences)
             .opts(servo::Opts {
                 config_dir: Some(profile_dir),
                 ..Default::default()