mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Implement -moz-prefixed linear gradients
This commit is contained in:
parent
a9fea0653a
commit
3e42684d3c
7 changed files with 207 additions and 34 deletions
|
@ -50,12 +50,14 @@ pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color>
|
|||
|
||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// Whether we used the modern notation or the compatibility `-webkit` prefix.
|
||||
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
|
||||
pub enum CompatMode {
|
||||
/// Modern syntax.
|
||||
Modern,
|
||||
/// `-webkit` prefix.
|
||||
WebKit,
|
||||
/// `-moz` prefix
|
||||
Moz,
|
||||
}
|
||||
|
||||
/// A gradient kind.
|
||||
|
@ -216,9 +218,12 @@ impl<D, L, LoP, P, C> ToCss for Gradient<D, L, LoP, P, C>
|
|||
where D: LineDirection, L: ToCss, LoP: ToCss, P: ToCss, C: ToCss,
|
||||
{
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
if self.compat_mode == CompatMode::WebKit {
|
||||
dest.write_str("-webkit-")?;
|
||||
match self.compat_mode {
|
||||
CompatMode::WebKit => dest.write_str("-webkit-")?,
|
||||
CompatMode::Moz => dest.write_str("-moz-")?,
|
||||
_ => {},
|
||||
}
|
||||
|
||||
if self.repeating {
|
||||
dest.write_str("repeating-")?;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue