From fb9d8ddc73c3d7709d174724f68e92464128ff33 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 17 May 2023 00:36:44 +0200 Subject: [PATCH] style: Make sure to consume the flusher when we hit the cascade data cache So that sheets are properly marked as committed. The issue is that we have this "committed" optimization, to avoid doing work if somebody adds and removes an stylesheet without us flushing in the meantime: https://searchfox.org/mozilla-central/rev/f018480dfed4fc583703a5770a6db9ab9dc0fb99/servo/components/style/stylesheet_set.rs#308-319 The "committed" bit is set when we consume the flusher (in each(..)). However when we hit the cache, before this patch, we wouldn't consume it, which means that we may fail to do some full rebuilds even though we need them. Fix it by making sure we call each() in that case. We add a test (the test would show a red square before this patch, and a lime square with the fix). Differential Revision: https://phabricator.services.mozilla.com/D113206 --- components/style/stylist.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/style/stylist.rs b/components/style/stylist.rs index c4eebefeab9..74704e707df 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -138,6 +138,9 @@ where debug!(" > {:?}", sheet); } } + // The line below ensures the "committed" bit is updated properly + // below. + collection.each(|_, _| true); return Ok(Some(entry.clone())); }