Commit 1160492e authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Fix NGBoxFragmentPainter to paint background of scrolling contents layer

The code to paint the background of scrolling contents layer
was missing in NGBoxFragmentPainter. This patch copies the
logic from BoxPainter.

Issue 861623 found that this code path runs when all of the
following conditions are true:
* In Chrome (not in content_shell).
* When display / CSS pixel >= 1.5.
* When background is set to 'overflow: auto' box.

This patch also fixes 3 CSS contain tests that has 'contain:
paint', 'overflow-[xy]: scroll', and background color to an
inline formatting context.

Bug: 861623
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I31d0b407e794409552dcf89f5c8005fafc5f99a6
Reviewed-on: https://chromium-review.googlesource.com/1215143Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589809}
parent fc8313e9
...@@ -206,9 +206,6 @@ crbug.com/591099 external/wpt/css/cssom/cssstyledeclaration-mutationrecord-001.h ...@@ -206,9 +206,6 @@ crbug.com/591099 external/wpt/css/cssom/cssstyledeclaration-mutationrecord-001.h
crbug.com/591099 external/wpt/css/selectors/selector-placeholder-shown-type-change-001.html [ Pass ] crbug.com/591099 external/wpt/css/selectors/selector-placeholder-shown-type-change-001.html [ Pass ]
crbug.com/591099 external/wpt/css/selectors/selector-read-write-type-change-002.html [ Pass ] crbug.com/591099 external/wpt/css/selectors/selector-read-write-type-change-002.html [ Pass ]
crbug.com/591099 external/wpt/css/selectors/selector-required-type-change-002.html [ Pass ] crbug.com/591099 external/wpt/css/selectors/selector-required-type-change-002.html [ Pass ]
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-paint-clip-003.html [ Failure ]
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-paint-clip-004.html [ Failure ]
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-paint-clip-005.html [ Failure ]
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-horiz-002.xhtml [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-horiz-002.xhtml [ Pass ]
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-writing-mode-011.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-writing-mode-011.html [ Pass ]
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-writing-mode-012.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-writing-mode-012.html [ Pass ]
......
...@@ -433,9 +433,36 @@ void NGBoxFragmentPainter::PaintMask(const PaintInfo& paint_info, ...@@ -433,9 +433,36 @@ void NGBoxFragmentPainter::PaintMask(const PaintInfo& paint_info,
void NGBoxFragmentPainter::PaintBoxDecorationBackground( void NGBoxFragmentPainter::PaintBoxDecorationBackground(
const PaintInfo& paint_info, const PaintInfo& paint_info,
const LayoutPoint& paint_offset) { const LayoutPoint& paint_offset) {
// TODO(mstensho): Break dependency on LayoutObject functionality.
const LayoutObject& layout_object = *box_fragment_.GetLayoutObject();
LayoutRect paint_rect; LayoutRect paint_rect;
if (!IsPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( base::Optional<ScopedPaintChunkProperties> scoped_scroll_property;
if (IsPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer(
box_fragment_, paint_info)) { box_fragment_, paint_info)) {
// For the case where we are painting the background into the scrolling
// contents layer of a composited scroller we need to include the entire
// overflow rect.
const LayoutBox& layout_box = ToLayoutBox(layout_object);
paint_rect = layout_box.PhysicalLayoutOverflowRect();
const auto* fragment = paint_info.FragmentToPaint(layout_box);
if (!fragment)
return;
scoped_scroll_property.emplace(
paint_info.context.GetPaintController(), fragment->ContentsProperties(),
layout_box, DisplayItem::PaintPhaseToScrollType(paint_info.phase));
// See comments for ScrollTranslation in object_paint_properties.h for the
// reason of moving by ScrollOrigin(). TODO(wangxianzhu): Encapsulate such
// logic at various places into one class.
paint_rect.MoveBy(layout_box.ScrollOrigin());
// The background painting code assumes that the borders are part of the
// paintRect so we expand the paintRect by the border size when painting the
// background into the scrolling contents layer.
paint_rect.Expand(layout_box.BorderBoxOutsets());
} else {
// TODO(eae): We need better converters for ng geometry types. Long term we // TODO(eae): We need better converters for ng geometry types. Long term we
// probably want to change the paint code to take NGPhysical* but that is a // probably want to change the paint code to take NGPhysical* but that is a
// much bigger change. // much bigger change.
...@@ -479,8 +506,6 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackground( ...@@ -479,8 +506,6 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackground(
// TODO(layout-dev): Support theme painting. // TODO(layout-dev): Support theme painting.
bool theme_painted = false; bool theme_painted = false;
// TODO(mstensho): Break dependency on LayoutObject functionality.
const LayoutObject& layout_object = *box_fragment_.GetLayoutObject();
bool should_paint_background = bool should_paint_background =
!theme_painted && !theme_painted &&
(!paint_info.SkipRootBackground() || (!paint_info.SkipRootBackground() ||
......
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