Commit 4ff76abc authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[CompositeAfterPaint] Fix HTML canvas printing

We should paint the canvas directly instead of recording a foreign
layer for an HTML canvas when we paint with composited layer flattened
(e.g. for printing).

Change-Id: I29bc6647cd3817e274f6d394e9b390fef211a70c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2251178Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780041}
parent 1ea2b734
......@@ -38,7 +38,10 @@ void HTMLCanvasPainter::PaintReplaced(const PaintInfo& paint_info,
auto* canvas = To<HTMLCanvasElement>(layout_html_canvas_.GetNode());
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
bool flatten_composited_layers =
paint_info.GetGlobalPaintFlags() & kGlobalPaintFlattenCompositingLayers;
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled() &&
!flatten_composited_layers) {
if (auto* layer = canvas->ContentsCcLayer()) {
IntRect pixel_snapped_rect = PixelSnappedIntRect(paint_rect);
layer->SetBounds(gfx::Size(pixel_snapped_rect.Size()));
......@@ -58,9 +61,7 @@ void HTMLCanvasPainter::PaintReplaced(const PaintInfo& paint_info,
DrawingRecorder recorder(context, layout_html_canvas_, paint_info.phase);
ScopedInterpolationQuality interpolation_quality_scope(
context, InterpolationQualityForCanvas(layout_html_canvas_.StyleRef()));
canvas->Paint(
context, paint_rect,
paint_info.GetGlobalPaintFlags() == kGlobalPaintFlattenCompositingLayers);
canvas->Paint(context, paint_rect, flatten_composited_layers);
}
} // namespace blink
......@@ -50,9 +50,6 @@ external/wpt/css/css-transforms/transform3d-backface-visibility-006.html [ Failu
printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages.html [ Failure ]
printing/fixed-positioned-headers-and-footers-larger-than-page.html [ Failure ]
printing/offscreencanvas-2d-printing.html [ Failure ]
printing/webgl-repeated-printing-preservedrawingbuffer.html [ Failure ]
printing/webgl-repeated-printing.html [ Failure ]
transforms/3d/general/background-visibility-layers.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