style: Use GTK menu radius on native context menus and panels

Differential Revision: https://phabricator.services.mozilla.com/D129439
This commit is contained in:
Emilio Cobos Álvarez 2023-05-27 17:37:42 +02:00 committed by Oriol Brufau
parent 9868cd52ba
commit 1b04838278
2 changed files with 13 additions and 1 deletions

View file

@ -75,8 +75,13 @@ fn get_titlebar_radius(device: &Device) -> VariableValue {
VariableValue::pixel(device.titlebar_radius())
}
static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 1] = [
fn get_menu_radius(device: &Device) -> VariableValue {
VariableValue::pixel(device.menu_radius())
}
static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 2] = [
make_variable!(atom!("-moz-gtk-csd-titlebar-radius"), get_titlebar_radius),
make_variable!(atom!("-moz-gtk-menu-radius"), get_menu_radius),
];
impl CssEnvironment {

View file

@ -447,6 +447,13 @@ impl Device {
}
}
/// Returns the gtk menu radius in CSS pixels.
pub fn menu_radius(&self) -> f32 {
unsafe {
bindings::Gecko_GetLookAndFeelInt(bindings::LookAndFeel_IntID::GtkMenuRadius as i32) as f32
}
}
/// Return whether the document is a chrome document.
#[inline]
pub fn is_chrome_document(&self) -> bool {