mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Move some CSS properties from Box to Position
This commit is contained in:
parent
281e385ab2
commit
aae8919da4
5 changed files with 31 additions and 27 deletions
|
@ -359,7 +359,7 @@ impl CandidateBSizeIterator {
|
||||||
};
|
};
|
||||||
|
|
||||||
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
||||||
let adjustment_for_box_sizing = match fragment.style.get_box().box_sizing {
|
let adjustment_for_box_sizing = match fragment.style.get_position().box_sizing {
|
||||||
box_sizing::T::border_box => fragment.border_padding.block_start_end(),
|
box_sizing::T::border_box => fragment.border_padding.block_start_end(),
|
||||||
box_sizing::T::content_box => Au(0),
|
box_sizing::T::content_box => Au(0),
|
||||||
};
|
};
|
||||||
|
@ -1308,7 +1308,7 @@ impl BlockFlow {
|
||||||
let opaque_self = OpaqueFlow::from_flow(self);
|
let opaque_self = OpaqueFlow::from_flow(self);
|
||||||
|
|
||||||
// Calculate non-auto block size to pass to children.
|
// Calculate non-auto block size to pass to children.
|
||||||
let box_border = match self.fragment.style().get_box().box_sizing {
|
let box_border = match self.fragment.style().get_position().box_sizing {
|
||||||
box_sizing::T::border_box => self.fragment.border_padding.block_start_end(),
|
box_sizing::T::border_box => self.fragment.border_padding.block_start_end(),
|
||||||
box_sizing::T::content_box => Au(0),
|
box_sizing::T::content_box => Au(0),
|
||||||
};
|
};
|
||||||
|
@ -2189,7 +2189,7 @@ pub trait ISizeAndMarginsComputer {
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
layout_context);
|
||||||
let style = block.fragment.style();
|
let style = block.fragment.style();
|
||||||
match (computed_inline_size, style.get_box().box_sizing) {
|
match (computed_inline_size, style.get_position().box_sizing) {
|
||||||
(MaybeAuto::Specified(size), box_sizing::T::border_box) => {
|
(MaybeAuto::Specified(size), box_sizing::T::border_box) => {
|
||||||
computed_inline_size =
|
computed_inline_size =
|
||||||
MaybeAuto::Specified(size - block.fragment.border_padding.inline_start_end())
|
MaybeAuto::Specified(size - block.fragment.border_padding.inline_start_end())
|
||||||
|
|
|
@ -2192,7 +2192,7 @@ impl Fragment {
|
||||||
// FIXME(pcwalton): Don't unconditionally form stacking contexts for `overflow_x: scroll`
|
// FIXME(pcwalton): Don't unconditionally form stacking contexts for `overflow_x: scroll`
|
||||||
// and `overflow_y: scroll`. This needs multiple layers per stacking context.
|
// and `overflow_y: scroll`. This needs multiple layers per stacking context.
|
||||||
match (self.style().get_box().position,
|
match (self.style().get_box().position,
|
||||||
self.style().get_box().z_index,
|
self.style().get_position().z_index,
|
||||||
self.style().get_box().overflow_x,
|
self.style().get_box().overflow_x,
|
||||||
self.style().get_box().overflow_y.0) {
|
self.style().get_box().overflow_y.0) {
|
||||||
(position::T::absolute,
|
(position::T::absolute,
|
||||||
|
@ -2224,15 +2224,15 @@ impl Fragment {
|
||||||
pub fn effective_z_index(&self) -> i32 {
|
pub fn effective_z_index(&self) -> i32 {
|
||||||
match self.style().get_box().position {
|
match self.style().get_box().position {
|
||||||
position::T::static_ => {},
|
position::T::static_ => {},
|
||||||
_ => return self.style().get_box().z_index.number_or_zero(),
|
_ => return self.style().get_position().z_index.number_or_zero(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.style().get_effects().transform.0.is_some() {
|
if self.style().get_effects().transform.0.is_some() {
|
||||||
return self.style().get_box().z_index.number_or_zero();
|
return self.style().get_position().z_index.number_or_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.style().get_box().display {
|
match self.style().get_box().display {
|
||||||
display::T::flex => self.style().get_box().z_index.number_or_zero(),
|
display::T::flex => self.style().get_position().z_index.number_or_zero(),
|
||||||
_ => 0,
|
_ => 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
|
||||||
get_border.border_bottom_style, get_border.border_left_style,
|
get_border.border_bottom_style, get_border.border_left_style,
|
||||||
get_border.border_top_left_radius, get_border.border_top_right_radius,
|
get_border.border_top_left_radius, get_border.border_top_right_radius,
|
||||||
get_border.border_bottom_left_radius, get_border.border_bottom_right_radius,
|
get_border.border_bottom_left_radius, get_border.border_bottom_right_radius,
|
||||||
get_box.z_index, get_box._servo_overflow_clip_box,
|
get_position.z_index, get_box._servo_overflow_clip_box,
|
||||||
get_inheritedtext._servo_text_decorations_in_effect,
|
get_inheritedtext._servo_text_decorations_in_effect,
|
||||||
get_pointing.cursor, get_pointing.pointer_events,
|
get_pointing.cursor, get_pointing.pointer_events,
|
||||||
get_effects.box_shadow, get_effects.clip, get_inheritedtext.text_shadow, get_effects.filter,
|
get_effects.box_shadow, get_effects.clip, get_inheritedtext.text_shadow, get_effects.filter,
|
||||||
|
|
|
@ -165,10 +165,10 @@ impl PropertyAnimation {
|
||||||
[MarginLeft; get_margin; margin_left],
|
[MarginLeft; get_margin; margin_left],
|
||||||
[MarginRight; get_margin; margin_right],
|
[MarginRight; get_margin; margin_right],
|
||||||
[MarginTop; get_margin; margin_top],
|
[MarginTop; get_margin; margin_top],
|
||||||
[MaxHeight; get_box; max_height],
|
[MaxHeight; get_position; max_height],
|
||||||
[MaxWidth; get_box; max_width],
|
[MaxWidth; get_position; max_width],
|
||||||
[MinHeight; get_box; min_height],
|
[MinHeight; get_position; min_height],
|
||||||
[MinWidth; get_box; min_width],
|
[MinWidth; get_position; min_width],
|
||||||
[Opacity; get_effects; opacity],
|
[Opacity; get_effects; opacity],
|
||||||
[OutlineColor; get_outline; outline_color],
|
[OutlineColor; get_outline; outline_color],
|
||||||
[OutlineWidth; get_outline; outline_width],
|
[OutlineWidth; get_outline; outline_width],
|
||||||
|
@ -182,7 +182,7 @@ impl PropertyAnimation {
|
||||||
[VerticalAlign; get_box; vertical_align],
|
[VerticalAlign; get_box; vertical_align],
|
||||||
[Visibility; get_inheritedbox; visibility],
|
[Visibility; get_inheritedbox; visibility],
|
||||||
[Width; get_box; width],
|
[Width; get_box; width],
|
||||||
[ZIndex; get_box; z_index]);
|
[ZIndex; get_position; z_index]);
|
||||||
|
|
||||||
let property_animation = PropertyAnimation {
|
let property_animation = PropertyAnimation {
|
||||||
property: animated_property,
|
property: animated_property,
|
||||||
|
@ -263,10 +263,10 @@ impl PropertyAnimation {
|
||||||
[MarginLeft; mutate_margin; margin_left],
|
[MarginLeft; mutate_margin; margin_left],
|
||||||
[MarginRight; mutate_margin; margin_right],
|
[MarginRight; mutate_margin; margin_right],
|
||||||
[MarginTop; mutate_margin; margin_top],
|
[MarginTop; mutate_margin; margin_top],
|
||||||
[MaxHeight; mutate_box; max_height],
|
[MaxHeight; mutate_position; max_height],
|
||||||
[MaxWidth; mutate_box; max_width],
|
[MaxWidth; mutate_position; max_width],
|
||||||
[MinHeight; mutate_box; min_height],
|
[MinHeight; mutate_position; min_height],
|
||||||
[MinWidth; mutate_box; min_width],
|
[MinWidth; mutate_position; min_width],
|
||||||
[Opacity; mutate_effects; opacity],
|
[Opacity; mutate_effects; opacity],
|
||||||
[OutlineColor; mutate_outline; outline_color],
|
[OutlineColor; mutate_outline; outline_color],
|
||||||
[OutlineWidth; mutate_outline; outline_width],
|
[OutlineWidth; mutate_outline; outline_width],
|
||||||
|
@ -282,7 +282,7 @@ impl PropertyAnimation {
|
||||||
[VerticalAlign; mutate_box; vertical_align],
|
[VerticalAlign; mutate_box; vertical_align],
|
||||||
[Visibility; mutate_inheritedbox; visibility],
|
[Visibility; mutate_inheritedbox; visibility],
|
||||||
[Width; mutate_box; width],
|
[Width; mutate_box; width],
|
||||||
[ZIndex; mutate_box; z_index]);
|
[ZIndex; mutate_position; z_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -588,6 +588,8 @@ pub mod longhands {
|
||||||
|
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
|
${switch_to_style_struct("Position")}
|
||||||
|
|
||||||
<%self:longhand name="z-index">
|
<%self:longhand name="z-index">
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
|
@ -656,6 +658,8 @@ pub mod longhands {
|
||||||
"computed::LengthOrPercentageOrAuto::Auto",
|
"computed::LengthOrPercentageOrAuto::Auto",
|
||||||
"parse_non_negative")}
|
"parse_non_negative")}
|
||||||
|
|
||||||
|
${switch_to_style_struct("Position")}
|
||||||
|
|
||||||
${predefined_type("min-width", "LengthOrPercentage",
|
${predefined_type("min-width", "LengthOrPercentage",
|
||||||
"computed::LengthOrPercentage::Length(Au(0))",
|
"computed::LengthOrPercentage::Length(Au(0))",
|
||||||
"parse_non_negative")}
|
"parse_non_negative")}
|
||||||
|
@ -2509,7 +2513,7 @@ pub mod longhands {
|
||||||
|
|
||||||
// CSS Basic User Interface Module Level 3
|
// CSS Basic User Interface Module Level 3
|
||||||
// http://dev.w3.org/csswg/css-ui/
|
// http://dev.w3.org/csswg/css-ui/
|
||||||
${switch_to_style_struct("Box")}
|
${switch_to_style_struct("Position")}
|
||||||
|
|
||||||
${single_keyword("box-sizing", "content-box border-box")}
|
${single_keyword("box-sizing", "content-box border-box")}
|
||||||
|
|
||||||
|
@ -6404,26 +6408,26 @@ impl ServoComputedValues {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn min_inline_size(&self) -> computed::LengthOrPercentage {
|
pub fn min_inline_size(&self) -> computed::LengthOrPercentage {
|
||||||
let box_style = self.get_box();
|
let position_style = self.get_position();
|
||||||
if self.writing_mode.is_vertical() { box_style.min_height } else { box_style.min_width }
|
if self.writing_mode.is_vertical() { position_style.min_height } else { position_style.min_width }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn min_block_size(&self) -> computed::LengthOrPercentage {
|
pub fn min_block_size(&self) -> computed::LengthOrPercentage {
|
||||||
let box_style = self.get_box();
|
let position_style = self.get_position();
|
||||||
if self.writing_mode.is_vertical() { box_style.min_width } else { box_style.min_height }
|
if self.writing_mode.is_vertical() { position_style.min_width } else { position_style.min_height }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn max_inline_size(&self) -> computed::LengthOrPercentageOrNone {
|
pub fn max_inline_size(&self) -> computed::LengthOrPercentageOrNone {
|
||||||
let box_style = self.get_box();
|
let position_style = self.get_position();
|
||||||
if self.writing_mode.is_vertical() { box_style.max_height } else { box_style.max_width }
|
if self.writing_mode.is_vertical() { position_style.max_height } else { position_style.max_width }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn max_block_size(&self) -> computed::LengthOrPercentageOrNone {
|
pub fn max_block_size(&self) -> computed::LengthOrPercentageOrNone {
|
||||||
let box_style = self.get_box();
|
let position_style = self.get_position();
|
||||||
if self.writing_mode.is_vertical() { box_style.max_width } else { box_style.max_height }
|
if self.writing_mode.is_vertical() { position_style.max_width } else { position_style.max_height }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue