mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #16800 - Manishearth:border-radius, r=emilio
Allow border radii to be set via preshints Fixes rendering of `<hr>` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16800) <!-- Reviewable:end -->
This commit is contained in:
commit
6de4c93aaf
2 changed files with 15 additions and 10 deletions
|
@ -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.
|
||||
|
|
|
@ -1446,18 +1446,14 @@ pub extern "C" fn Servo_MediaList_DeleteMedium(list: RawServoMediaListBorrowed,
|
|||
}
|
||||
|
||||
macro_rules! get_longhand_from_id {
|
||||
($id:expr, $retval:expr) => {
|
||||
($id:expr) => {
|
||||
match PropertyId::from_nscsspropertyid($id) {
|
||||
Ok(PropertyId::Longhand(long)) => long,
|
||||
_ => {
|
||||
error!("stylo: unknown presentation property with id {:?}", $id);
|
||||
return $retval
|
||||
panic!("stylo: unknown presentation property with id {:?}", $id);
|
||||
}
|
||||
}
|
||||
};
|
||||
($id:expr) => {
|
||||
get_longhand_from_id!($id, ())
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! match_wrap_declared {
|
||||
|
@ -1467,8 +1463,7 @@ macro_rules! match_wrap_declared {
|
|||
LonghandId::$property => PropertyDeclaration::$property($inner),
|
||||
)*
|
||||
_ => {
|
||||
error!("stylo: Don't know how to handle presentation property {:?}", $longhand);
|
||||
return
|
||||
panic!("stylo: Don't know how to handle presentation property {:?}", $longhand);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -1480,7 +1475,7 @@ pub extern "C" fn Servo_DeclarationBlock_PropertyIsSet(declarations:
|
|||
property: nsCSSPropertyID)
|
||||
-> bool {
|
||||
use style::properties::PropertyDeclarationId;
|
||||
let long = get_longhand_from_id!(property, false);
|
||||
let long = get_longhand_from_id!(property);
|
||||
read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
|
||||
decls.get(PropertyDeclarationId::Longhand(long)).is_some()
|
||||
})
|
||||
|
@ -1575,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);
|
||||
|
@ -1601,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue