Skip to content

Commit

Permalink
[LayoutNGFragmentPaint] Fixes background painting for table-cells.
Browse files Browse the repository at this point in the history
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: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711988}
  • Loading branch information
bfgeek authored and Commit Bot committed Nov 2, 2019
1 parent 6678950 commit 23f8011
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 23f8011

Please sign in to comment.