mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Resolve cyclic margin and padding percentages against zero (#30085)
From https://drafts.csswg.org/css-sizing-3/#min-percentage-contribution > For the min size properties, as well as for margins and paddings > (and gutters), a cyclic percentage is resolved against zero > for determining intrinsic size contributions.
This commit is contained in:
parent
8dceb8e412
commit
c264993da8
5 changed files with 31 additions and 79 deletions
|
@ -17,7 +17,7 @@ use servo_arc::Arc;
|
|||
use std::convert::TryInto;
|
||||
use style::logical_geometry::WritingMode;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{Length, Percentage};
|
||||
use style::values::computed::Length;
|
||||
use style::values::specified::text::TextDecorationLine;
|
||||
|
||||
/// https://drafts.csswg.org/css-display/#independent-formatting-context
|
||||
|
@ -151,25 +151,12 @@ impl IndependentFormattingContext {
|
|||
layout_context: &LayoutContext,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
) -> ContentSizes {
|
||||
let (mut outer, percentages) = self.outer_inline_content_sizes_and_percentages(
|
||||
layout_context,
|
||||
containing_block_writing_mode,
|
||||
);
|
||||
outer.adjust_for_pbm_percentages(percentages);
|
||||
outer
|
||||
}
|
||||
|
||||
pub fn outer_inline_content_sizes_and_percentages(
|
||||
&mut self,
|
||||
layout_context: &LayoutContext,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
) -> (ContentSizes, Percentage) {
|
||||
match self {
|
||||
Self::NonReplaced(non_replaced) => {
|
||||
let style = &non_replaced.style;
|
||||
let content_sizes = &mut non_replaced.content_sizes;
|
||||
let contents = &non_replaced.contents;
|
||||
sizing::outer_inline_and_percentages(&style, containing_block_writing_mode, || {
|
||||
sizing::outer_inline(&style, containing_block_writing_mode, || {
|
||||
content_sizes
|
||||
.get_or_insert_with(|| {
|
||||
contents.inline_content_sizes(layout_context, style.writing_mode)
|
||||
|
@ -177,11 +164,11 @@ impl IndependentFormattingContext {
|
|||
.clone()
|
||||
})
|
||||
},
|
||||
Self::Replaced(replaced) => sizing::outer_inline_and_percentages(
|
||||
&replaced.style,
|
||||
containing_block_writing_mode,
|
||||
|| replaced.contents.inline_content_sizes(&replaced.style),
|
||||
),
|
||||
Self::Replaced(replaced) => {
|
||||
sizing::outer_inline(&replaced.style, containing_block_writing_mode, || {
|
||||
replaced.contents.inline_content_sizes(&replaced.style)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue