Browse Source

Table layout: Don't round during layout

This fixes an issue where the backgrounds and borders of table cells could overflow and be drawn on top of the border of the table container.
Michael Ragazzon 1 year ago
parent
commit
78515f3795

+ 1 - 2
Source/Core/Layout/TableFormattingContext.cpp

@@ -73,7 +73,6 @@ UniquePtr<LayoutBox> TableFormattingContext::Format(ContainerBox* parent_contain
 
 
 	context.table_content_offset = box.GetPosition();
 	context.table_content_offset = box.GetPosition();
 	context.table_initial_content_size = Vector2f(initial_content_size.x, Math::Max(0.0f, initial_content_size.y));
 	context.table_initial_content_size = Vector2f(initial_content_size.x, Math::Max(0.0f, initial_content_size.y));
-	Math::SnapToPixelGrid(context.table_content_offset, context.table_initial_content_size);
 
 
 	// When width or height is set, they act as minimum width or height, just as in CSS.
 	// When width or height is set, they act as minimum width or height, just as in CSS.
 	if (computed_table.width().type != Style::Width::Auto)
 	if (computed_table.width().type != Style::Width::Auto)
@@ -476,7 +475,7 @@ void TableFormattingContext::FormatCells(BoxList& cells, Vector2f& table_overflo
 		auto cell_box = FormattingContext::FormatIndependent(table_wrapper_box, element_cell, &box, FormattingContextType::Block);
 		auto cell_box = FormattingContext::FormatIndependent(table_wrapper_box, element_cell, &box, FormattingContextType::Block);
 		Vector2f cell_visible_overflow_size = cell_box->GetVisibleOverflowSize();
 		Vector2f cell_visible_overflow_size = cell_box->GetVisibleOverflowSize();
 
 
-		// Set the position of the element within the the table container
+		// Set the position of the element within the table container
 		element_cell->SetOffset(cell_offset, element_table);
 		element_cell->SetOffset(cell_offset, element_table);
 
 
 		// The table baseline is simply set to the first cell that has a baseline.
 		// The table baseline is simply set to the first cell that has a baseline.

+ 0 - 14
Source/Core/Layout/TableFormattingDetails.cpp

@@ -617,16 +617,6 @@ static float InitializeTrackBoxes(TrackBoxList& boxes, const TrackMetricList& me
 	return cursor;
 	return cursor;
 }
 }
 
 
-static void SnapTrackBoxesToPixelGrid(TrackBoxList& boxes)
-{
-	for (TrackBox& box : boxes)
-	{
-		Math::SnapToPixelGrid(box.cell_offset, box.cell_size);
-		Math::SnapToPixelGrid(box.track_offset, box.track_size);
-		Math::SnapToPixelGrid(box.group_offset, box.group_size);
-	}
-}
-
 float BuildColumnBoxes(TrackBoxList& column_boxes, const TrackMetricList& column_metrics, const TableGrid::ColumnList& grid_columns,
 float BuildColumnBoxes(TrackBoxList& column_boxes, const TrackMetricList& column_metrics, const TableGrid::ColumnList& grid_columns,
 	const float table_gap_x)
 	const float table_gap_x)
 {
 {
@@ -654,8 +644,6 @@ float BuildColumnBoxes(TrackBoxList& column_boxes, const TrackMetricList& column
 		}
 		}
 	}
 	}
 
 
-	SnapTrackBoxesToPixelGrid(column_boxes);
-
 	return columns_width;
 	return columns_width;
 }
 }
 
 
@@ -677,8 +665,6 @@ float BuildRowBoxes(TrackBoxList& row_boxes, const TrackMetricList& row_metrics,
 		}
 		}
 	}
 	}
 
 
-	SnapTrackBoxesToPixelGrid(row_boxes);
-
 	return rows_height;
 	return rows_height;
 }
 }