From face4ed65e84127d32f3f7e6953e70c5b707e808 Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Mon, 16 Nov 2026 00:21:39 +0200 Subject: [PATCH] docs(csslib): describe partial Font.cssExpression output Applies the dart-lang/tools#2847 review: the cssExpression doc comment now says partial fonts print only the parts they have, and the CHANGELOG entry is one summary line. --- pkgs/csslib/CHANGELOG.md | 1 + pkgs/csslib/lib/src/property.dart | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/csslib/CHANGELOG.md b/pkgs/csslib/CHANGELOG.md index 2329efc65..932e61c51 100644 --- a/pkgs/csslib/CHANGELOG.md +++ b/pkgs/csslib/CHANGELOG.md @@ -46,6 +46,7 @@ sharing mutable AST nodes between the original and its clone. - Correctly parse unit-like type selectors (`rem`, `vw`, `dpi`, etc.) at the start of `selector()` and `parseSelectorGroup()` input and of style rules. +- Fix `Font.cssExpression` output for partial fonts and line heights. - Fix the values of the `aliceblue` color keyword and the `Color.aliceBlue`, `Color.antiqueWhite` and `Color.peru` constants. - Fix unhandled exceptions (`RangeError`, `FormatException`, `StateError`, diff --git a/pkgs/csslib/lib/src/property.dart b/pkgs/csslib/lib/src/property.dart index d4e4692da..b70ca4007 100644 --- a/pkgs/csslib/lib/src/property.dart +++ b/pkgs/csslib/lib/src/property.dart @@ -1084,12 +1084,12 @@ class Font implements _StyleProperty { /// /// font-style font-variant font-weight font-size/line-height font-family /// - /// The font-size and font-family values are required. If any of the other - /// values are missing the default value is used. + /// Only the parts that are set are printed, so a partial font (for example + /// one with only a weight, which prints `700`) is not a complete `font` + /// shorthand; that needs at least a size and a family. @override String get cssExpression { - // Partial fonts omit absent parts. A unitless line height is a multiplier, - // so pixel heights need their unit. + // A unitless line height is a multiplier, so pixel heights need their unit. final families = _fontsAsString; final height = lineHeight; final sizePart = size == null