mirror of
https://github.com/servo/servo.git
synced 2025-08-01 03:30:33 +01:00
style: Expose scrollbar-inline-size as a chrome-only environment variable
After the previous patches this is rather straight-forward. Reviewed in: https://phabricator.services.mozilla.com/D168148
This commit is contained in:
parent
89e01f1df6
commit
1a3b32a248
2 changed files with 21 additions and 1 deletions
|
@ -85,6 +85,10 @@ fn get_content_preferred_color_scheme(_device: &Device) -> VariableValue {
|
||||||
VariableValue::ident("light")
|
VariableValue::ident("light")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_scrollbar_inline_size(device: &Device) -> VariableValue {
|
||||||
|
VariableValue::pixels(device.scrollbar_inline_size().px())
|
||||||
|
}
|
||||||
|
|
||||||
static ENVIRONMENT_VARIABLES: [EnvironmentVariable; 4] = [
|
static ENVIRONMENT_VARIABLES: [EnvironmentVariable; 4] = [
|
||||||
make_variable!(atom!("safe-area-inset-top"), get_safearea_inset_top),
|
make_variable!(atom!("safe-area-inset-top"), get_safearea_inset_top),
|
||||||
make_variable!(atom!("safe-area-inset-bottom"), get_safearea_inset_bottom),
|
make_variable!(atom!("safe-area-inset-bottom"), get_safearea_inset_bottom),
|
||||||
|
@ -120,7 +124,7 @@ macro_rules! lnf_int_variable {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 6] = [
|
static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 7] = [
|
||||||
lnf_int_variable!(
|
lnf_int_variable!(
|
||||||
atom!("-moz-gtk-csd-titlebar-radius"),
|
atom!("-moz-gtk-csd-titlebar-radius"),
|
||||||
TitlebarRadius,
|
TitlebarRadius,
|
||||||
|
@ -146,6 +150,10 @@ static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 6] = [
|
||||||
atom!("-moz-content-preferred-color-scheme"),
|
atom!("-moz-content-preferred-color-scheme"),
|
||||||
get_content_preferred_color_scheme
|
get_content_preferred_color_scheme
|
||||||
),
|
),
|
||||||
|
make_variable!(
|
||||||
|
atom!("scrollbar-inline-size"),
|
||||||
|
get_scrollbar_inline_size
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
impl CssEnvironment {
|
impl CssEnvironment {
|
||||||
|
|
|
@ -199,6 +199,18 @@ impl Device {
|
||||||
unsafe { bindings::Gecko_GetBaseSize(self.document(), language.as_ptr(), generic) }
|
unsafe { bindings::Gecko_GetBaseSize(self.document(), language.as_ptr(), generic) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the size of the scrollbar in CSS pixels.
|
||||||
|
pub fn scrollbar_inline_size(&self) -> Length {
|
||||||
|
let pc = match self.pres_context() {
|
||||||
|
Some(pc) => pc,
|
||||||
|
// XXX: we could have a more reasonable default perhaps.
|
||||||
|
None => return Length::new(0.0),
|
||||||
|
};
|
||||||
|
Length::new(unsafe {
|
||||||
|
bindings::Gecko_GetScrollbarInlineSize(pc)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Queries font metrics
|
/// Queries font metrics
|
||||||
pub fn query_font_metrics(
|
pub fn query_font_metrics(
|
||||||
&self,
|
&self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue