Skip to content

Commit

Permalink
Allow border radii to be set via preshints
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed May 10, 2017
1 parent d5efed6 commit 195e379
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/style/values/generics/mod.rs
Expand Up @@ -26,6 +26,12 @@ impl<L> HasViewportPercentage for BorderRadiusSize<L> {
fn has_viewport_percentage(&self) -> bool { false }
}

impl<L: Clone> From<L> for BorderRadiusSize<L> {
fn from(other: L) -> Self {
Self::new(other.clone(), other)
}
}

impl<L> BorderRadiusSize<L> {
#[inline]
/// Create a new `BorderRadiusSize` for an area of given width and height.
Expand Down
6 changes: 5 additions & 1 deletion ports/geckolib/glue.rs
Expand Up @@ -1570,7 +1570,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations:
use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing;
use style::values::specified::BorderWidth;
use style::values::specified::length::NoCalcLength;
use style::values::specified::length::{NoCalcLength, LengthOrPercentage};

let long = get_longhand_from_id!(property);
let nocalc = NoCalcLength::from_px(value);
Expand All @@ -1596,6 +1596,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations:
vertical: None,
}
),
BorderTopLeftRadius => Box::new(LengthOrPercentage::from(nocalc).into()),
BorderTopRightRadius => Box::new(LengthOrPercentage::from(nocalc).into()),
BorderBottomLeftRadius => Box::new(LengthOrPercentage::from(nocalc).into()),
BorderBottomRightRadius => Box::new(LengthOrPercentage::from(nocalc).into()),
};
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
decls.push(prop, Importance::Normal);
Expand Down

0 comments on commit 195e379

Please sign in to comment.