зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #16104 - Properly serialize <box-shadow> (from Wafflespeanut:box-shadow-serialization); r=Wafflespeanut
Rebase of #15703, fixes #15203 Source-Repo: https://github.com/servo/servo Source-Revision: f00f3fa81c504c12d37c93f9415c54df33a77cb9 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 7a9cd699d4406cbe1e52c1cd7008bb8fa035904d
This commit is contained in:
Родитель
0eb1f2ca26
Коммит
6493890631
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче