Commit f0fa2b49 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Fall back to legacy layout for frameset documents.

This is done so that we don't need to switch the layout tree over to
legacy when entering printing, since that would cause some sort of state
loss, leaving the frames blank. The exact root cause is unknown. I spent
some time investigating it, but couldn't see what was wrong.

It really doesn't matter that much, though, since the only element in
the frameset document that would be an NG object would be the HTML root
element. We don't have NG-specific frame or frameset layout objects.
The frames themselves will still use LayoutNG (unless prevented by
something else), of course.

Bug: 1003815
Change-Id: Ic4dc470f5536ea8357ebccb624d43e9f30155728
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1875747Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708919}
parent d48e007b
...@@ -333,6 +333,16 @@ bool CalculateStyleShouldForceLegacyLayout(const Element& element, ...@@ -333,6 +333,16 @@ bool CalculateStyleShouldForceLegacyLayout(const Element& element,
return true; return true;
if (document.Printing() && element == document.documentElement()) if (document.Printing() && element == document.documentElement())
return true; return true;
// Fall back to legacy layout for frameset documents. The frameset itself
// (and the frames) can only create legacy layout objects anyway (no NG
// counterpart for them yet). However, the layout object for the HTML root
// element would be an NG one. If we'd then print the document, we'd fall
// back to legacy layout (because of the above check), which would re-attach
// all layout objects, which would cause the frameset to lose state of some
// sort, leaving everything blank when printed.
if (document.IsFrameSet())
return true;
} }
// 'text-combine-upright' property is not supported yet. // 'text-combine-upright' property is not supported yet.
......
<!DOCTYPE html>
<script>
if (window.testRunner)
testRunner.setPrinting();
</script>
PASS
<!DOCTYPE html>
<script>
if (window.testRunner)
testRunner.setPrinting();
</script>
<frameset>
<frame src="resources/pass.html"></frame>
</frameset>
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