mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Derive HasViewportPercentage 🍷
This commit is contained in:
parent
d1e31f7aa4
commit
90bae7f802
27 changed files with 202 additions and 452 deletions
|
@ -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>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue