mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
layout: Set padding to zero on tables in collapsed-borders mode (#34908)
https://drafts.csswg.org/css2/#collapsing-borders > in this model, a table does not have padding https://drafts.csswg.org/css-tables/#collapsed-style-overrides > The padding of the table-root is ignored (as if it was set to 0px). Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
e75041d53f
commit
4f8dcfe6f9
7 changed files with 147 additions and 11 deletions
|
@ -343,7 +343,7 @@ impl<T: Copy> LogicalSides<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl LogicalSides<&'_ LengthPercentage> {
|
||||
impl LogicalSides<LengthPercentage> {
|
||||
pub fn percentages_relative_to(&self, basis: Au) -> LogicalSides<Au> {
|
||||
self.map(|value| value.to_used_value(basis))
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::computed_values::direction::T as Direction;
|
||||
use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode;
|
||||
use style::computed_values::position::T as ComputedPosition;
|
||||
|
@ -276,10 +277,8 @@ pub(crate) trait ComputedValuesExt {
|
|||
writing_mode: WritingMode,
|
||||
containing_block_inline_size: Au,
|
||||
) -> PaddingBorderMargin;
|
||||
fn padding(
|
||||
&self,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
) -> LogicalSides<&LengthPercentage>;
|
||||
fn padding(&self, containing_block_writing_mode: WritingMode)
|
||||
-> LogicalSides<LengthPercentage>;
|
||||
fn border_style(&self, containing_block_writing_mode: WritingMode)
|
||||
-> LogicalSides<BorderStyle>;
|
||||
fn border_width(&self, containing_block_writing_mode: WritingMode) -> LogicalSides<Au>;
|
||||
|
@ -579,14 +578,21 @@ impl ComputedValuesExt for ComputedValues {
|
|||
fn padding(
|
||||
&self,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
) -> LogicalSides<&LengthPercentage> {
|
||||
let padding = self.get_padding();
|
||||
) -> LogicalSides<LengthPercentage> {
|
||||
if self.get_box().display.inside() == stylo::DisplayInside::Table &&
|
||||
self.get_inherited_table().border_collapse == BorderCollapse::Collapse
|
||||
{
|
||||
// https://drafts.csswg.org/css-tables/#collapsed-style-overrides
|
||||
// > The padding of the table-root is ignored (as if it was set to 0px).
|
||||
return LogicalSides::zero();
|
||||
}
|
||||
let padding = self.get_padding().clone();
|
||||
LogicalSides::from_physical(
|
||||
&PhysicalSides::new(
|
||||
&padding.padding_top.0,
|
||||
&padding.padding_right.0,
|
||||
&padding.padding_bottom.0,
|
||||
&padding.padding_left.0,
|
||||
padding.padding_top.0,
|
||||
padding.padding_right.0,
|
||||
padding.padding_bottom.0,
|
||||
padding.padding_left.0,
|
||||
),
|
||||
containing_block_writing_mode,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue