mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Align border-spacing with other engines.
This commit is contained in:
parent
8205a0de90
commit
35496c8ae1
2 changed files with 21 additions and 14 deletions
|
@ -496,8 +496,8 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
shared_lock,
|
||||
PropertyDeclaration::BorderSpacing(
|
||||
Box::new(border_spacing::SpecifiedValue {
|
||||
horizontal: width_value.clone(),
|
||||
vertical: width_value,
|
||||
horizontal: width_value,
|
||||
vertical: None,
|
||||
}))));
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
return self.horizontal.has_viewport_percentage() || self.vertical.has_viewport_percentage()
|
||||
self.horizontal.has_viewport_percentage() ||
|
||||
self.vertical.as_ref().map_or(false, |v| v.has_viewport_percentage())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct SpecifiedValue {
|
||||
pub horizontal: specified::Length,
|
||||
pub vertical: specified::Length,
|
||||
pub vertical: Option<specified::Length>,
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -72,10 +73,15 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
}
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write,
|
||||
{
|
||||
try!(self.horizontal.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
self.vertical.to_css(dest)
|
||||
if let Some(vertical) = self.vertical.as_ref() {
|
||||
try!(dest.write_str(" "));
|
||||
vertical.to_css(dest)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,9 +98,10 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> computed_value::T {
|
||||
let horizontal = self.horizontal.to_computed_value(context);
|
||||
computed_value::T {
|
||||
horizontal: self.horizontal.to_computed_value(context),
|
||||
vertical: self.vertical.to_computed_value(context),
|
||||
horizontal: horizontal,
|
||||
vertical: self.vertical.as_ref().map_or(horizontal, |v| v.to_computed_value(context)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +109,7 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
fn from_computed_value(computed: &computed_value::T) -> Self {
|
||||
SpecifiedValue {
|
||||
horizontal: ToComputedValue::from_computed_value(&computed.horizontal),
|
||||
vertical: ToComputedValue::from_computed_value(&computed.vertical),
|
||||
vertical: Some(ToComputedValue::from_computed_value(&computed.vertical)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,17 +130,17 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
(None, None) => Err(()),
|
||||
(Some(length), None) => {
|
||||
Ok(SpecifiedValue {
|
||||
horizontal: length.clone(),
|
||||
vertical: length,
|
||||
horizontal: length,
|
||||
vertical: None,
|
||||
})
|
||||
}
|
||||
(Some(horizontal), Some(vertical)) => {
|
||||
Ok(SpecifiedValue {
|
||||
horizontal: horizontal,
|
||||
vertical: vertical,
|
||||
vertical: Some(vertical),
|
||||
})
|
||||
}
|
||||
(None, Some(_)) => panic!("shouldn't happen"),
|
||||
(None, Some(_)) => unreachable!(),
|
||||
}
|
||||
}
|
||||
</%helpers:longhand>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue