mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Move Position into its own values module
This commit is contained in:
parent
88c1a67d89
commit
44e33bcdc5
8 changed files with 215 additions and 134 deletions
28
components/style/values/computed/position.rs
Normal file
28
components/style/values/computed/position.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! CSS handling for the computed value of
|
||||
//! [`position`][position]s
|
||||
//!
|
||||
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
||||
|
||||
use cssparser::{Parser, ToCss, Token};
|
||||
use values::computed::{Length, LengthOrPercentage};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Position {
|
||||
pub horizontal: LengthOrPercentage,
|
||||
pub vertical: LengthOrPercentage,
|
||||
}
|
||||
|
||||
impl ToCss for Position {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(self.horizontal.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
try!(self.vertical.to_css(dest));
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue