style: Implement the env() function with hardcoded zeros for safe-area-inset.

Intent to Implement and Ship: https://groups.google.com/d/msg/mozilla.dev.platform/EVKyR1B87T0/_l-_qK8SAAAJ

Differential Revision: https://phabricator.services.mozilla.com/D9609
This commit is contained in:
Emilio Cobos Álvarez 2018-11-05 10:39:46 +00:00
parent 5af6abfb78
commit b7da1bac88
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
11 changed files with 346 additions and 136 deletions

View file

@ -7,6 +7,7 @@
use app_units::AU_PER_PX;
use app_units::Au;
use cssparser::RGBA;
use custom_properties::CssEnvironment;
use euclid::Size2D;
use euclid::TypedScale;
use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
@ -52,6 +53,9 @@ pub struct Device {
/// Whether any styles computed in the document relied on the viewport size
/// by using vw/vh/vmin/vmax units.
used_viewport_size: AtomicBool,
/// The CssEnvironment object responsible of getting CSS environment
/// variables.
environment: CssEnvironment,
}
impl fmt::Debug for Device {
@ -87,9 +91,16 @@ impl Device {
body_text_color: AtomicUsize::new(unsafe { &*pres_context }.mDefaultColor as usize),
used_root_font_size: AtomicBool::new(false),
used_viewport_size: AtomicBool::new(false),
environment: CssEnvironment,
}
}
/// Get the relevant environment to resolve `env()` functions.
#[inline]
pub fn environment(&self) -> &CssEnvironment {
&self.environment
}
/// Tells the device that a new viewport rule has been found, and stores the
/// relevant viewport constraints.
pub fn account_for_viewport_rule(&mut self, _constraints: &ViewportConstraints) {