Skip to content
Permalink
Browse files

Move some CSS properties from Box to Position

  • Loading branch information...
mauricioc committed Apr 5, 2016
1 parent 281e385 commit aae8919da4bd2fdf24a2d0c87445418b6bc43f35
@@ -359,7 +359,7 @@ impl CandidateBSizeIterator {
};

// 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::content_box => Au(0),
};
@@ -1308,7 +1308,7 @@ impl BlockFlow {
let opaque_self = OpaqueFlow::from_flow(self);

// 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::content_box => Au(0),
};
@@ -2189,7 +2189,7 @@ pub trait ISizeAndMarginsComputer {
parent_flow_inline_size,
layout_context);
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) => {
computed_inline_size =
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`
// and `overflow_y: scroll`. This needs multiple layers per stacking context.
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_y.0) {
(position::T::absolute,
@@ -2224,15 +2224,15 @@ impl Fragment {
pub fn effective_z_index(&self) -> i32 {
match self.style().get_box().position {
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() {
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 {
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,
}
}
@@ -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_top_left_radius, get_border.border_top_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_pointing.cursor, get_pointing.pointer_events,
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],
[MarginRight; get_margin; margin_right],
[MarginTop; get_margin; margin_top],
[MaxHeight; get_box; max_height],
[MaxWidth; get_box; max_width],
[MinHeight; get_box; min_height],
[MinWidth; get_box; min_width],
[MaxHeight; get_position; max_height],
[MaxWidth; get_position; max_width],
[MinHeight; get_position; min_height],
[MinWidth; get_position; min_width],
[Opacity; get_effects; opacity],
[OutlineColor; get_outline; outline_color],
[OutlineWidth; get_outline; outline_width],
@@ -182,7 +182,7 @@ impl PropertyAnimation {
[VerticalAlign; get_box; vertical_align],
[Visibility; get_inheritedbox; visibility],
[Width; get_box; width],
[ZIndex; get_box; z_index]);
[ZIndex; get_position; z_index]);

let property_animation = PropertyAnimation {
property: animated_property,
@@ -263,10 +263,10 @@ impl PropertyAnimation {
[MarginLeft; mutate_margin; margin_left],
[MarginRight; mutate_margin; margin_right],
[MarginTop; mutate_margin; margin_top],
[MaxHeight; mutate_box; max_height],
[MaxWidth; mutate_box; max_width],
[MinHeight; mutate_box; min_height],
[MinWidth; mutate_box; min_width],
[MaxHeight; mutate_position; max_height],
[MaxWidth; mutate_position; max_width],
[MinHeight; mutate_position; min_height],
[MinWidth; mutate_position; min_width],
[Opacity; mutate_effects; opacity],
[OutlineColor; mutate_outline; outline_color],
[OutlineWidth; mutate_outline; outline_width],
@@ -282,7 +282,7 @@ impl PropertyAnimation {
[VerticalAlign; mutate_box; vertical_align],
[Visibility; mutate_inheritedbox; visibility],
[Width; mutate_box; width],
[ZIndex; mutate_box; z_index]);
[ZIndex; mutate_position; z_index]);
}

#[inline]
@@ -588,6 +588,8 @@ pub mod longhands {

</%self:longhand>

${switch_to_style_struct("Position")}

<%self:longhand name="z-index">
use values::computed::ComputedValueAsSpecified;

@@ -656,6 +658,8 @@ pub mod longhands {
"computed::LengthOrPercentageOrAuto::Auto",
"parse_non_negative")}

${switch_to_style_struct("Position")}

${predefined_type("min-width", "LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_non_negative")}
@@ -2509,7 +2513,7 @@ pub mod longhands {

// CSS Basic User Interface Module Level 3
// 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")}

@@ -6404,26 +6408,26 @@ impl ServoComputedValues {

#[inline]
pub fn min_inline_size(&self) -> computed::LengthOrPercentage {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.min_height } else { box_style.min_width }
let position_style = self.get_position();
if self.writing_mode.is_vertical() { position_style.min_height } else { position_style.min_width }
}

#[inline]
pub fn min_block_size(&self) -> computed::LengthOrPercentage {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.min_width } else { box_style.min_height }
let position_style = self.get_position();
if self.writing_mode.is_vertical() { position_style.min_width } else { position_style.min_height }
}

#[inline]
pub fn max_inline_size(&self) -> computed::LengthOrPercentageOrNone {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.max_height } else { box_style.max_width }
let position_style = self.get_position();
if self.writing_mode.is_vertical() { position_style.max_height } else { position_style.max_width }
}

#[inline]
pub fn max_block_size(&self) -> computed::LengthOrPercentageOrNone {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.max_width } else { box_style.max_height }
let position_style = self.get_position();
if self.writing_mode.is_vertical() { position_style.max_width } else { position_style.max_height }
}

#[inline]

0 comments on commit aae8919

Please sign in to comment.
You can’t perform that action at this time.