mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add support for 'padding-box' value for 'box-sizing' property (fixes #6032)
Spec: http://dev.w3.org/csswg/css-ui/#valdef-box-sizing-padding-box Currently, only Firefox is supporting this value.
This commit is contained in:
parent
b3b9deafa7
commit
945adabd48
6 changed files with 27 additions and 1 deletions
|
@ -346,8 +346,10 @@ impl CandidateBSizeIterator {
|
|||
};
|
||||
|
||||
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
||||
// If the style includes `box-sizing: padding-box`, subtract the border.
|
||||
let adjustment_for_box_sizing = match fragment.style.get_box().box_sizing {
|
||||
box_sizing::T::border_box => fragment.border_padding.block_start_end(),
|
||||
box_sizing::T::padding_box => fragment.padding_width().block_start_end(),
|
||||
box_sizing::T::content_box => Au(0),
|
||||
};
|
||||
|
||||
|
@ -2049,7 +2051,12 @@ pub trait ISizeAndMarginsComputer {
|
|||
computed_inline_size =
|
||||
MaybeAuto::Specified(size - block.fragment.border_padding.inline_start_end())
|
||||
}
|
||||
(MaybeAuto::Specified(size), box_sizing::T::padding_box) => {
|
||||
computed_inline_size =
|
||||
MaybeAuto::Specified(size - block.fragment.padding_width().inline_start_end())
|
||||
}
|
||||
(MaybeAuto::Auto, box_sizing::T::border_box) |
|
||||
(MaybeAuto::Auto, box_sizing::T::padding_box) |
|
||||
(_, box_sizing::T::content_box) => {}
|
||||
}
|
||||
|
||||
|
|
|
@ -999,6 +999,10 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn padding_width(&self) -> LogicalMargin<Au> {
|
||||
self.border_padding - self.border_width()
|
||||
}
|
||||
|
||||
/// Computes the margins in the inline direction from the containing block inline-size and the
|
||||
/// style. After this call, the inline direction of the `margin` field will be correct.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue