Commit b5920e0c authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Fix blink_unittests with LayoutNGFragmentPaint enabled.

These failures were primarily due to some missing logic within the
NGBoxFragmentPainter for CAP.

See:
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8899518345262305936/+/steps/webkit_unit_tests__with_patch_/0/logs/Deterministic_failure:_All__x2f_BoxPainterScrollHitTestTest.ScrollHitTestOrderWithLocalBackgroundAttachment__x2f_1__status_FAILURE_/0
... as an example of the failure.

The additional CAP failure, also fails in the same way with:
--blink-enable-features=CompositeAfterPaint --disable-blink-features=LayoutNG

The code was effectively just lifted from BlockPainter.

Bug: 988015
Change-Id: I8cf273e552b2e84246eef69910c8abace9a485b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869676Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709642}
parent 1b4faad9
......@@ -238,7 +238,28 @@ void NGBoxFragmentPainter::PaintInternal(const PaintInfo& paint_info) {
info.phase = PaintPhase::kDescendantOutlinesOnly;
} else if (ShouldPaintSelfBlockBackground(original_phase)) {
info.phase = PaintPhase::kSelfBlockBackgroundOnly;
PaintObject(info, paint_offset);
// With CompositeAfterPaint we need to call PaintObject twice: once for the
// background painting that does not scroll, and a second time for the
// background painting that scrolls.
// Without CompositeAfterPaint, this happens as the main graphics layer
// paints the background, and then the scrolling contents graphics layer
// paints the background.
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
auto paint_location = ToLayoutBox(*box_fragment_.GetLayoutObject())
.GetBackgroundPaintLocation();
if (!(paint_location & kBackgroundPaintInGraphicsLayer))
info.SetSkipsBackground(true);
PaintObject(info, paint_offset);
info.SetSkipsBackground(false);
if (paint_location & kBackgroundPaintInScrollingContents) {
info.SetIsPaintingScrollingBackground(true);
PaintObject(info, paint_offset);
info.SetIsPaintingScrollingBackground(false);
}
} else {
PaintObject(info, paint_offset);
}
if (ShouldPaintDescendantBlockBackgrounds(original_phase))
info.phase = PaintPhase::kDescendantBlockBackgroundsOnly;
}
......@@ -1213,6 +1234,9 @@ void NGBoxFragmentPainter::PaintAtomicInline(const PaintInfo& paint_info) {
bool NGBoxFragmentPainter::IsPaintingScrollingBackground(
const PaintInfo& paint_info) {
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return paint_info.IsPaintingScrollingBackground();
// TODO(layout-dev): Change paint_info.PaintContainer to accept fragments
// once LayoutNG supports scrolling containers.
return paint_info.PaintFlags() & kPaintLayerPaintingOverflowContents &&
......
......@@ -177,6 +177,7 @@ Bug(none) paint/invalidation/compositing/should-not-repaint-composited-filter.ht
Bug(none) paint/invalidation/compositing/should-not-repaint-composited-opacity.html [ Failure ]
Bug(none) paint/invalidation/compositing/should-not-repaint-move-backface-hidden.html [ Failure ]
Bug(none) paint/invalidation/scroll/iframe-scroll-repaint.html [ Failure ]
Bug(none) paint/invalidation/scroll/repaint-composited-child-in-scrolled-container.html [ Failure ]
Bug(none) paint/invalidation/position/layout-state-only-positioned.html [ Failure ]
Bug(none) paint/invalidation/position/relative-positioned-movement-repaint.html [ Failure ]
......
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