mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
commit
256b865055
10 changed files with 92 additions and 90 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())
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
self.style().get_color().color
|
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 offset = &Point2D::new(text_shadow.offset_x, text_shadow.offset_y);
|
||||||
let color = self.style().resolve_color(text_shadow.color);
|
let color = self.style().resolve_color(text_shadow.color);
|
||||||
self.build_display_list_for_text_fragment(state,
|
self.build_display_list_for_text_fragment(state,
|
||||||
|
|
|
@ -25,7 +25,6 @@ use std::cmp::max;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::computed_values::flex_direction;
|
use style::computed_values::flex_direction;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::style_structs;
|
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||||
|
|
||||||
|
@ -88,10 +87,6 @@ pub struct FlexFlow {
|
||||||
available_cross_size: AxisSize
|
available_cross_size: AxisSize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flex_style(fragment: &Fragment) -> &style_structs::Flex {
|
|
||||||
fragment.style.get_flex()
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(zentner): This function should use flex-basis.
|
// TODO(zentner): This function should use flex-basis.
|
||||||
fn flex_item_inline_sizes(flow: &mut Flow) -> IntrinsicISizes {
|
fn flex_item_inline_sizes(flow: &mut Flow) -> IntrinsicISizes {
|
||||||
let _scope = layout_debug_scope!("flex::flex_item_inline_sizes");
|
let _scope = layout_debug_scope!("flex::flex_item_inline_sizes");
|
||||||
|
@ -113,7 +108,7 @@ impl FlexFlow {
|
||||||
flotation: Option<FloatKind>)
|
flotation: Option<FloatKind>)
|
||||||
-> FlexFlow {
|
-> 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::row_reverse | flex_direction::T::row => Mode::Inline,
|
||||||
flex_direction::T::column_reverse | flex_direction::T::column => Mode::Block
|
flex_direction::T::column_reverse | flex_direction::T::column => Mode::Block
|
||||||
};
|
};
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
|
||||||
REFLOW,
|
REFLOW,
|
||||||
RECONSTRUCT_FLOW
|
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_counters.counter_reset, get_counters.counter_increment,
|
||||||
get_list.quotes, get_list.list_style_type,
|
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.letter_spacing, get_inheritedtext.text_rendering,
|
||||||
get_inheritedtext.text_transform, get_inheritedtext.word_spacing,
|
get_inheritedtext.text_transform, get_inheritedtext.word_spacing,
|
||||||
get_inheritedtext.overflow_wrap, get_inheritedtext.text_justify,
|
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_family, get_font.font_style, get_font.font_variant, get_font.font_weight,
|
||||||
get_font.font_size, get_font.font_stretch,
|
get_font.font_size, get_font.font_stretch,
|
||||||
get_inheritedbox.direction, get_inheritedbox.writing_mode,
|
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_top, get_padding.padding_right,
|
||||||
get_padding.padding_bottom, get_padding.padding_left,
|
get_padding.padding_bottom, get_padding.padding_left,
|
||||||
get_box.width, get_box.height,
|
get_box.width, get_box.height,
|
||||||
get_inheritedbox.line_height,
|
get_inheritedtext.line_height,
|
||||||
get_inheritedtext.text_align, get_inheritedtext.text_indent,
|
get_inheritedtext.text_align, get_inheritedtext.text_indent,
|
||||||
get_table.table_layout,
|
get_table.table_layout,
|
||||||
get_inheritedtable.border_collapse,
|
get_inheritedtable.border_collapse,
|
||||||
get_inheritedtable.border_spacing,
|
get_inheritedtable.border_spacing,
|
||||||
get_column.column_gap,
|
get_column.column_gap,
|
||||||
get_flex.flex_direction
|
get_position.flex_direction
|
||||||
]) || add_if_not_equal!(old, new, damage,
|
]) || add_if_not_equal!(old, new, damage,
|
||||||
[ REPAINT, STORE_OVERFLOW, REFLOW_OUT_OF_FLOW ], [
|
[ REPAINT, STORE_OVERFLOW, REFLOW_OUT_OF_FLOW ], [
|
||||||
get_positionoffsets.top, get_positionoffsets.left,
|
get_position.top, get_position.left,
|
||||||
get_positionoffsets.right, get_positionoffsets.bottom
|
get_position.right, get_position.bottom
|
||||||
]) || add_if_not_equal!(old, new, damage,
|
]) || add_if_not_equal!(old, new, damage,
|
||||||
[ REPAINT ], [
|
[ REPAINT ], [
|
||||||
get_color.color, get_background.background_color,
|
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_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_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, get_effects.backface_visibility, get_effects.transform_style,
|
||||||
get_effects.transform_origin, get_effects.perspective, get_effects.perspective_origin,
|
get_effects.transform_origin, get_effects.perspective, get_effects.perspective_origin,
|
||||||
get_effects.mix_blend_mode, get_inheritedbox.image_rendering,
|
get_effects.mix_blend_mode, get_inheritedbox.image_rendering,
|
||||||
|
|
|
@ -671,7 +671,7 @@ impl LineBreaker {
|
||||||
let mut need_ellipsis = false;
|
let mut need_ellipsis = false;
|
||||||
let available_inline_size = self.pending_line.green_zone.inline -
|
let available_inline_size = self.pending_line.green_zone.inline -
|
||||||
self.pending_line.bounds.size.inline - indentation;
|
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) {
|
fragment.style().get_box().overflow_x) {
|
||||||
(text_overflow::T::clip, _) | (_, overflow_x::T::visible) => {}
|
(text_overflow::T::clip, _) | (_, overflow_x::T::visible) => {}
|
||||||
(text_overflow::T::ellipsis, _) => {
|
(text_overflow::T::ellipsis, _) => {
|
||||||
|
|
|
@ -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.
|
/// 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 {
|
pub fn line_height_from_style(style: &ServoComputedValues, metrics: &FontMetrics) -> Au {
|
||||||
let font_size = style.get_font().font_size;
|
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::Normal => metrics.line_gap,
|
||||||
line_height::T::Number(l) => font_size.scale_by(l),
|
line_height::T::Number(l) => font_size.scale_by(l),
|
||||||
line_height::T::Length(l) => l
|
line_height::T::Length(l) => l
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
data.per_pseudo.get(&PseudoElement::After).unwrap()
|
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() => {
|
content::T::Content(ref value) if !value.is_empty() => {
|
||||||
TextContent::GeneratedContent((*value).clone())
|
TextContent::GeneratedContent((*value).clone())
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ use properties::longhands::transition_timing_function::computed_value::{Transiti
|
||||||
use properties::longhands::vertical_align::computed_value::T as VerticalAlign;
|
use properties::longhands::vertical_align::computed_value::T as VerticalAlign;
|
||||||
use properties::longhands::visibility::computed_value::T as Visibility;
|
use properties::longhands::visibility::computed_value::T as Visibility;
|
||||||
use properties::longhands::z_index::computed_value::T as ZIndex;
|
use properties::longhands::z_index::computed_value::T as ZIndex;
|
||||||
use properties::style_struct_traits::TAnimation;
|
use properties::style_struct_traits::TBox;
|
||||||
use properties::{ComputedValues, ServoComputedValues};
|
use properties::{ComputedValues, ServoComputedValues};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
|
@ -74,7 +74,7 @@ impl PropertyAnimation {
|
||||||
-> Vec<PropertyAnimation> {
|
-> Vec<PropertyAnimation> {
|
||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
let transition_property =
|
let transition_property =
|
||||||
new_style.as_servo().get_animation().transition_property.0[transition_index];
|
new_style.as_servo().get_box().transition_property.0[transition_index];
|
||||||
if transition_property != TransitionProperty::All {
|
if transition_property != TransitionProperty::All {
|
||||||
if let Some(property_animation) =
|
if let Some(property_animation) =
|
||||||
PropertyAnimation::from_transition_property(transition_property,
|
PropertyAnimation::from_transition_property(transition_property,
|
||||||
|
@ -105,7 +105,7 @@ impl PropertyAnimation {
|
||||||
old_style: &ServoComputedValues,
|
old_style: &ServoComputedValues,
|
||||||
new_style: &mut ServoComputedValues)
|
new_style: &mut ServoComputedValues)
|
||||||
-> Option<PropertyAnimation> {
|
-> Option<PropertyAnimation> {
|
||||||
let animation_style = new_style.get_animation();
|
let box_style = new_style.get_box();
|
||||||
macro_rules! match_transition {
|
macro_rules! match_transition {
|
||||||
( $( [$name:ident; $structname:ident; $field:ident] ),* ) => {
|
( $( [$name:ident; $structname:ident; $field:ident] ),* ) => {
|
||||||
match transition_property {
|
match transition_property {
|
||||||
|
@ -128,8 +128,8 @@ impl PropertyAnimation {
|
||||||
new_style.get_inheritedtext().letter_spacing.0)
|
new_style.get_inheritedtext().letter_spacing.0)
|
||||||
}
|
}
|
||||||
TransitionProperty::TextShadow => {
|
TransitionProperty::TextShadow => {
|
||||||
AnimatedProperty::TextShadow(old_style.get_effects().text_shadow.clone(),
|
AnimatedProperty::TextShadow(old_style.get_inheritedtext().text_shadow.clone(),
|
||||||
new_style.get_effects().text_shadow.clone())
|
new_style.get_inheritedtext().text_shadow.clone())
|
||||||
}
|
}
|
||||||
TransitionProperty::Transform => {
|
TransitionProperty::Transform => {
|
||||||
AnimatedProperty::Transform(old_style.get_effects().transform.clone(),
|
AnimatedProperty::Transform(old_style.get_effects().transform.clone(),
|
||||||
|
@ -154,21 +154,21 @@ impl PropertyAnimation {
|
||||||
[BorderSpacing; get_inheritedtable; border_spacing],
|
[BorderSpacing; get_inheritedtable; border_spacing],
|
||||||
[BorderTopColor; get_border; border_top_color],
|
[BorderTopColor; get_border; border_top_color],
|
||||||
[BorderTopWidth; get_border; border_top_width],
|
[BorderTopWidth; get_border; border_top_width],
|
||||||
[Bottom; get_positionoffsets; bottom],
|
[Bottom; get_position; bottom],
|
||||||
[Color; get_color; color],
|
[Color; get_color; color],
|
||||||
[FontSize; get_font; font_size],
|
[FontSize; get_font; font_size],
|
||||||
[FontWeight; get_font; font_weight],
|
[FontWeight; get_font; font_weight],
|
||||||
[Height; get_box; height],
|
[Height; get_box; height],
|
||||||
[Left; get_positionoffsets; left],
|
[Left; get_position; left],
|
||||||
[LineHeight; get_inheritedbox; line_height],
|
[LineHeight; get_inheritedtext; line_height],
|
||||||
[MarginBottom; get_margin; margin_bottom],
|
[MarginBottom; get_margin; margin_bottom],
|
||||||
[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],
|
||||||
|
@ -176,19 +176,19 @@ impl PropertyAnimation {
|
||||||
[PaddingLeft; get_padding; padding_left],
|
[PaddingLeft; get_padding; padding_left],
|
||||||
[PaddingRight; get_padding; padding_right],
|
[PaddingRight; get_padding; padding_right],
|
||||||
[PaddingTop; get_padding; padding_top],
|
[PaddingTop; get_padding; padding_top],
|
||||||
[Right; get_positionoffsets; right],
|
[Right; get_position; right],
|
||||||
[TextIndent; get_inheritedtext; text_indent],
|
[TextIndent; get_inheritedtext; text_indent],
|
||||||
[Top; get_positionoffsets; top],
|
[Top; get_position; top],
|
||||||
[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,
|
||||||
timing_function:
|
timing_function:
|
||||||
*animation_style.transition_timing_function.0.get_mod(transition_index),
|
*box_style.transition_timing_function.0.get_mod(transition_index),
|
||||||
duration: *animation_style.transition_duration.0.get_mod(transition_index),
|
duration: *box_style.transition_duration.0.get_mod(transition_index),
|
||||||
};
|
};
|
||||||
if property_animation.does_not_animate() {
|
if property_animation.does_not_animate() {
|
||||||
None
|
None
|
||||||
|
@ -252,21 +252,21 @@ impl PropertyAnimation {
|
||||||
[BorderSpacing; mutate_inheritedtable; border_spacing],
|
[BorderSpacing; mutate_inheritedtable; border_spacing],
|
||||||
[BorderTopColor; mutate_border; border_top_color],
|
[BorderTopColor; mutate_border; border_top_color],
|
||||||
[BorderTopWidth; mutate_border; border_top_width],
|
[BorderTopWidth; mutate_border; border_top_width],
|
||||||
[Bottom; mutate_positionoffsets; bottom],
|
[Bottom; mutate_position; bottom],
|
||||||
[Color; mutate_color; color],
|
[Color; mutate_color; color],
|
||||||
[FontSize; mutate_font; font_size],
|
[FontSize; mutate_font; font_size],
|
||||||
[FontWeight; mutate_font; font_weight],
|
[FontWeight; mutate_font; font_weight],
|
||||||
[Height; mutate_box; height],
|
[Height; mutate_box; height],
|
||||||
[Left; mutate_positionoffsets; left],
|
[Left; mutate_position; left],
|
||||||
[LineHeight; mutate_inheritedbox; line_height],
|
[LineHeight; mutate_inheritedtext; line_height],
|
||||||
[MarginBottom; mutate_margin; margin_bottom],
|
[MarginBottom; mutate_margin; margin_bottom],
|
||||||
[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],
|
||||||
|
@ -274,15 +274,15 @@ impl PropertyAnimation {
|
||||||
[PaddingLeft; mutate_padding; padding_left],
|
[PaddingLeft; mutate_padding; padding_left],
|
||||||
[PaddingRight; mutate_padding; padding_right],
|
[PaddingRight; mutate_padding; padding_right],
|
||||||
[PaddingTop; mutate_padding; padding_top],
|
[PaddingTop; mutate_padding; padding_top],
|
||||||
[Right; mutate_positionoffsets; right],
|
[Right; mutate_position; right],
|
||||||
[TextIndent; mutate_inheritedtext; text_indent],
|
[TextIndent; mutate_inheritedtext; text_indent],
|
||||||
[TextShadow; mutate_effects; text_shadow],
|
[TextShadow; mutate_inheritedtext; text_shadow],
|
||||||
[Top; mutate_positionoffsets; top],
|
[Top; mutate_position; top],
|
||||||
[Transform; mutate_effects; transform],
|
[Transform; mutate_effects; transform],
|
||||||
[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]
|
||||||
|
@ -936,7 +936,7 @@ pub fn start_transitions_if_applicable<C: ComputedValues>(new_animations_sender:
|
||||||
new_style: &mut C)
|
new_style: &mut C)
|
||||||
-> bool {
|
-> bool {
|
||||||
let mut had_animations = false;
|
let mut had_animations = false;
|
||||||
for i in 0..new_style.get_animation().transition_count() {
|
for i in 0..new_style.get_box().transition_count() {
|
||||||
// Create any property animations, if applicable.
|
// Create any property animations, if applicable.
|
||||||
let property_animations = PropertyAnimation::from_transition(i, old_style.as_servo(), new_style.as_servo_mut());
|
let property_animations = PropertyAnimation::from_transition(i, old_style.as_servo(), new_style.as_servo_mut());
|
||||||
for property_animation in property_animations {
|
for property_animation in property_animations {
|
||||||
|
@ -945,15 +945,15 @@ pub fn start_transitions_if_applicable<C: ComputedValues>(new_animations_sender:
|
||||||
|
|
||||||
// Kick off the animation.
|
// Kick off the animation.
|
||||||
let now = time::precise_time_s();
|
let now = time::precise_time_s();
|
||||||
let animation_style = new_style.as_servo().get_animation();
|
let box_style = new_style.as_servo().get_box();
|
||||||
let start_time =
|
let start_time =
|
||||||
now + (animation_style.transition_delay.0.get_mod(i).seconds() as f64);
|
now + (box_style.transition_delay.0.get_mod(i).seconds() as f64);
|
||||||
new_animations_sender.lock().unwrap().send(Animation {
|
new_animations_sender.lock().unwrap().send(Animation {
|
||||||
node: node,
|
node: node,
|
||||||
property_animation: property_animation,
|
property_animation: property_animation,
|
||||||
start_time: start_time,
|
start_time: start_time,
|
||||||
end_time: start_time +
|
end_time: start_time +
|
||||||
(animation_style.transition_duration.0.get_mod(i).seconds() as f64),
|
(box_style.transition_duration.0.get_mod(i).seconds() as f64),
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
|
|
||||||
had_animations = true
|
had_animations = true
|
||||||
|
|
|
@ -460,7 +460,7 @@ pub mod longhands {
|
||||||
|
|
||||||
${predefined_type("outline-offset", "Length", "Au(0)")}
|
${predefined_type("outline-offset", "Length", "Au(0)")}
|
||||||
|
|
||||||
${new_style_struct("PositionOffsets", is_inherited=False, gecko_name="nsStylePosition")}
|
${new_style_struct("Position", is_inherited=False, gecko_name="nsStylePosition")}
|
||||||
|
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
${predefined_type(side, "LengthOrPercentageOrAuto",
|
${predefined_type(side, "LengthOrPercentageOrAuto",
|
||||||
|
@ -476,7 +476,8 @@ pub mod longhands {
|
||||||
"longhands::position::computed_value::T"),
|
"longhands::position::computed_value::T"),
|
||||||
Method("is_floated", "bool"),
|
Method("is_floated", "bool"),
|
||||||
Method("overflow_x_is_visible", "bool"),
|
Method("overflow_x_is_visible", "bool"),
|
||||||
Method("overflow_y_is_visible", "bool")])}
|
Method("overflow_y_is_visible", "bool"),
|
||||||
|
Method("transition_count", "usize")])}
|
||||||
|
|
||||||
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
|
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
|
||||||
<%self:longhand name="display" custom_cascade="True">
|
<%self:longhand name="display" custom_cascade="True">
|
||||||
|
@ -588,6 +589,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 +659,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")}
|
||||||
|
@ -670,7 +675,9 @@ pub mod longhands {
|
||||||
"computed::LengthOrPercentageOrNone::None",
|
"computed::LengthOrPercentageOrNone::None",
|
||||||
"parse_non_negative")}
|
"parse_non_negative")}
|
||||||
|
|
||||||
${switch_to_style_struct("InheritedBox")}
|
${new_style_struct("InheritedText", is_inherited=True, gecko_name="nsStyleText",
|
||||||
|
additional_methods=[Method("clone__servo_text_decorations_in_effect",
|
||||||
|
"longhands::_servo_text_decorations_in_effect::computed_value::T")])}
|
||||||
|
|
||||||
<%self:longhand name="line-height">
|
<%self:longhand name="line-height">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
@ -904,7 +911,7 @@ pub mod longhands {
|
||||||
|
|
||||||
// CSS 2.1, Section 12 - Generated content, automatic numbering, and lists
|
// CSS 2.1, Section 12 - Generated content, automatic numbering, and lists
|
||||||
|
|
||||||
${switch_to_style_struct("Box")}
|
${new_style_struct("Counters", is_inherited=False)}
|
||||||
|
|
||||||
<%self:longhand name="content">
|
<%self:longhand name="content">
|
||||||
use cssparser::Token;
|
use cssparser::Token;
|
||||||
|
@ -1217,7 +1224,7 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
${new_style_struct("Counters", is_inherited=False)}
|
${switch_to_style_struct("Counters")}
|
||||||
|
|
||||||
<%self:longhand name="counter-increment">
|
<%self:longhand name="counter-increment">
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -1973,9 +1980,7 @@ pub mod longhands {
|
||||||
|
|
||||||
// CSS 2.1, Section 16 - Text
|
// CSS 2.1, Section 16 - Text
|
||||||
|
|
||||||
${new_style_struct("InheritedText", is_inherited=True, gecko_name="nsStyleText",
|
${switch_to_style_struct("InheritedText")}
|
||||||
additional_methods=[Method("clone__servo_text_decorations_in_effect",
|
|
||||||
"longhands::_servo_text_decorations_in_effect::computed_value::T")])}
|
|
||||||
|
|
||||||
<%self:longhand name="text-align">
|
<%self:longhand name="text-align">
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
|
@ -2162,8 +2167,6 @@ pub mod longhands {
|
||||||
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
|
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
|
||||||
${single_keyword("word-break", "normal break-all")}
|
${single_keyword("word-break", "normal break-all")}
|
||||||
|
|
||||||
${single_keyword("text-overflow", "clip ellipsis")}
|
|
||||||
|
|
||||||
// TODO(pcwalton): Support `text-justify: distribute`.
|
// TODO(pcwalton): Support `text-justify: distribute`.
|
||||||
${single_keyword("text-justify", "auto none inter-word")}
|
${single_keyword("text-justify", "auto none inter-word")}
|
||||||
|
|
||||||
|
@ -2172,6 +2175,8 @@ pub mod longhands {
|
||||||
Method("has_overline", "bool"),
|
Method("has_overline", "bool"),
|
||||||
Method("has_line_through", "bool")])}
|
Method("has_line_through", "bool")])}
|
||||||
|
|
||||||
|
${single_keyword("text-overflow", "clip ellipsis")}
|
||||||
|
|
||||||
${single_keyword("unicode-bidi", "normal embed isolate bidi-override isolate-override plaintext")}
|
${single_keyword("unicode-bidi", "normal embed isolate bidi-override isolate-override plaintext")}
|
||||||
|
|
||||||
<%self:longhand name="text-decoration" custom_cascade="True">
|
<%self:longhand name="text-decoration" custom_cascade="True">
|
||||||
|
@ -2509,7 +2514,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")}
|
||||||
|
|
||||||
|
@ -3161,6 +3166,8 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
|
${switch_to_style_struct("InheritedText")}
|
||||||
|
|
||||||
<%self:longhand name="text-shadow">
|
<%self:longhand name="text-shadow">
|
||||||
use cssparser::{self, ToCss};
|
use cssparser::{self, ToCss};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -3339,6 +3346,8 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
|
${switch_to_style_struct("Effects")}
|
||||||
|
|
||||||
<%self:longhand name="filter">
|
<%self:longhand name="filter">
|
||||||
//pub use self::computed_value::T as SpecifiedValue;
|
//pub use self::computed_value::T as SpecifiedValue;
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
@ -4327,8 +4336,7 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
${new_style_struct("Animation", is_inherited=False,
|
${switch_to_style_struct("Box")}
|
||||||
additional_methods=[Method("transition_count", return_type="usize")])}
|
|
||||||
|
|
||||||
// TODO(pcwalton): Multiple transitions.
|
// TODO(pcwalton): Multiple transitions.
|
||||||
<%self:longhand name="transition-duration">
|
<%self:longhand name="transition-duration">
|
||||||
|
@ -4854,7 +4862,7 @@ pub mod longhands {
|
||||||
// CSS Flexible Box Layout Module Level 1
|
// CSS Flexible Box Layout Module Level 1
|
||||||
// http://www.w3.org/TR/css3-flexbox/
|
// http://www.w3.org/TR/css3-flexbox/
|
||||||
|
|
||||||
${new_style_struct("Flex", is_inherited=False)}
|
${switch_to_style_struct("Position")}
|
||||||
|
|
||||||
// Flex container properties
|
// Flex container properties
|
||||||
${single_keyword("flex-direction", "row row-reverse column column-reverse", experimental=True)}
|
${single_keyword("flex-direction", "row row-reverse column column-reverse", experimental=True)}
|
||||||
|
@ -6174,11 +6182,7 @@ pub mod style_structs {
|
||||||
self.${longhand.ident} = other.${longhand.ident}.clone();
|
self.${longhand.ident} = other.${longhand.ident}.clone();
|
||||||
}
|
}
|
||||||
% endfor
|
% endfor
|
||||||
% if style_struct.name == "Animation":
|
% if style_struct.name == "Border":
|
||||||
fn transition_count(&self) -> usize {
|
|
||||||
self.transition_property.0.len()
|
|
||||||
}
|
|
||||||
% elif style_struct.name == "Border":
|
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
fn border_${side}_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
|
fn border_${side}_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
|
||||||
self.border_${side}_style.none_or_hidden() &&
|
self.border_${side}_style.none_or_hidden() &&
|
||||||
|
@ -6201,6 +6205,9 @@ pub mod style_structs {
|
||||||
fn overflow_y_is_visible(&self) -> bool {
|
fn overflow_y_is_visible(&self) -> bool {
|
||||||
self.overflow_y.0 == longhands::overflow_x::computed_value::T::visible
|
self.overflow_y.0 == longhands::overflow_x::computed_value::T::visible
|
||||||
}
|
}
|
||||||
|
fn transition_count(&self) -> usize {
|
||||||
|
self.transition_property.0.len()
|
||||||
|
}
|
||||||
% elif style_struct.name == "Color":
|
% elif style_struct.name == "Color":
|
||||||
fn clone_color(&self) -> longhands::color::computed_value::T {
|
fn clone_color(&self) -> longhands::color::computed_value::T {
|
||||||
self.color.clone()
|
self.color.clone()
|
||||||
|
@ -6402,26 +6409,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]
|
||||||
|
@ -6460,7 +6467,7 @@ impl ServoComputedValues {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn logical_position(&self) -> LogicalMargin<computed::LengthOrPercentageOrAuto> {
|
pub fn logical_position(&self) -> LogicalMargin<computed::LengthOrPercentageOrAuto> {
|
||||||
// FIXME(SimonSapin): should be the writing mode of the containing block, maybe?
|
// FIXME(SimonSapin): should be the writing mode of the containing block, maybe?
|
||||||
let position_style = self.get_positionoffsets();
|
let position_style = self.get_position();
|
||||||
LogicalMargin::from_physical(self.writing_mode, SideOffsets2D::new(
|
LogicalMargin::from_physical(self.writing_mode, SideOffsets2D::new(
|
||||||
position_style.top,
|
position_style.top,
|
||||||
position_style.right,
|
position_style.right,
|
||||||
|
@ -7072,11 +7079,11 @@ pub fn modify_style_for_text(style: &mut Arc<ServoComputedValues>) {
|
||||||
// We leave the `position` property set to `relative` so that we'll still establish a
|
// We leave the `position` property set to `relative` so that we'll still establish a
|
||||||
// containing block if needed. But we reset all position offsets to `auto`.
|
// containing block if needed. But we reset all position offsets to `auto`.
|
||||||
let mut style = Arc::make_mut(style);
|
let mut style = Arc::make_mut(style);
|
||||||
let mut position_offsets = Arc::make_mut(&mut style.positionoffsets);
|
let mut position = Arc::make_mut(&mut style.position);
|
||||||
position_offsets.top = computed::LengthOrPercentageOrAuto::Auto;
|
position.top = computed::LengthOrPercentageOrAuto::Auto;
|
||||||
position_offsets.right = computed::LengthOrPercentageOrAuto::Auto;
|
position.right = computed::LengthOrPercentageOrAuto::Auto;
|
||||||
position_offsets.bottom = computed::LengthOrPercentageOrAuto::Auto;
|
position.bottom = computed::LengthOrPercentageOrAuto::Auto;
|
||||||
position_offsets.left = computed::LengthOrPercentageOrAuto::Auto;
|
position.left = computed::LengthOrPercentageOrAuto::Auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
if style.padding.padding_top != computed::LengthOrPercentage::Length(Au(0)) ||
|
if style.padding.padding_top != computed::LengthOrPercentage::Length(Au(0)) ||
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue