mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
style: Fix servo build.
This also fixes a bunch of calc handling issues and such. Also remove tests that no longer compile and are covered by WPT.
This commit is contained in:
parent
ca503b4908
commit
4a31509215
17 changed files with 199 additions and 436 deletions
|
@ -66,8 +66,7 @@ use style::context::SharedStyleContext;
|
|||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone};
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
|
||||
/// Information specific to floated blocks.
|
||||
#[derive(Clone, Serialize)]
|
||||
|
@ -418,42 +417,23 @@ impl CandidateBSizeIterator {
|
|||
// If that is not determined yet by the time we need to resolve
|
||||
// `min-height` and `max-height`, percentage values are ignored.
|
||||
|
||||
let block_size = match (
|
||||
fragment.style.content_block_size(),
|
||||
block_container_block_size,
|
||||
) {
|
||||
(LengthOrPercentageOrAuto::Percentage(percent), Some(block_container_block_size)) => {
|
||||
MaybeAuto::Specified(block_container_block_size.scale_by(percent.0))
|
||||
let block_size = match fragment.style.content_block_size() {
|
||||
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
||||
MaybeAuto::from_option(lp.maybe_to_used_value(block_container_block_size))
|
||||
},
|
||||
(LengthOrPercentageOrAuto::Calc(calc), _) => {
|
||||
MaybeAuto::from_option(calc.to_used_value(block_container_block_size))
|
||||
},
|
||||
(LengthOrPercentageOrAuto::Percentage(_), None) |
|
||||
(LengthOrPercentageOrAuto::Auto, _) => MaybeAuto::Auto,
|
||||
(LengthOrPercentageOrAuto::Length(length), _) => MaybeAuto::Specified(Au::from(length)),
|
||||
};
|
||||
let max_block_size = match (fragment.style.max_block_size(), block_container_block_size) {
|
||||
(LengthOrPercentageOrNone::Percentage(percent), Some(block_container_block_size)) => {
|
||||
Some(block_container_block_size.scale_by(percent.0))
|
||||
|
||||
let max_block_size = match fragment.style.max_block_size() {
|
||||
LengthOrPercentageOrNone::None => None,
|
||||
LengthOrPercentageOrNone::LengthOrPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(block_container_block_size)
|
||||
},
|
||||
(LengthOrPercentageOrNone::Calc(calc), _) => {
|
||||
calc.to_used_value(block_container_block_size)
|
||||
},
|
||||
(LengthOrPercentageOrNone::Percentage(_), None) |
|
||||
(LengthOrPercentageOrNone::None, _) => None,
|
||||
(LengthOrPercentageOrNone::Length(length), _) => Some(Au::from(length)),
|
||||
};
|
||||
let min_block_size = match (fragment.style.min_block_size(), block_container_block_size) {
|
||||
(LengthOrPercentage::Percentage(percent), Some(block_container_block_size)) => {
|
||||
block_container_block_size.scale_by(percent.0)
|
||||
},
|
||||
(LengthOrPercentage::Calc(calc), _) => calc
|
||||
.to_used_value(block_container_block_size)
|
||||
.unwrap_or(Au(0)),
|
||||
(LengthOrPercentage::Percentage(_), None) => Au(0),
|
||||
(LengthOrPercentage::Length(length), _) => Au::from(length),
|
||||
};
|
||||
|
||||
let min_block_size =
|
||||
fragment.style.min_block_size().maybe_to_used_value(block_container_block_size).unwrap_or(Au(0));
|
||||
|
||||
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
||||
let adjustment_for_box_sizing = match fragment.style.get_position().box_sizing {
|
||||
BoxSizing::BorderBox => fragment.border_padding.block_start_end(),
|
||||
|
@ -1415,15 +1395,9 @@ impl BlockFlow {
|
|||
pub fn explicit_block_size(&self, containing_block_size: Option<Au>) -> Option<Au> {
|
||||
let content_block_size = self.fragment.style().content_block_size();
|
||||
|
||||
match (content_block_size, containing_block_size) {
|
||||
(LengthOrPercentageOrAuto::Calc(calc), _) => calc.to_used_value(containing_block_size),
|
||||
(LengthOrPercentageOrAuto::Length(length), _) => Some(Au::from(length)),
|
||||
(LengthOrPercentageOrAuto::Percentage(percent), Some(container_size)) => {
|
||||
Some(container_size.scale_by(percent.0))
|
||||
},
|
||||
(LengthOrPercentageOrAuto::Percentage(_), None) |
|
||||
(LengthOrPercentageOrAuto::Auto, None) => None,
|
||||
(LengthOrPercentageOrAuto::Auto, Some(container_size)) => {
|
||||
match content_block_size {
|
||||
LengthOrPercentageOrAuto::Auto => {
|
||||
let container_size = containing_block_size?;
|
||||
let (block_start, block_end) = {
|
||||
let position = self.fragment.style().logical_position();
|
||||
(
|
||||
|
@ -1454,10 +1428,12 @@ impl BlockFlow {
|
|||
let sum = block_start + block_end + margin_block_start + margin_block_end;
|
||||
Some(available_block_size - sum)
|
||||
},
|
||||
|
||||
(_, _) => None,
|
||||
}
|
||||
},
|
||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(containing_block_size)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2177,8 +2153,8 @@ impl Flow for BlockFlow {
|
|||
// If this block has a fixed width, just use that for the minimum and preferred width,
|
||||
// rather than bubbling up children inline width.
|
||||
let consult_children = match self.fragment.style().get_position().width {
|
||||
LengthOrPercentageOrAuto::Length(_) => false,
|
||||
_ => true,
|
||||
LengthOrPercentageOrAuto::Auto => true,
|
||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lp) => lp.maybe_to_used_value(None).is_none(),
|
||||
};
|
||||
self.bubble_inline_sizes_for_block(consult_children);
|
||||
self.fragment
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue