mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Add intrinsic size computation for inline formatting contexts
This commit is contained in:
parent
8fe37f3ed6
commit
9c5a595044
6 changed files with 188 additions and 46 deletions
|
@ -170,6 +170,12 @@ impl LengthPercentage {
|
|||
self.length
|
||||
}
|
||||
|
||||
/// Returns the percentage component of this `calc()`
|
||||
#[inline]
|
||||
pub fn percentage_component(&self) -> Percentage {
|
||||
Percentage(self.clamping_mode.clamp(self.percentage.0))
|
||||
}
|
||||
|
||||
/// Return the percentage value as CSSFloat.
|
||||
#[inline]
|
||||
pub fn percentage(&self) -> CSSFloat {
|
||||
|
|
|
@ -64,6 +64,12 @@ impl Zero for Percentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign for Percentage {
|
||||
fn add_assign(&mut self, other: Self) {
|
||||
self.0 += other.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Percentage {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue