style: Make all keywords CamelCase for consistency.

This prevents confusion and paves the ground for derive(Parse) of them.
This commit is contained in:
Emilio Cobos Álvarez 2017-12-05 22:13:50 +01:00
parent 37cd870a9e
commit af879523ea
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
60 changed files with 921 additions and 836 deletions

View file

@ -11,7 +11,7 @@ use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric};
use msg::constellation_msg::TEST_PIPELINE_ID;
use net_traits::image::base::PixelFormat;
use profile_traits::time::{ProfilerChan, TimerMetadata};
use style::computed_values::image_rendering;
use style::computed_values::image_rendering::T as ImageRendering;
use time;
struct DummyProfilerMetadataFactory {}
@ -127,7 +127,7 @@ fn test_first_contentful_paint_setter() {
image_data: None,
stretch_size: Size2D::zero(),
tile_spacing: Size2D::zero(),
image_rendering: image_rendering::T::auto,
image_rendering: ImageRendering::Auto,
}));
let display_list = DisplayList {
list: vec![image],

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use properties::{parse, parse_input};
use style::computed_values::display::T::inline_block;
use style::computed_values::display::T as Display;
use style::properties::{PropertyDeclaration, Importance};
use style::properties::parse_property_declaration_list;
use style::values::{CustomIdent, RGBA, Auto};
@ -32,16 +32,15 @@ fn property_declaration_block_should_serialize_correctly() {
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
Importance::Important),
(PropertyDeclaration::Display(
inline_block),
(PropertyDeclaration::Display(Display::InlineBlock),
Importance::Normal),
(PropertyDeclaration::OverflowX(
OverflowValue::auto),
OverflowValue::Auto),
Importance::Normal),
(PropertyDeclaration::OverflowY(
OverflowValue::auto),
OverflowValue::Auto),
Importance::Normal),
];
@ -74,7 +73,7 @@ mod shorthand_serialization {
fn equal_overflow_properties_should_serialize_to_single_value() {
let mut properties = Vec::new();
let overflow = OverflowValue::auto;
let overflow = OverflowValue::Auto;
properties.push(PropertyDeclaration::OverflowX(overflow));
properties.push(PropertyDeclaration::OverflowY(overflow));
@ -86,10 +85,10 @@ mod shorthand_serialization {
fn different_overflow_properties_should_serialize_to_two_values() {
let mut properties = Vec::new();
let overflow_x = OverflowValue::scroll;
let overflow_x = OverflowValue::Scroll;
properties.push(PropertyDeclaration::OverflowX(overflow_x));
let overflow_y = OverflowValue::auto;
let overflow_y = OverflowValue::Auto;
properties.push(PropertyDeclaration::OverflowY(overflow_y));
let serialization = shorthand_properties_to_string(properties);
@ -171,7 +170,7 @@ mod shorthand_serialization {
fn different_longhands_should_serialize_to_long_form() {
let mut properties = Vec::new();
let solid = BorderStyle::solid;
let solid = BorderStyle::Solid;
properties.push(PropertyDeclaration::BorderTopStyle(solid.clone()));
properties.push(PropertyDeclaration::BorderRightStyle(solid.clone()));
@ -202,7 +201,7 @@ mod shorthand_serialization {
fn same_longhands_should_serialize_correctly() {
let mut properties = Vec::new();
let solid = BorderStyle::solid;
let solid = BorderStyle::Solid;
properties.push(PropertyDeclaration::BorderTopStyle(solid.clone()));
properties.push(PropertyDeclaration::BorderRightStyle(solid.clone()));
@ -303,8 +302,8 @@ mod shorthand_serialization {
fn border_style_should_serialize_correctly() {
let mut properties = Vec::new();
let solid = BorderStyle::solid;
let dotted = BorderStyle::dotted;
let solid = BorderStyle::Solid;
let dotted = BorderStyle::Dotted;
properties.push(PropertyDeclaration::BorderTopStyle(solid.clone()));
properties.push(PropertyDeclaration::BorderRightStyle(dotted.clone()));
properties.push(PropertyDeclaration::BorderBottomStyle(solid));
@ -345,7 +344,7 @@ mod shorthand_serialization {
fn border_top_and_color() {
let mut properties = Vec::new();
properties.push(PropertyDeclaration::BorderTopWidth(BorderSideWidth::Length(Length::from_px(1.))));
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::solid));
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::Solid));
let c = Color::Numeric {
parsed: RGBA::new(255, 0, 0, 255),
authored: Some("green".to_string().into_boxed_str())
@ -377,7 +376,7 @@ mod shorthand_serialization {
properties.push(PropertyDeclaration::BorderRightColor(c.clone()));
properties.push(PropertyDeclaration::BorderTopWidth(BorderSideWidth::Length(Length::from_px(1.))));
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::solid));
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::Solid));
let c = Color::Numeric {
parsed: RGBA::new(255, 0, 0, 255),
authored: Some("green".to_string().into_boxed_str())
@ -396,7 +395,7 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = BorderStyle::solid;
let style = BorderStyle::Solid;
let color = RGBA::new(255, 0, 0, 255).into();
properties.push(PropertyDeclaration::BorderTopWidth(width));
@ -409,7 +408,7 @@ mod shorthand_serialization {
fn get_border_property_values() -> (BorderSideWidth, BorderStyle, Color) {
(BorderSideWidth::Length(Length::from_px(4f32)),
BorderStyle::solid,
BorderStyle::Solid,
Color::currentcolor())
}
@ -492,10 +491,10 @@ mod shorthand_serialization {
fn list_style_should_show_all_properties_when_values_are_set() {
let mut properties = Vec::new();
let position = ListStylePosition::inside;
let position = ListStylePosition::Inside;
let image =
ListStyleImage(Either::First(SpecifiedUrl::new_for_testing("http://servo/test.png")));
let style_type = ListStyleType::disc;
let style_type = ListStyleType::Disc;
properties.push(PropertyDeclaration::ListStylePosition(position));
@ -520,7 +519,7 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = Either::Second(BorderStyle::solid);
let style = Either::Second(BorderStyle::Solid);
let color = RGBA::new(255, 0, 0, 255).into();
properties.push(PropertyDeclaration::OutlineWidth(width));
@ -589,8 +588,8 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let direction = FlexDirection::row;
let wrap = FlexWrap::wrap;
let direction = FlexDirection::Row;
let wrap = FlexWrap::Wrap;
properties.push(PropertyDeclaration::FlexDirection(direction));
properties.push(PropertyDeclaration::FlexWrap(wrap));

View file

@ -80,7 +80,7 @@ fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, C
let mut rules = rules.to_vec();
rules.push((StyleSource::Declarations(Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
PropertyDeclaration::Display(
longhands::display::SpecifiedValue::block),
longhands::display::SpecifiedValue::Block),
Importance::Normal
)))), CascadeLevel::UserNormal));
test_insertion(rule_tree, rules)

View file

@ -108,7 +108,7 @@ fn test_parse_stylesheet() {
), (0 << 20) + (1 << 10) + (1 << 0))
)),
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::none),
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::None),
Importance::Important),
(PropertyDeclaration::Custom(Atom::from("a"),
DeclaredValueOwned::CSSWideKeyword(CSSWideKeyword::Inherit)),
@ -138,7 +138,7 @@ fn test_parse_stylesheet() {
),
)),
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::block),
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::Block),
Importance::Normal),
]))),
source_location: SourceLocation {

View file

@ -31,7 +31,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
selectors: selectors,
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
PropertyDeclaration::Display(
longhands::display::SpecifiedValue::block),
longhands::display::SpecifiedValue::Block),
Importance::Normal
))),
source_location: SourceLocation {