1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use crate::css_rules::{CssRuleList, Location};
use crate::{PrintErr, Printer};
/// A [@-moz-document](https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document) rule.
///
/// Note that only the `url-prefix()` function with no arguments is supported, and only the `-moz` prefix
/// is allowed since Firefox was the only browser that ever implemented this rule.
pub struct MozDocumentRule<R> {
/// Nested rules within the `@-moz-document` rule.
pub rules: CssRuleList<R>,
/// The location of the rule in the source file.
pub loc: Location,
}
impl<R> MozDocumentRule<R> {
pub(crate) fn to_css(&self, dest: &mut Printer) -> Result<(), PrintErr> {
// #[cfg(feature = "sourcemap")]
// dest.add_mapping(self.loc);
dest.write_str("@-moz-document url-prefix()")?;
dest.block(|d| {
d.newline()?;
self.rules.to_css(d)
})
}
}
impl<R> MozDocumentRule<R> {
pub(crate) fn deep_clone<'bump>(&self, bump: &'bump bun_alloc::Arena) -> Self
where
R: crate::generics::DeepClone<'bump>,
{
// PORT NOTE: `css.implementDeepClone` field-walk.
Self {
rules: self.rules.deep_clone(bump),
loc: self.loc,
}
}
}
// ported from: src/css/rules/document.zig