* { box-sizing: inherit } might be relatively common, and it tanks some of the style system optimizations.
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
People
(Reporter: emilio, Unassigned)
Details
Context here: https://x.com/ecbos_/status/1796571018460557540
The issue is that we keep track of whether children inherit non-inherited properties using one bit, in order to stop the cascade early if we can:
- https://searchfox.org/mozilla-central/rev/5ff3324fe989a19c6fa5ac5b923089ef4ce2ebb2/servo/components/style/matching.rs#977-979
- https://searchfox.org/mozilla-central/rev/5ff3324fe989a19c6fa5ac5b923089ef4ce2ebb2/servo/components/style/data.rs#408-415
- https://searchfox.org/mozilla-central/rev/5ff3324fe989a19c6fa5ac5b923089ef4ce2ebb2/servo/components/style/traversal.rs#490-492
Simon, is it possible to take a quick httparchive look at how common this is? https://searchfox.org/mozilla-central/search?path=&q=box-sizing%3A+inherit shows we use it internally in some places. It might be worth special-casing this.
Comment 1•11 months ago
|
||
Based on GH code search, it seems to be common: https://github.com/search?q=*+%7B+box-sizing%3A+inherit+&type=code
Httparchive query:
SELECT
DISTINCT page
FROM
`httparchive.almanac.parsed_css`
WHERE
date = "2022-07-01"
AND client = "desktop"
AND REGEXP_CONTAINS(css, r"\*(?:,\s*\*?::?before,\s*\*?::?after)?\s*{(?:[^}]*)\bbox-sizing:\s*inherit[;}]")
11,638 matches out of 7,303,959 pages ≈ 0.16% of pages (in 2022).
The matches are: https://docs.google.com/spreadsheets/d/1MAJHWEl9UZ30N7aP7iNwT6NE8lutDt8eGYMRVRz6LVA/edit?usp=sharing
Description
•