mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Expose titlebar radius as a chrome-only CSS environment variable
Mostly plumbing. Differential Revision: https://phabricator.services.mozilla.com/D128680
This commit is contained in:
parent
5c861b90c5
commit
07e5ea6966
2 changed files with 13 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue