Commit 23f8011b authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNGFragmentPaint] Fixes background painting for table-cells.

This fixes the painting of table-cell backgrounds to paint in the
appropriate rect.

As the position of the table cells aren't sub-pixel aware (yet) we were
painting the background with the incorrect size, resulting in a the
table background bleeding through.

I suspect TablesNG won't have this issue (and won't need to use this
alternate constructor) as their position should be sub-pixel aware.

Bug: 988015
Change-Id: I4135070608f958a71aa7a843c4e11904323125bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1896049
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711988}
parent 6678950a
......@@ -641,6 +641,10 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackground(
} else {
paint_rect.offset = paint_offset;
paint_rect.size = box_fragment_.Size();
if (layout_object.IsTableCell()) {
paint_rect.size =
PhysicalSize(To<LayoutTableCell>(layout_object).PixelSnappedSize());
}
background_client = &GetDisplayItemClient();
}
......@@ -849,15 +853,14 @@ void NGBoxFragmentPainter::PaintBackground(
const PhysicalRect& paint_rect,
const Color& background_color,
BackgroundBleedAvoidance bleed_avoidance) {
const LayoutObject& layout_object = *box_fragment_.GetLayoutObject();
const LayoutBox& layout_box = ToLayoutBox(layout_object);
const LayoutBox& layout_box = ToLayoutBox(*box_fragment_.GetLayoutObject());
if (layout_box.BackgroundTransfersToView())
return;
if (layout_box.BackgroundIsKnownToBeObscured())
return;
// TODO(eae): Switch to LayoutNG version of BackgroundImageGeometry.
BackgroundImageGeometry geometry(*static_cast<const LayoutBoxModelObject*>(
box_fragment_.GetLayoutObject()));
BackgroundImageGeometry geometry(layout_box);
PaintFillLayers(paint_info, background_color,
box_fragment_.Style().BackgroundLayers(), paint_rect,
geometry, bleed_avoidance);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment