diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index a6908bb4cfa..7e8a1e37f7f 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -71,7 +71,12 @@ static ENVIRONMENT_VARIABLES: [EnvironmentVariable; 4] = [ make_variable!(atom!("safe-area-inset-right"), get_safearea_inset_right), ]; -static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 0] = [ +fn get_titlebar_radius(device: &Device) -> VariableValue { + VariableValue::pixel(device.titlebar_radius()) +} + +static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 1] = [ + make_variable!(atom!("-moz-gtk-csd-titlebar-radius"), get_titlebar_radius), ]; impl CssEnvironment { diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index 2966363a8eb..a560211d2f3 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -440,6 +440,13 @@ impl Device { } } + /// Returns the gtk titlebar radius in CSS pixels. + pub fn titlebar_radius(&self) -> f32 { + unsafe { + bindings::Gecko_GetLookAndFeelFloat(bindings::LookAndFeel_FloatID::TitlebarRadius as i32) + } + } + /// Return whether the document is a chrome document. #[inline] pub fn is_chrome_document(&self) -> bool {