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

@ -21,7 +21,11 @@ use model::{AdjoiningMargins, CollapsibleMargins};
use model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
use std::cmp::{max, min};
use std::ops::Range;
use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content};
use style::computed_values::align_content::T as AlignContent;
use style::computed_values::align_self::T as AlignSelf;
use style::computed_values::flex_direction::T as FlexDirection;
use style::computed_values::flex_wrap::T as FlexWrap;
use style::computed_values::justify_content::T as JustifyContent;
use style::logical_geometry::{Direction, LogicalSize};
use style::properties::ComputedValues;
use style::servo::restyle_damage::ServoRestyleDamage;
@ -366,18 +370,18 @@ impl FlexFlow {
{
let style = fragment.style();
let (mode, reverse) = match style.get_position().flex_direction {
flex_direction::T::row => (Direction::Inline, false),
flex_direction::T::row_reverse => (Direction::Inline, true),
flex_direction::T::column => (Direction::Block, false),
flex_direction::T::column_reverse => (Direction::Block, true),
FlexDirection::Row => (Direction::Inline, false),
FlexDirection::RowReverse => (Direction::Inline, true),
FlexDirection::Column => (Direction::Block, false),
FlexDirection::ColumnReverse => (Direction::Block, true),
};
main_mode = mode;
main_reverse =
reverse == style.writing_mode.is_bidi_ltr();
let (wrappable, reverse) = match fragment.style.get_position().flex_wrap {
flex_wrap::T::nowrap => (false, false),
flex_wrap::T::wrap => (true, false),
flex_wrap::T::wrap_reverse => (true, true),
FlexWrap::Nowrap => (false, false),
FlexWrap::Wrap => (true, false),
FlexWrap::WrapReverse => (true, true),
};
is_wrappable = wrappable;
// TODO(stshine): Handle vertical writing mode.
@ -582,14 +586,14 @@ impl FlexFlow {
let mut cur_i = inline_start_content_edge;
let item_interval = if line.free_space >= Au(0) && line.auto_margin_count == 0 {
match self.block_flow.fragment.style().get_position().justify_content {
justify_content::T::space_between => {
JustifyContent::SpaceBetween => {
if item_count == 1 {
Au(0)
} else {
line.free_space / (item_count - 1)
}
}
justify_content::T::space_around => {
JustifyContent::SpaceAround => {
line.free_space / item_count
}
_ => Au(0),
@ -600,10 +604,10 @@ impl FlexFlow {
match self.block_flow.fragment.style().get_position().justify_content {
// Overflow equally in both ends of line.
justify_content::T::center | justify_content::T::space_around => {
JustifyContent::Center | JustifyContent::SpaceAround => {
cur_i += (line.free_space - item_interval * (item_count - 1)) / 2;
}
justify_content::T::flex_end => {
JustifyContent::FlexEnd => {
cur_i += line.free_space;
}
_ => {}
@ -709,21 +713,21 @@ impl FlexFlow {
let free_space = container_block_size - total_cross_size;
total_cross_size = container_block_size;
if line_align == align_content::T::stretch && free_space > Au(0) {
if line_align == AlignContent::Stretch && free_space > Au(0) {
for line in self.lines.iter_mut() {
line.cross_size += free_space / line_count;
}
}
line_interval = match line_align {
align_content::T::space_between => {
AlignContent::SpaceBetween => {
if line_count <= 1 {
Au(0)
} else {
free_space / (line_count - 1)
}
}
align_content::T::space_around => {
AlignContent::SpaceAround => {
if line_count == 0 {
Au(0)
} else {
@ -734,10 +738,10 @@ impl FlexFlow {
};
match line_align {
align_content::T::center | align_content::T::space_around => {
AlignContent::Center | AlignContent::SpaceAround => {
cur_b += (free_space - line_interval * (line_count - 1)) / 2;
}
align_content::T::flex_end => {
AlignContent::FlexEnd => {
cur_b += free_space;
}
_ => {}
@ -772,7 +776,7 @@ impl FlexFlow {
}
let self_align = block.fragment.style().get_position().align_self;
if self_align == align_self::T::stretch &&
if self_align == AlignSelf::Stretch &&
block.fragment.style().content_block_size() == LengthOrPercentageOrAuto::Auto {
free_space = Au(0);
block.base.block_container_explicit_block_size = Some(line.cross_size);
@ -793,8 +797,8 @@ impl FlexFlow {
// TODO(stshine): support baseline alignment.
if free_space != Au(0) {
let flex_cross = match self_align {
align_self::T::flex_end => free_space,
align_self::T::center => free_space / 2,
AlignSelf::FlexEnd => free_space,
AlignSelf::Center => free_space / 2,
_ => Au(0),
};
block.base.position.start.b +=