diff options
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/block.rs | 4 | ||||
-rw-r--r-- | components/layout/inline.rs | 7 | ||||
-rw-r--r-- | components/layout/model.rs | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index adb48e3248f..399b3e5a9f4 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -340,6 +340,10 @@ impl CandidateBSizeIterator { (LengthOrPercentageOrNone::Percentage(percent), Some(block_container_block_size)) => { Some(block_container_block_size.scale_by(percent)) } + (LengthOrPercentageOrNone::Calc(calc), Some(block_container_block_size)) => { + Some(block_container_block_size.scale_by(calc.percentage()) + calc.length()) + } + (LengthOrPercentageOrNone::Calc(_), _) | (LengthOrPercentageOrNone::Percentage(_), None) | (LengthOrPercentageOrNone::None, _) => None, (LengthOrPercentageOrNone::Length(length), _) => Some(length), diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 5bd622871e1..8711881ffaf 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -27,6 +27,7 @@ use std::{fmt, isize, mem}; use style::computed_values::{display, overflow_x, position, text_align, text_justify}; use style::computed_values::{text_overflow, vertical_align, white_space}; use style::properties::ComputedValues; +use style::values::computed::LengthOrPercentage; use text; use unicode_bidi; use util; @@ -953,15 +954,15 @@ impl InlineFlow { offset_from_baseline = offset_from_baseline - *depth_below_baseline } }, - vertical_align::T::Length(length) => { + vertical_align::T::LengthOrPercentage(LengthOrPercentage::Length(length)) => { offset_from_baseline = offset_from_baseline - length } - vertical_align::T::Percentage(p) => { + vertical_align::T::LengthOrPercentage(LengthOrPercentage::Percentage(p)) => { let line_height = fragment.calculate_line_height(layout_context); let percent_offset = line_height.scale_by(p); offset_from_baseline = offset_from_baseline - percent_offset } - vertical_align::T::Calc(calc) => { + vertical_align::T::LengthOrPercentage(LengthOrPercentage::Calc(calc)) => { let line_height = fragment.calculate_line_height(layout_context); let percent_offset = line_height.scale_by(calc.percentage()); offset_from_baseline = offset_from_baseline - percent_offset - calc.length() diff --git a/components/layout/model.rs b/components/layout/model.rs index 8ee98a39678..f49ac51ad21 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -411,6 +411,8 @@ pub fn specified_or_none(length: LengthOrPercentageOrNone, containing_length: Au match length { LengthOrPercentageOrNone::None => None, LengthOrPercentageOrNone::Percentage(percent) => Some(containing_length.scale_by(percent)), + LengthOrPercentageOrNone::Calc(calc) => + Some(containing_length.scale_by(calc.percentage()) + calc.length()), LengthOrPercentageOrNone::Length(length) => Some(length), } } |