style: Get safe area insets from Gecko.

Add binding to get safe area insets from Gecko.

Differential Revision: https://phabricator.services.mozilla.com/D52509
This commit is contained in:
Makoto Kato 2020-03-04 08:15:17 +00:00 committed by Emilio Cobos Álvarez
parent 45cc310f7f
commit c5b74bf001

View file

@ -310,6 +310,15 @@ impl Device {
/// Returns safe area insets
pub fn safe_area_insets(&self) -> SideOffsets2D<f32, CSSPixel> {
SideOffsets2D::zero()
let pc = match self.pres_context() {
Some(pc) => pc,
None => return SideOffsets2D::zero(),
};
let mut top = 0.0;
let mut right = 0.0;
let mut bottom = 0.0;
let mut left = 0.0;
unsafe { bindings::Gecko_GetSafeAreaInsets(pc, &mut top, &mut right, &mut bottom, &mut left) };
SideOffsets2D::new(top, right, bottom, left)
}
}