mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Move width and height from Box to Position.
This helps with style struct alignment between Servo and Gecko.
This commit is contained in:
parent
2c69278067
commit
550d780e17
7 changed files with 25 additions and 25 deletions
|
@ -1654,7 +1654,7 @@ impl Flow for BlockFlow {
|
||||||
fn bubble_inline_sizes(&mut self) {
|
fn bubble_inline_sizes(&mut self) {
|
||||||
// If this block has a fixed width, just use that for the minimum and preferred width,
|
// If this block has a fixed width, just use that for the minimum and preferred width,
|
||||||
// rather than bubbling up children inline width.
|
// rather than bubbling up children inline width.
|
||||||
let consult_children = match self.fragment.style().get_box().width {
|
let consult_children = match self.fragment.style().get_position().width {
|
||||||
LengthOrPercentageOrAuto::Length(_) => false,
|
LengthOrPercentageOrAuto::Length(_) => false,
|
||||||
_ => true,
|
_ => true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl FlexFlow {
|
||||||
// Currently, this is the core of BlockFlow::bubble_inline_sizes() with all float logic
|
// Currently, this is the core of BlockFlow::bubble_inline_sizes() with all float logic
|
||||||
// stripped out, and max replaced with union_nonbreaking_inline.
|
// stripped out, and max replaced with union_nonbreaking_inline.
|
||||||
fn inline_mode_bubble_inline_sizes(&mut self) {
|
fn inline_mode_bubble_inline_sizes(&mut self) {
|
||||||
let fixed_width = match self.block_flow.fragment.style().get_box().width {
|
let fixed_width = match self.block_flow.fragment.style().get_position().width {
|
||||||
LengthOrPercentageOrAuto::Length(_) => true,
|
LengthOrPercentageOrAuto::Length(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
@ -151,7 +151,7 @@ impl FlexFlow {
|
||||||
// Currently, this is the core of BlockFlow::bubble_inline_sizes() with all float logic
|
// Currently, this is the core of BlockFlow::bubble_inline_sizes() with all float logic
|
||||||
// stripped out.
|
// stripped out.
|
||||||
fn block_mode_bubble_inline_sizes(&mut self) {
|
fn block_mode_bubble_inline_sizes(&mut self) {
|
||||||
let fixed_width = match self.block_flow.fragment.style().get_box().width {
|
let fixed_width = match self.block_flow.fragment.style().get_position().width {
|
||||||
LengthOrPercentageOrAuto::Length(_) => true,
|
LengthOrPercentageOrAuto::Length(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
@ -398,9 +398,9 @@ impl Flow for FlexFlow {
|
||||||
let (available_block_size, available_inline_size) = {
|
let (available_block_size, available_inline_size) = {
|
||||||
let style = &self.block_flow.fragment.style;
|
let style = &self.block_flow.fragment.style;
|
||||||
let (specified_block_size, specified_inline_size) = if style.writing_mode.is_vertical() {
|
let (specified_block_size, specified_inline_size) = if style.writing_mode.is_vertical() {
|
||||||
(style.get_box().width, style.get_box().height)
|
(style.get_position().width, style.get_position().height)
|
||||||
} else {
|
} else {
|
||||||
(style.get_box().height, style.get_box().width)
|
(style.get_position().height, style.get_position().width)
|
||||||
};
|
};
|
||||||
|
|
||||||
let available_inline_size = AxisSize::new(specified_inline_size,
|
let available_inline_size = AxisSize::new(specified_inline_size,
|
||||||
|
|
|
@ -211,7 +211,7 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
|
||||||
get_margin.margin_bottom, get_margin.margin_left,
|
get_margin.margin_bottom, get_margin.margin_left,
|
||||||
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_position.width, get_position.height,
|
||||||
get_inheritedtext.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,
|
||||||
|
|
|
@ -158,7 +158,7 @@ impl PropertyAnimation {
|
||||||
[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_position; height],
|
||||||
[Left; get_position; left],
|
[Left; get_position; left],
|
||||||
[LineHeight; get_inheritedtext; line_height],
|
[LineHeight; get_inheritedtext; line_height],
|
||||||
[MarginBottom; get_margin; margin_bottom],
|
[MarginBottom; get_margin; margin_bottom],
|
||||||
|
@ -181,7 +181,7 @@ impl PropertyAnimation {
|
||||||
[Top; get_position; 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_position; width],
|
||||||
[ZIndex; get_position; z_index]);
|
[ZIndex; get_position; z_index]);
|
||||||
|
|
||||||
let property_animation = PropertyAnimation {
|
let property_animation = PropertyAnimation {
|
||||||
|
@ -256,7 +256,7 @@ impl PropertyAnimation {
|
||||||
[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_position; height],
|
||||||
[Left; mutate_position; left],
|
[Left; mutate_position; left],
|
||||||
[LineHeight; mutate_inheritedtext; line_height],
|
[LineHeight; mutate_inheritedtext; line_height],
|
||||||
[MarginBottom; mutate_margin; margin_bottom],
|
[MarginBottom; mutate_margin; margin_bottom],
|
||||||
|
@ -281,7 +281,7 @@ impl PropertyAnimation {
|
||||||
[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_position; width],
|
||||||
[ZIndex; mutate_position; z_index]);
|
[ZIndex; mutate_position; z_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,16 +122,6 @@ ${helpers.single_keyword("clear", "none left right both", gecko_ffi_name="mBreak
|
||||||
|
|
||||||
</%helpers:longhand>
|
</%helpers:longhand>
|
||||||
|
|
||||||
${helpers.predefined_type("width",
|
|
||||||
"LengthOrPercentageOrAuto",
|
|
||||||
"computed::LengthOrPercentageOrAuto::Auto",
|
|
||||||
"parse_non_negative")}
|
|
||||||
|
|
||||||
${helpers.predefined_type("height",
|
|
||||||
"LengthOrPercentageOrAuto",
|
|
||||||
"computed::LengthOrPercentageOrAuto::Auto",
|
|
||||||
"parse_non_negative")}
|
|
||||||
|
|
||||||
<%helpers:longhand name="vertical-align">
|
<%helpers:longhand name="vertical-align">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
|
@ -96,6 +96,16 @@ ${helpers.predefined_type("flex-basis",
|
||||||
|
|
||||||
${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", products="gecko")}
|
${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", products="gecko")}
|
||||||
|
|
||||||
|
${helpers.predefined_type("width",
|
||||||
|
"LengthOrPercentageOrAuto",
|
||||||
|
"computed::LengthOrPercentageOrAuto::Auto",
|
||||||
|
"parse_non_negative")}
|
||||||
|
|
||||||
|
${helpers.predefined_type("height",
|
||||||
|
"LengthOrPercentageOrAuto",
|
||||||
|
"computed::LengthOrPercentageOrAuto::Auto",
|
||||||
|
"parse_non_negative")}
|
||||||
|
|
||||||
${helpers.predefined_type("min-width",
|
${helpers.predefined_type("min-width",
|
||||||
"LengthOrPercentage",
|
"LengthOrPercentage",
|
||||||
"computed::LengthOrPercentage::Length(Au(0))",
|
"computed::LengthOrPercentage::Length(Au(0))",
|
||||||
|
|
|
@ -972,18 +972,18 @@ impl ServoComputedValues {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn content_inline_size(&self) -> computed::LengthOrPercentageOrAuto {
|
pub fn content_inline_size(&self) -> computed::LengthOrPercentageOrAuto {
|
||||||
let box_style = self.get_box();
|
let position_style = self.get_position();
|
||||||
if self.writing_mode.is_vertical() {
|
if self.writing_mode.is_vertical() {
|
||||||
box_style.height
|
position_style.height
|
||||||
} else {
|
} else {
|
||||||
box_style.width
|
position_style.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn content_block_size(&self) -> computed::LengthOrPercentageOrAuto {
|
pub fn content_block_size(&self) -> computed::LengthOrPercentageOrAuto {
|
||||||
let box_style = self.get_box();
|
let position_style = self.get_position();
|
||||||
if self.writing_mode.is_vertical() { box_style.width } else { box_style.height }
|
if self.writing_mode.is_vertical() { position_style.width } else { position_style.height }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue