Servo build fixes.

This commit is contained in:
Emilio Cobos Álvarez 2019-12-15 22:12:10 +01:00
parent c1c2b746c8
commit 7d30a7da75
18 changed files with 118 additions and 117 deletions

View file

@ -61,10 +61,9 @@ use style::selector_parser::RestyleDamage;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::str::char_is_whitespace;
use style::values::computed::counters::ContentItem;
use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, Size, VerticalAlign};
use style::values::computed::{Size, VerticalAlign};
use style::values::generics::box_::{Perspective, VerticalAlignKeyword};
use style::values::generics::transform;
use style::Zero;
use webrender_api;
use webrender_api::units::LayoutTransform;
@ -1329,13 +1328,17 @@ impl Fragment {
return;
},
_ => {
let margin = self.style().logical_margin();
self.margin.inline_start =
MaybeAuto::from_style(margin.inline_start, containing_block_inline_size)
.specified_or_zero();
self.margin.inline_end =
MaybeAuto::from_style(margin.inline_end, containing_block_inline_size)
.specified_or_zero();
let (inline_start, inline_end) = {
let margin = self.style().logical_margin();
(
MaybeAuto::from_style(margin.inline_start, containing_block_inline_size)
.specified_or_zero(),
MaybeAuto::from_style(margin.inline_end, containing_block_inline_size)
.specified_or_zero(),
)
};
self.margin.inline_start = inline_start;
self.margin.inline_end = inline_end;
},
}
@ -1384,13 +1387,17 @@ impl Fragment {
_ => {
// NB: Percentages are relative to containing block inline-size (not block-size)
// per CSS 2.1.
let margin = self.style().logical_margin();
self.margin.block_start =
MaybeAuto::from_style(margin.block_start, containing_block_inline_size)
.specified_or_zero();
self.margin.block_end =
MaybeAuto::from_style(margin.block_end, containing_block_inline_size)
.specified_or_zero();
let (block_start, block_end) = {
let margin = self.style().logical_margin();
(
MaybeAuto::from_style(margin.block_start, containing_block_inline_size)
.specified_or_zero(),
MaybeAuto::from_style(margin.block_end, containing_block_inline_size)
.specified_or_zero(),
)
};
self.margin.block_start = block_start;
self.margin.block_end = block_end;
},
}
}
@ -1458,14 +1465,14 @@ impl Fragment {
pub fn relative_position(&self, containing_block_size: &LogicalSize<Au>) -> LogicalSize<Au> {
fn from_style(style: &ComputedValues, container_size: &LogicalSize<Au>) -> LogicalSize<Au> {
let offsets = style.logical_position();
let offset_i = if offsets.inline_start != LengthPercentageOrAuto::Auto {
let offset_i = if !offsets.inline_start.is_auto() {
MaybeAuto::from_style(offsets.inline_start, container_size.inline)
.specified_or_zero()
} else {
-MaybeAuto::from_style(offsets.inline_end, container_size.inline)
.specified_or_zero()
};
let offset_b = if offsets.block_start != LengthPercentageOrAuto::Auto {
let offset_b = if !offsets.block_start.is_auto() {
MaybeAuto::from_style(offsets.block_start, container_size.block).specified_or_zero()
} else {
-MaybeAuto::from_style(offsets.block_end, container_size.block).specified_or_zero()
@ -2520,14 +2527,10 @@ impl Fragment {
{
continue;
}
if inline_context_node.style.logical_margin().inline_end !=
LengthPercentageOrAuto::zero()
{
if !inline_context_node.style.logical_margin().inline_end.is_definitely_zero() {
return false;
}
if inline_context_node.style.logical_padding().inline_end !=
LengthPercentage::zero()
{
if !inline_context_node.style.logical_padding().inline_end.is_definitely_zero() {
return false;
}
if inline_context_node.style.logical_border_width().inline_end != Au(0) {
@ -2546,14 +2549,10 @@ impl Fragment {
{
continue;
}
if inline_context_node.style.logical_margin().inline_start !=
LengthPercentageOrAuto::zero()
{
if !inline_context_node.style.logical_margin().inline_start.is_definitely_zero() {
return false;
}
if inline_context_node.style.logical_padding().inline_start !=
LengthPercentage::zero()
{
if !inline_context_node.style.logical_padding().inline_start.is_definitely_zero() {
return false;
}
if inline_context_node
@ -3193,7 +3192,7 @@ impl Fragment {
) -> Option<LayoutTransform> {
match self.style().get_box().perspective {
Perspective::Length(length) => {
let perspective_origin = self.style().get_box().perspective_origin;
let perspective_origin = &self.style().get_box().perspective_origin;
let perspective_origin = Point2D::new(
perspective_origin
.horizontal