mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
style: Fix tidy issues and Servo build.
This commit is contained in:
parent
64cceb328a
commit
292f899631
15 changed files with 32 additions and 56 deletions
|
@ -487,42 +487,6 @@ mod shorthand_serialization {
|
|||
}
|
||||
}
|
||||
|
||||
mod outline {
|
||||
use style::values::specified::outline::OutlineStyle;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn outline_should_show_all_properties_when_set() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let width = BorderSideWidth::Length(Length::from_px(4f32));
|
||||
let style = OutlineStyle::Other(BorderStyle::Solid);
|
||||
let color = RGBA::new(255, 0, 0, 255).into();
|
||||
|
||||
properties.push(PropertyDeclaration::OutlineWidth(width));
|
||||
properties.push(PropertyDeclaration::OutlineStyle(style));
|
||||
properties.push(PropertyDeclaration::OutlineColor(color));
|
||||
|
||||
let serialization = shorthand_properties_to_string(properties);
|
||||
assert_eq!(serialization, "outline: 4px solid rgb(255, 0, 0);");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outline_should_serialize_correctly_when_style_is_auto() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let width = BorderSideWidth::Length(Length::from_px(4f32));
|
||||
let style = OutlineStyle::Auto;
|
||||
let color = RGBA::new(255, 0, 0, 255).into();
|
||||
properties.push(PropertyDeclaration::OutlineWidth(width));
|
||||
properties.push(PropertyDeclaration::OutlineStyle(style));
|
||||
properties.push(PropertyDeclaration::OutlineColor(color));
|
||||
|
||||
let serialization = shorthand_properties_to_string(properties);
|
||||
assert_eq!(serialization, "outline: 4px auto rgb(255, 0, 0);");
|
||||
}
|
||||
}
|
||||
|
||||
mod background {
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -62,11 +62,12 @@ fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> {
|
|||
let rules = s.contents.rules.read_with(&guard);
|
||||
rules.0.iter().filter_map(|rule| {
|
||||
match *rule {
|
||||
CssRule::Style(ref style_rule) => Some(style_rule),
|
||||
CssRule::Style(ref style_rule) => Some((
|
||||
StyleSource::from_rule(style_rule.clone()),
|
||||
CascadeLevel::UserNormal,
|
||||
)),
|
||||
_ => None,
|
||||
}
|
||||
}).cloned().map(StyleSource::Style).map(|s| {
|
||||
(s, CascadeLevel::UserNormal)
|
||||
}).collect()
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,7 @@ fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, C
|
|||
shared_lock: &SharedRwLock)
|
||||
-> StrongRuleNode {
|
||||
let mut rules = rules.to_vec();
|
||||
rules.push((StyleSource::Declarations(Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
|
||||
rules.push((StyleSource::from_declarations(Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::Display(
|
||||
longhands::display::SpecifiedValue::Block),
|
||||
Importance::Normal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue