mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
style: Use consistent naming and shared code for out-of-flow stuff.
Use the functions introduced in ee17eedf3a
.
This commit is contained in:
parent
0b5aaeff5d
commit
6b674a670b
3 changed files with 12 additions and 17 deletions
|
@ -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>
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue