Printing: Correct media query evaluation for subframes.

Only the top frame be treated specially.

Bug: 1491643
Change-Id: Ic6cb37ca90f429aaef1bae96e93a1883720f3946
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4934530
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1209086}
diff --git a/css/printing/media-queries-002-print.html b/css/printing/media-queries-002-print.html
new file mode 100644
index 0000000..5f71f3d
--- /dev/null
+++ b/css/printing/media-queries-002-print.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1491643">
+<link rel="match" href="reference/filled-green-100px-square-print-ref.html">
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<iframe src="resources/mq-frame-100px.html" style="display:block; border:none; width:100px; height:100px; background:red;"></iframe>
diff --git a/css/printing/media-queries-003-print-ref.html b/css/printing/media-queries-003-print-ref.html
new file mode 100644
index 0000000..99642ca
--- /dev/null
+++ b/css/printing/media-queries-003-print-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<style>
+  body { margin-right: 108px; }
+</style>
+<div style="position:absolute; right:0; bottom:0; width:100px; height:100px; background:green;"></div>
+There should be a green square in the bottom right corner.
diff --git a/css/printing/media-queries-003-print.html b/css/printing/media-queries-003-print.html
new file mode 100644
index 0000000..2c12529
--- /dev/null
+++ b/css/printing/media-queries-003-print.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1491643">
+<link rel="match" href="media-queries-003-print-ref.html">
+<frameset cols="*,100" rows="*,100" frameborder="0">
+  <frame src="data:text/html,There should be a green square in the bottom right corner."></frame>
+  <frame src="data:text/html,"></frame>
+  <frame src="data:text/html,"></frame>
+  <frame src="resources/mq-frame-100px.html"></frame>
+</frameset>
diff --git a/css/printing/reference/filled-green-100px-square-print-ref.html b/css/printing/reference/filled-green-100px-square-print-ref.html
new file mode 100644
index 0000000..d4834d1
--- /dev/null
+++ b/css/printing/reference/filled-green-100px-square-print-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="width:100px; height:100px; background:green;"></div>
diff --git a/css/printing/resources/mq-frame-100px.html b/css/printing/resources/mq-frame-100px.html
new file mode 100644
index 0000000..ed823c0
--- /dev/null
+++ b/css/printing/resources/mq-frame-100px.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<style>
+body {
+  margin: 0;
+}
+div {
+  background: red;
+}
+@media (width: 100px) and (height: 100px) {
+  div {
+    background: green;
+  }
+}
+</style>
+<div style="height:100px;"></div>