Derive HasViewportPercentage 🍷

This commit is contained in:
Anthony Ramine 2017-05-20 01:36:34 +02:00
parent d1e31f7aa4
commit 90bae7f802
27 changed files with 202 additions and 452 deletions

View file

@ -5,10 +5,9 @@
//! Generic types for CSS handling of specified and computed values of
//! [`position`](https://drafts.csswg.org/css-backgrounds-3/#position)
use values::HasViewportPercentage;
use values::computed::{Context, ToComputedValue};
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
pub struct Position<H, V> {
@ -28,13 +27,6 @@ impl<H, V> Position<H, V> {
}
}
impl<H: HasViewportPercentage, V: HasViewportPercentage> HasViewportPercentage for Position<H, V> {
#[inline]
fn has_viewport_percentage(&self) -> bool {
self.horizontal.has_viewport_percentage() || self.vertical.has_viewport_percentage()
}
}
impl<H: ToComputedValue, V: ToComputedValue> ToComputedValue for Position<H, V> {
type ComputedValue = Position<<H as ToComputedValue>::ComputedValue,
<V as ToComputedValue>::ComputedValue>;