mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
stylo: Support pixel and percent presentation attributes
This commit is contained in:
parent
31945c287f
commit
5cc0fa5ec2
3 changed files with 129 additions and 8 deletions
|
@ -368,6 +368,13 @@ pub enum Length {
|
|||
Calc(Box<CalcLengthOrPercentage>, AllowedNumericType),
|
||||
}
|
||||
|
||||
impl From<NoCalcLength> for Length {
|
||||
#[inline]
|
||||
fn from(len: NoCalcLength) -> Self {
|
||||
Length::NoCalc(len)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasViewportPercentage for Length {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
match *self {
|
||||
|
@ -938,6 +945,20 @@ impl From<Length> for LengthOrPercentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<NoCalcLength> for LengthOrPercentage {
|
||||
#[inline]
|
||||
fn from(len: NoCalcLength) -> Self {
|
||||
LengthOrPercentage::Length(len)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Percentage> for LengthOrPercentage {
|
||||
#[inline]
|
||||
fn from(pc: Percentage) -> Self {
|
||||
LengthOrPercentage::Percentage(pc)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasViewportPercentage for LengthOrPercentage {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
match *self {
|
||||
|
@ -1043,6 +1064,21 @@ pub enum LengthOrPercentageOrAuto {
|
|||
Calc(Box<CalcLengthOrPercentage>),
|
||||
}
|
||||
|
||||
|
||||
impl From<NoCalcLength> for LengthOrPercentageOrAuto {
|
||||
#[inline]
|
||||
fn from(len: NoCalcLength) -> Self {
|
||||
LengthOrPercentageOrAuto::Length(len)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Percentage> for LengthOrPercentageOrAuto {
|
||||
#[inline]
|
||||
fn from(pc: Percentage) -> Self {
|
||||
LengthOrPercentageOrAuto::Percentage(pc)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasViewportPercentage for LengthOrPercentageOrAuto {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue