style: Use consistent naming and shared code for out-of-flow stuff.

Use the functions introduced in ee17eedf3a.
This commit is contained in:
Emilio Cobos Álvarez 2019-10-07 15:45:43 +02:00
parent 0b5aaeff5d
commit 6b674a670b
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
3 changed files with 12 additions and 17 deletions

View file

@ -53,10 +53,7 @@ ${helpers.single_keyword(
>
impl computed_value::T {
pub fn is_absolutely_positioned(self) -> bool {
match self {
Self::Absolute | Self::Fixed => true,
_ => false,
}
matches!(self, Self::Absolute | Self::Fixed)
}
}
</%helpers:single_keyword>

View file

@ -3694,16 +3694,14 @@ impl<'a> StyleBuilder<'a> {
<% del style_struct %>
/// Returns whether this computed style represents a floated object.
pub fn floated(&self) -> bool {
self.get_box().clone_float() != longhands::float::computed_value::T::None
pub fn is_floating(&self) -> bool {
self.get_box().clone_float().is_floating()
}
/// Returns whether this computed style represents an out of flow-positioned
/// Returns whether this computed style represents an absolutely-positioned
/// object.
pub fn out_of_flow_positioned(&self) -> bool {
use crate::properties::longhands::position::computed_value::T as Position;
matches!(self.get_box().clone_position(),
Position::Absolute | Position::Fixed)
pub fn is_absolutely_positioned(&self) -> bool {
self.get_box().clone_position().is_absolutely_positioned()
}
/// Whether this style has a top-layer style.