aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/values/specified/align.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-19 10:35:08 -0500
committerGitHub <noreply@github.com>2017-10-19 10:35:08 -0500
commitfe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b (patch)
tree84fe331eb4af20575050134b234b6c99a252726d /components/style/values/specified/align.rs
parent07e9794306d597afe5d90d192fd32a99572c3cc3 (diff)
parente8e2d0a4b24475b018dbc7e59ea46fdceaf20815 (diff)
downloadservo-fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b.tar.gz
servo-fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b.zip
Auto merge of #18809 - Eijebong:bitflags, r=nox
Update bitflags to 1.0 in every servo crate It still needs dependencies update to remove all the other bitflags versions. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because it's a dependency update <!-- 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/18809) <!-- Reviewable:end -->
Diffstat (limited to 'components/style/values/specified/align.rs')
-rw-r--r--components/style/values/specified/align.rs182
1 files changed, 91 insertions, 91 deletions
diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs
index 54fece9d340..66ba2116a62 100644
--- a/components/style/values/specified/align.rs
+++ b/components/style/values/specified/align.rs
@@ -20,84 +20,84 @@ bitflags! {
/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[derive(ToComputedValue)]
- pub flags AlignFlags: u8 {
+ pub struct AlignFlags: u8 {
// Enumeration stored in the lower 5 bits:
/// 'auto'
- const ALIGN_AUTO = structs::NS_STYLE_ALIGN_AUTO as u8,
+ const AUTO = structs::NS_STYLE_ALIGN_AUTO as u8;
/// 'normal'
- const ALIGN_NORMAL = structs::NS_STYLE_ALIGN_NORMAL as u8,
+ const NORMAL = structs::NS_STYLE_ALIGN_NORMAL as u8;
/// 'start'
- const ALIGN_START = structs::NS_STYLE_ALIGN_START as u8,
+ const START = structs::NS_STYLE_ALIGN_START as u8;
/// 'end'
- const ALIGN_END = structs::NS_STYLE_ALIGN_END as u8,
+ const END = structs::NS_STYLE_ALIGN_END as u8;
/// 'flex-start'
- const ALIGN_FLEX_START = structs::NS_STYLE_ALIGN_FLEX_START as u8,
+ const FLEX_START = structs::NS_STYLE_ALIGN_FLEX_START as u8;
/// 'flex-end'
- const ALIGN_FLEX_END = structs::NS_STYLE_ALIGN_FLEX_END as u8,
+ const FLEX_END = structs::NS_STYLE_ALIGN_FLEX_END as u8;
/// 'center'
- const ALIGN_CENTER = structs::NS_STYLE_ALIGN_CENTER as u8,
+ const CENTER = structs::NS_STYLE_ALIGN_CENTER as u8;
/// 'left'
- const ALIGN_LEFT = structs::NS_STYLE_ALIGN_LEFT as u8,
+ const LEFT = structs::NS_STYLE_ALIGN_LEFT as u8;
/// 'right'
- const ALIGN_RIGHT = structs::NS_STYLE_ALIGN_RIGHT as u8,
+ const RIGHT = structs::NS_STYLE_ALIGN_RIGHT as u8;
/// 'baseline'
- const ALIGN_BASELINE = structs::NS_STYLE_ALIGN_BASELINE as u8,
+ const BASELINE = structs::NS_STYLE_ALIGN_BASELINE as u8;
/// 'last-baseline'
- const ALIGN_LAST_BASELINE = structs::NS_STYLE_ALIGN_LAST_BASELINE as u8,
+ const LAST_BASELINE = structs::NS_STYLE_ALIGN_LAST_BASELINE as u8;
/// 'stretch'
- const ALIGN_STRETCH = structs::NS_STYLE_ALIGN_STRETCH as u8,
+ const STRETCH = structs::NS_STYLE_ALIGN_STRETCH as u8;
/// 'self-start'
- const ALIGN_SELF_START = structs::NS_STYLE_ALIGN_SELF_START as u8,
+ const SELF_START = structs::NS_STYLE_ALIGN_SELF_START as u8;
/// 'self-end'
- const ALIGN_SELF_END = structs::NS_STYLE_ALIGN_SELF_END as u8,
+ const SELF_END = structs::NS_STYLE_ALIGN_SELF_END as u8;
/// 'space-between'
- const ALIGN_SPACE_BETWEEN = structs::NS_STYLE_ALIGN_SPACE_BETWEEN as u8,
+ const SPACE_BETWEEN = structs::NS_STYLE_ALIGN_SPACE_BETWEEN as u8;
/// 'space-around'
- const ALIGN_SPACE_AROUND = structs::NS_STYLE_ALIGN_SPACE_AROUND as u8,
+ const SPACE_AROUND = structs::NS_STYLE_ALIGN_SPACE_AROUND as u8;
/// 'space-evenly'
- const ALIGN_SPACE_EVENLY = structs::NS_STYLE_ALIGN_SPACE_EVENLY as u8,
+ const SPACE_EVENLY = structs::NS_STYLE_ALIGN_SPACE_EVENLY as u8;
// Additional flags stored in the upper bits:
/// 'legacy' (mutually exclusive w. SAFE & UNSAFE)
- const ALIGN_LEGACY = structs::NS_STYLE_ALIGN_LEGACY as u8,
+ const LEGACY = structs::NS_STYLE_ALIGN_LEGACY as u8;
/// 'safe'
- const ALIGN_SAFE = structs::NS_STYLE_ALIGN_SAFE as u8,
+ const SAFE = structs::NS_STYLE_ALIGN_SAFE as u8;
/// 'unsafe' (mutually exclusive w. SAFE)
- const ALIGN_UNSAFE = structs::NS_STYLE_ALIGN_UNSAFE as u8,
+ const UNSAFE = structs::NS_STYLE_ALIGN_UNSAFE as u8;
/// Mask for the additional flags above.
- const ALIGN_FLAG_BITS = structs::NS_STYLE_ALIGN_FLAG_BITS as u8,
+ const FLAG_BITS = structs::NS_STYLE_ALIGN_FLAG_BITS as u8;
}
}
impl ToCss for AlignFlags {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
- let s = match *self & !ALIGN_FLAG_BITS {
- ALIGN_AUTO => "auto",
- ALIGN_NORMAL => "normal",
- ALIGN_START => "start",
- ALIGN_END => "end",
- ALIGN_FLEX_START => "flex-start",
- ALIGN_FLEX_END => "flex-end",
- ALIGN_CENTER => "center",
- ALIGN_LEFT => "left",
- ALIGN_RIGHT => "right",
- ALIGN_BASELINE => "baseline",
- ALIGN_LAST_BASELINE => "last baseline",
- ALIGN_STRETCH => "stretch",
- ALIGN_SELF_START => "self-start",
- ALIGN_SELF_END => "self-end",
- ALIGN_SPACE_BETWEEN => "space-between",
- ALIGN_SPACE_AROUND => "space-around",
- ALIGN_SPACE_EVENLY => "space-evenly",
+ let s = match *self & !AlignFlags::FLAG_BITS {
+ AlignFlags::AUTO => "auto",
+ AlignFlags::NORMAL => "normal",
+ AlignFlags::START => "start",
+ AlignFlags::END => "end",
+ AlignFlags::FLEX_START => "flex-start",
+ AlignFlags::FLEX_END => "flex-end",
+ AlignFlags::CENTER => "center",
+ AlignFlags::LEFT => "left",
+ AlignFlags::RIGHT => "right",
+ AlignFlags::BASELINE => "baseline",
+ AlignFlags::LAST_BASELINE => "last baseline",
+ AlignFlags::STRETCH => "stretch",
+ AlignFlags::SELF_START => "self-start",
+ AlignFlags::SELF_END => "self-end",
+ AlignFlags::SPACE_BETWEEN => "space-between",
+ AlignFlags::SPACE_AROUND => "space-around",
+ AlignFlags::SPACE_EVENLY => "space-evenly",
_ => unreachable!()
};
dest.write_str(s)?;
- match *self & ALIGN_FLAG_BITS {
- ALIGN_LEGACY => { dest.write_str(" legacy")?; }
- ALIGN_SAFE => { dest.write_str(" safe")?; }
- ALIGN_UNSAFE => { dest.write_str(" unsafe")?; }
+ match *self & AlignFlags::FLAG_BITS {
+ AlignFlags::LEGACY => { dest.write_str(" legacy")?; }
+ AlignFlags::SAFE => { dest.write_str(" safe")?; }
+ AlignFlags::UNSAFE => { dest.write_str(" unsafe")?; }
_ => {}
}
Ok(())
@@ -123,7 +123,7 @@ impl AlignJustifyContent {
/// The initial value 'normal'
#[inline]
pub fn normal() -> Self {
- Self::new(ALIGN_NORMAL)
+ Self::new(AlignFlags::NORMAL)
}
/// Construct a value with no fallback.
@@ -157,7 +157,7 @@ impl AlignJustifyContent {
/// Whether this value has extra flags.
#[inline]
pub fn has_extra_flags(self) -> bool {
- self.primary().intersects(ALIGN_FLAG_BITS) || self.fallback().intersects(ALIGN_FLAG_BITS)
+ self.primary().intersects(AlignFlags::FLAG_BITS) || self.fallback().intersects(AlignFlags::FLAG_BITS)
}
}
@@ -165,7 +165,7 @@ impl ToCss for AlignJustifyContent {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.primary().to_css(dest)?;
match self.fallback() {
- ALIGN_AUTO => {}
+ AlignFlags::AUTO => {}
fallback => {
dest.write_str(" ")?;
fallback.to_css(dest)?;
@@ -215,13 +215,13 @@ impl AlignJustifySelf {
/// The initial value 'auto'
#[inline]
pub fn auto() -> Self {
- AlignJustifySelf(ALIGN_AUTO)
+ AlignJustifySelf(AlignFlags::AUTO)
}
/// Whether this value has extra flags.
#[inline]
pub fn has_extra_flags(self) -> bool {
- self.0.intersects(ALIGN_FLAG_BITS)
+ self.0.intersects(AlignFlags::FLAG_BITS)
}
}
@@ -253,13 +253,13 @@ impl AlignItems {
/// The initial value 'normal'
#[inline]
pub fn normal() -> Self {
- AlignItems(ALIGN_NORMAL)
+ AlignItems(AlignFlags::NORMAL)
}
/// Whether this value has extra flags.
#[inline]
pub fn has_extra_flags(self) -> bool {
- self.0.intersects(ALIGN_FLAG_BITS)
+ self.0.intersects(AlignFlags::FLAG_BITS)
}
}
@@ -291,19 +291,19 @@ impl JustifyItems {
/// The initial value 'auto'
#[inline]
pub fn auto() -> Self {
- JustifyItems(ALIGN_AUTO)
+ JustifyItems(AlignFlags::AUTO)
}
/// The value 'normal'
#[inline]
pub fn normal() -> Self {
- JustifyItems(ALIGN_NORMAL)
+ JustifyItems(AlignFlags::NORMAL)
}
/// Whether this value has extra flags.
#[inline]
pub fn has_extra_flags(self) -> bool {
- self.0.intersects(ALIGN_FLAG_BITS)
+ self.0.intersects(AlignFlags::FLAG_BITS)
}
}
@@ -351,9 +351,9 @@ fn parse_auto_normal_stretch_baseline<'i, 't>(input: &mut Parser<'i, 't>)
}
try_match_ident_ignore_ascii_case! { input,
- "auto" => Ok(ALIGN_AUTO),
- "normal" => Ok(ALIGN_NORMAL),
- "stretch" => Ok(ALIGN_STRETCH),
+ "auto" => Ok(AlignFlags::AUTO),
+ "normal" => Ok(AlignFlags::NORMAL),
+ "stretch" => Ok(AlignFlags::STRETCH),
}
}
@@ -364,8 +364,8 @@ fn parse_normal_stretch_baseline<'i, 't>(input: &mut Parser<'i, 't>) -> Result<A
}
try_match_ident_ignore_ascii_case! { input,
- "normal" => Ok(ALIGN_NORMAL),
- "stretch" => Ok(ALIGN_STRETCH),
+ "normal" => Ok(AlignFlags::NORMAL),
+ "stretch" => Ok(AlignFlags::STRETCH),
}
}
@@ -376,21 +376,21 @@ fn parse_normal_or_baseline<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignF
}
input.expect_ident_matching("normal")?;
- Ok(ALIGN_NORMAL)
+ Ok(AlignFlags::NORMAL)
}
// <baseline-position>
fn parse_baseline<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseError<'i>> {
// FIXME: remove clone() when lifetimes are non-lexical
try_match_ident_ignore_ascii_case! { input,
- "baseline" => Ok(ALIGN_BASELINE),
+ "baseline" => Ok(AlignFlags::BASELINE),
"first" => {
input.expect_ident_matching("baseline")?;
- Ok(ALIGN_BASELINE)
+ Ok(AlignFlags::BASELINE)
}
"last" => {
input.expect_ident_matching("baseline")?;
- Ok(ALIGN_LAST_BASELINE)
+ Ok(AlignFlags::LAST_BASELINE)
}
}
}
@@ -398,10 +398,10 @@ fn parse_baseline<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, Pars
// <content-distribution>
fn parse_content_distribution<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseError<'i>> {
try_match_ident_ignore_ascii_case! { input,
- "stretch" => Ok(ALIGN_STRETCH),
- "space-between" => Ok(ALIGN_SPACE_BETWEEN),
- "space-around" => Ok(ALIGN_SPACE_AROUND),
- "space-evenly" => Ok(ALIGN_SPACE_EVENLY),
+ "stretch" => Ok(AlignFlags::STRETCH),
+ "space-between" => Ok(AlignFlags::SPACE_BETWEEN),
+ "space-around" => Ok(AlignFlags::SPACE_AROUND),
+ "space-evenly" => Ok(AlignFlags::SPACE_EVENLY),
}
}
@@ -426,21 +426,21 @@ fn parse_overflow_content_position<'i, 't>(input: &mut Parser<'i, 't>) -> Result
// <content-position>
fn parse_content_position<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseError<'i>> {
try_match_ident_ignore_ascii_case! { input,
- "start" => Ok(ALIGN_START),
- "end" => Ok(ALIGN_END),
- "flex-start" => Ok(ALIGN_FLEX_START),
- "flex-end" => Ok(ALIGN_FLEX_END),
- "center" => Ok(ALIGN_CENTER),
- "left" => Ok(ALIGN_LEFT),
- "right" => Ok(ALIGN_RIGHT),
+ "start" => Ok(AlignFlags::START),
+ "end" => Ok(AlignFlags::END),
+ "flex-start" => Ok(AlignFlags::FLEX_START),
+ "flex-end" => Ok(AlignFlags::FLEX_END),
+ "center" => Ok(AlignFlags::CENTER),
+ "left" => Ok(AlignFlags::LEFT),
+ "right" => Ok(AlignFlags::RIGHT),
}
}
// <overflow-position>
fn parse_overflow_position<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseError<'i>> {
try_match_ident_ignore_ascii_case! { input,
- "safe" => Ok(ALIGN_SAFE),
- "unsafe" => Ok(ALIGN_UNSAFE),
+ "safe" => Ok(AlignFlags::SAFE),
+ "unsafe" => Ok(AlignFlags::UNSAFE),
}
}
@@ -465,15 +465,15 @@ fn parse_overflow_self_position<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Al
// <self-position>
fn parse_self_position<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseError<'i>> {
try_match_ident_ignore_ascii_case! { input,
- "start" => Ok(ALIGN_START),
- "end" => Ok(ALIGN_END),
- "flex-start" => Ok(ALIGN_FLEX_START),
- "flex-end" => Ok(ALIGN_FLEX_END),
- "center" => Ok(ALIGN_CENTER),
- "left" => Ok(ALIGN_LEFT),
- "right" => Ok(ALIGN_RIGHT),
- "self-start" => Ok(ALIGN_SELF_START),
- "self-end" => Ok(ALIGN_SELF_END),
+ "start" => Ok(AlignFlags::START),
+ "end" => Ok(AlignFlags::END),
+ "flex-start" => Ok(AlignFlags::FLEX_START),
+ "flex-end" => Ok(AlignFlags::FLEX_END),
+ "center" => Ok(AlignFlags::CENTER),
+ "left" => Ok(AlignFlags::LEFT),
+ "right" => Ok(AlignFlags::RIGHT),
+ "self-start" => Ok(AlignFlags::SELF_START),
+ "self-end" => Ok(AlignFlags::SELF_END),
}
}
@@ -485,16 +485,16 @@ fn parse_legacy<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseE
let b = input.expect_ident()?;
if a.eq_ignore_ascii_case("legacy") {
(match_ignore_ascii_case! { &b,
- "left" => Ok(ALIGN_LEGACY | ALIGN_LEFT),
- "right" => Ok(ALIGN_LEGACY | ALIGN_RIGHT),
- "center" => Ok(ALIGN_LEGACY | ALIGN_CENTER),
+ "left" => Ok(AlignFlags::LEGACY | AlignFlags::LEFT),
+ "right" => Ok(AlignFlags::LEGACY | AlignFlags::RIGHT),
+ "center" => Ok(AlignFlags::LEGACY | AlignFlags::CENTER),
_ => Err(())
}).map_err(|()| b_location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(b.clone())))
} else if b.eq_ignore_ascii_case("legacy") {
(match_ignore_ascii_case! { &a,
- "left" => Ok(ALIGN_LEGACY | ALIGN_LEFT),
- "right" => Ok(ALIGN_LEGACY | ALIGN_RIGHT),
- "center" => Ok(ALIGN_LEGACY | ALIGN_CENTER),
+ "left" => Ok(AlignFlags::LEGACY | AlignFlags::LEFT),
+ "right" => Ok(AlignFlags::LEGACY | AlignFlags::RIGHT),
+ "center" => Ok(AlignFlags::LEGACY | AlignFlags::CENTER),
_ => Err(())
}).map_err(|()| a_location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(a)))
} else {