diff --git a/weasyprint/formatting_structure/build.py b/weasyprint/formatting_structure/build.py index e3a825e3d..b247eb195 100644 --- a/weasyprint/formatting_structure/build.py +++ b/weasyprint/formatting_structure/build.py @@ -11,6 +11,8 @@ from ..css import computed_values, properties, targets from ..logger import LOGGER from . import boxes +from ..layout.table import collapse_table_borders + # Maps values of the ``display`` CSS property to box types. BOX_TYPE_FROM_DISPLAY = { @@ -977,6 +979,7 @@ def wrap_table(box, children): if table.style['border_collapse'] == 'collapse': table.grid_width = grid_width table.grid_height = grid_height + table.collapsed_border_grid = collapse_table_borders(table) if isinstance(box, boxes.InlineTableBox): wrapper_type = boxes.InlineBlockBox diff --git a/weasyprint/layout/table.py b/weasyprint/layout/table.py index 456dbf637..4b08547d0 100644 --- a/weasyprint/layout/table.py +++ b/weasyprint/layout/table.py @@ -812,9 +812,6 @@ def auto_table_layout(context, box, containing_block): def table_wrapper_width(context, wrapper, containing_block): """Find the width of each column and derive the wrapper width.""" table = wrapper.get_wrapped_table() - collapse = table.style['border_collapse'] == 'collapse' - if collapse: - table.collapsed_border_grid = collapse_table_borders(table) resolve_percentages(table, containing_block) if table.style['table_layout'] == 'fixed' and table.width != 'auto':