Commit 9f796586 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[SPv175] Fix remote frame printing when the containing frame is scrolled

Similar to https://chromium-review.googlesource.com/961861, we should
also apply paint offset with a transform operation during painting.

The added tests don't work with --site-per-process yet because of
crbug.com/822372.

Bug: 821486
Change-Id: I83f2fd7cb1d71e2639b9c37a4e139cf274be422d
Reviewed-on: https://chromium-review.googlesource.com/964728Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543791}
parent 5d4b9370
......@@ -132,6 +132,10 @@ Bug(none) external/wpt/html/infrastructure/safe-passing-of-structured-data/share
Bug(none) virtual/sharedarraybuffer/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-domain-success.sub.html [ Skip ]
Bug(none) virtual/sharedarraybuffer/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-similar-but-cross-origin-success.sub.html [ Skip ]
# Layout tests don't work for printing cross-site frames.
crbug.com/822372 http/tests/printing/cross-site-frame.html [ Crash ]
crbug.com/822372 http/tests/printing/cross-site-frame-scrolled.html [ Crash ]
# TODO(lukasza, alexmos): Triage these failures.
Bug(none) external/wpt/html/browsers/browsing-the-web/navigating-across-documents/004.html [ Timeout ]
......
<!DOCTYPE html>
<script>
if (window.testRunner)
testRunner.setPrinting();
</script>
<iframe srcdoc="<!DOCTYPE html>Subframe"></iframe>
<!DOCTYPE html>
<style>
::-webkit-scrollbar { display: none }
</style>
<script>
if (window.testRunner)
testRunner.setPrinting();
</script>
<iframe style="position: absolute; top: 200px; left: 200px"
srcdoc="<!DOCTYPE html>Subframe"></iframe>
<div style="height: 3000px"></div>
<!DOCTYPE html>
<style>
::-webkit-scrollbar { display: none }
</style>
<script>
if (window.testRunner)
testRunner.setPrinting();
onload = function() {
window.scrollBy(0, 150);
};
</script>
<iframe style="position: absolute; top: 200px; left: 200px"
src="http://localhost:8080/printing/resources/subframe.html"></iframe>
<div style="height: 3000px"></div>
<!DOCTYPE html>
<script>
if (window.testRunner)
testRunner.setPrinting();
</script>
<iframe src="http://localhost:8080/printing/resources/subframe.html"></iframe>
......@@ -163,8 +163,6 @@ void RemoteFrameView::Paint(GraphicsContext& context,
const GlobalPaintFlags flags,
const CullRect& rect,
const IntSize& paint_offset) const {
// TODO(wangxianzhu): Should we consider |paint_offset| for SPv175?
// Painting remote frames is only for printing.
if (!context.Printing())
return;
......@@ -174,12 +172,16 @@ void RemoteFrameView::Paint(GraphicsContext& context,
DrawingRecorder recorder(context, *GetFrame().OwnerLayoutObject(),
DisplayItem::kDocumentBackground);
context.Save();
context.Translate(paint_offset.Width(), paint_offset.Height());
DCHECK(context.Canvas());
// Inform the remote frame to print.
uint32_t content_id = Print(FrameRect(), context.Canvas());
// Record the place holder id on canvas.
context.Canvas()->recordCustomData(content_id);
context.Restore();
}
void RemoteFrameView::UpdateGeometry() {
......
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