mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Auto merge of #16104 - Wafflespeanut:box-shadow-serialization, r=Wafflespeanut
Properly serialize <box-shadow> Rebase of #15703, fixes #15203 <!-- 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/16104) <!-- Reviewable:end -->
This commit is contained in:
commit
f00f3fa81c
2 changed files with 23 additions and 4 deletions
|
@ -29,13 +29,13 @@ ${helpers.predefined_type("opacity",
|
|||
if self.inset {
|
||||
try!(dest.write_str("inset "));
|
||||
}
|
||||
try!(self.blur_radius.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
try!(self.spread_radius.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
try!(self.offset_x.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
try!(self.offset_y.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
try!(self.blur_radius.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
try!(self.spread_radius.to_css(dest));
|
||||
|
||||
if let Some(ref color) = self.color {
|
||||
try!(dest.write_str(" "));
|
||||
|
|
|
@ -1151,4 +1151,23 @@ mod shorthand_serialization {
|
|||
assert_eq!(serialization, block_text);
|
||||
}
|
||||
}
|
||||
|
||||
mod effects {
|
||||
pub use super::*;
|
||||
pub use style::properties::longhands::box_shadow::SpecifiedValue as BoxShadow;
|
||||
pub use style::values::specified::Shadow;
|
||||
|
||||
#[test]
|
||||
fn box_shadow_should_serialize_correctly() {
|
||||
let mut properties = Vec::new();
|
||||
let shadow_val = Shadow { offset_x: Length::from_px(1f32), offset_y: Length::from_px(2f32),
|
||||
blur_radius: Length::from_px(3f32), spread_radius: Length::from_px(4f32), color: None, inset: false };
|
||||
let shadow_decl = BoxShadow(vec![shadow_val]);
|
||||
properties.push(PropertyDeclaration:: BoxShadow(shadow_decl));
|
||||
let shadow_css = "box-shadow: 1px 2px 3px 4px;";
|
||||
let shadow = parse_declaration_block(shadow_css);
|
||||
|
||||
assert_eq!(shadow.to_css_string(), shadow_css);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue