Auto merge of #10407 - mauricioc:issue10403, r=bholley

Move some CSS properties to match Gecko's representation

Fixes #10403. Animation had an extra transition-delay property, which was also moved to Box. Let me know if I should squash the commits.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10407)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-07 03:18:15 +05:30
commit 256b865055
10 changed files with 92 additions and 90 deletions

View file

@ -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())

View file

@ -1122,7 +1122,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.style().get_color().color
};
for text_shadow in self.style.get_effects().text_shadow.0.iter().rev() {
for text_shadow in self.style.get_inheritedtext().text_shadow.0.iter().rev() {
let offset = &Point2D::new(text_shadow.offset_x, text_shadow.offset_y);
let color = self.style().resolve_color(text_shadow.color);
self.build_display_list_for_text_fragment(state,

View file

@ -25,7 +25,6 @@ use std::cmp::max;
use std::sync::Arc;
use style::computed_values::flex_direction;
use style::logical_geometry::LogicalSize;
use style::properties::style_structs;
use style::properties::{ComputedValues, ServoComputedValues};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
@ -88,10 +87,6 @@ pub struct FlexFlow {
available_cross_size: AxisSize
}
fn flex_style(fragment: &Fragment) -> &style_structs::Flex {
fragment.style.get_flex()
}
// TODO(zentner): This function should use flex-basis.
fn flex_item_inline_sizes(flow: &mut Flow) -> IntrinsicISizes {
let _scope = layout_debug_scope!("flex::flex_item_inline_sizes");
@ -113,7 +108,7 @@ impl FlexFlow {
flotation: Option<FloatKind>)
-> FlexFlow {
let main_mode = match flex_style(&fragment).flex_direction {
let main_mode = match fragment.style.get_position().flex_direction {
flex_direction::T::row_reverse | flex_direction::T::row => Mode::Inline,
flex_direction::T::column_reverse | flex_direction::T::column => Mode::Block
};

View file

@ -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,
}
}

View file

@ -176,7 +176,7 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
REFLOW,
RECONSTRUCT_FLOW
], [
get_box.float, get_box.display, get_box.position, get_box.content,
get_box.float, get_box.display, get_box.position, get_counters.content,
get_counters.counter_reset, get_counters.counter_increment,
get_list.quotes, get_list.list_style_type,
@ -185,7 +185,7 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
get_inheritedtext.letter_spacing, get_inheritedtext.text_rendering,
get_inheritedtext.text_transform, get_inheritedtext.word_spacing,
get_inheritedtext.overflow_wrap, get_inheritedtext.text_justify,
get_inheritedtext.white_space, get_inheritedtext.word_break, get_inheritedtext.text_overflow,
get_inheritedtext.white_space, get_inheritedtext.word_break, get_text.text_overflow,
get_font.font_family, get_font.font_style, get_font.font_variant, get_font.font_weight,
get_font.font_size, get_font.font_stretch,
get_inheritedbox.direction, get_inheritedbox.writing_mode,
@ -202,17 +202,17 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
get_padding.padding_top, get_padding.padding_right,
get_padding.padding_bottom, get_padding.padding_left,
get_box.width, get_box.height,
get_inheritedbox.line_height,
get_inheritedtext.line_height,
get_inheritedtext.text_align, get_inheritedtext.text_indent,
get_table.table_layout,
get_inheritedtable.border_collapse,
get_inheritedtable.border_spacing,
get_column.column_gap,
get_flex.flex_direction
get_position.flex_direction
]) || add_if_not_equal!(old, new, damage,
[ REPAINT, STORE_OVERFLOW, REFLOW_OUT_OF_FLOW ], [
get_positionoffsets.top, get_positionoffsets.left,
get_positionoffsets.right, get_positionoffsets.bottom
get_position.top, get_position.left,
get_position.right, get_position.bottom
]) || add_if_not_equal!(old, new, damage,
[ REPAINT ], [
get_color.color, get_background.background_color,
@ -226,10 +226,10 @@ 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_effects.text_shadow, get_effects.filter,
get_effects.box_shadow, get_effects.clip, get_inheritedtext.text_shadow, get_effects.filter,
get_effects.transform, get_effects.backface_visibility, get_effects.transform_style,
get_effects.transform_origin, get_effects.perspective, get_effects.perspective_origin,
get_effects.mix_blend_mode, get_inheritedbox.image_rendering,

View file

@ -671,7 +671,7 @@ impl LineBreaker {
let mut need_ellipsis = false;
let available_inline_size = self.pending_line.green_zone.inline -
self.pending_line.bounds.size.inline - indentation;
match (fragment.style().get_inheritedtext().text_overflow,
match (fragment.style().get_text().text_overflow,
fragment.style().get_box().overflow_x) {
(text_overflow::T::clip, _) | (_, overflow_x::T::visible) => {}
(text_overflow::T::ellipsis, _) => {

View file

@ -417,7 +417,7 @@ pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<Fo
/// Returns the line block-size needed by the given computed style and font size.
pub fn line_height_from_style(style: &ServoComputedValues, metrics: &FontMetrics) -> Au {
let font_size = style.get_font().font_size;
match style.get_inheritedbox().line_height {
match style.get_inheritedtext().line_height {
line_height::T::Normal => metrics.line_gap,
line_height::T::Number(l) => font_size.scale_by(l),
line_height::T::Length(l) => l

View file

@ -1034,7 +1034,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
data.per_pseudo.get(&PseudoElement::After).unwrap()
};
return match style.as_ref().get_box().content {
return match style.as_ref().get_counters().content {
content::T::Content(ref value) if !value.is_empty() => {
TextContent::GeneratedContent((*value).clone())
}