Bug 1443500 [wpt PR 9876] - Computed style inside iframe depends on parent layout., a=testonly

Automatic update from web-platform-testsComputed style inside iframe depends on parent layout.

Make sure we layout the parent document when it's dirty.

Bug: 819189
Change-Id: I3835aa913e20abdd4adaab072567191b3ca25c20
Reviewed-on: https://chromium-review.googlesource.com/951248
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542372}

wpt-commits: 412da2ce773bad16d42a7339962e2057a410617a
wpt-pr: 9876
wpt-commits: 412da2ce773bad16d42a7339962e2057a410617a
wpt-pr: 9876
This commit is contained in:
Rune Lillesveen 2018-04-09 14:33:43 +00:00 committed by James Graham
parent 50756bf6af
commit 049ba59acb
4 changed files with 96 additions and 0 deletions

View File

@ -318530,6 +318530,24 @@
{}
]
],
"css/cssom/computed-style-002.html": [
[
"/css/cssom/computed-style-002.html",
{}
]
],
"css/cssom/computed-style-003.html": [
[
"/css/cssom/computed-style-003.html",
{}
]
],
"css/cssom/computed-style-004.html": [
[
"/css/cssom/computed-style-004.html",
{}
]
],
"css/cssom/css-style-attr-decl-block.html": [
[
"/css/cssom/css-style-attr-decl-block.html",
@ -532375,6 +532393,18 @@
"0331a648e6b0d56f0e7365f1ff7d991ea77ce3e4",
"testharness"
],
"css/cssom/computed-style-002.html": [
"d6579788bcfaf1d4c09324ba877a26ff95d6965d",
"testharness"
],
"css/cssom/computed-style-003.html": [
"aece414b89e0fdea1030e4ca9011ab7d22f1b275",
"testharness"
],
"css/cssom/computed-style-004.html": [
"55010cf90dc7fc2ef8ec6cbd13d1ec947a823aed",
"testharness"
],
"css/cssom/css-style-attr-decl-block.html": [
"1d68a3fd1560308c0d2f3478864d84f4361e4ab9",
"testharness"

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>CSS Test: getComputedStyle - resolved width in iframe</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="frm" width="100"></iframe>
<script>
test(() => {
const frmDoc = frm.contentWindow.document;
frmDoc.open();
frmDoc.write('<body style="margin:0"><div style="width:100%"></div>');
frmDoc.close();
assert_equals(frm.contentWindow.getComputedStyle(frmDoc.querySelector("div")).width, "100px");
}, "Check that a percent width in an iframe is resolved against iframe width for getComputedStyle.");
</script>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>CSS Test: getComputedStyle - resolved width in iframe dynamic display</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="frm" width="100" style="display:none"></iframe>
<script>
const frmDoc = frm.contentWindow.document;
frmDoc.open();
frmDoc.write('<body style="margin:0"><div style="width:100%"></div>');
frmDoc.close();
document.body.offsetWidth; // Make sure we layout the top document.
test(() => {
frm.style.display = "inline";
assert_equals(frm.contentWindow.getComputedStyle(frmDoc.querySelector("div")).width, "100px");
}, "Check that a percent width in an iframe is the resolved width when the iframe is displayed.");
</script>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<title>CSS Test: getComputedStyle - resolved width in nested iframes dynamic width</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="outer" width="100" scrolling="no" frameborder="0"></iframe>
<script>
const outerDoc = outer.contentWindow.document;
outerDoc.open();
outerDoc.write('<body style="margin:0"><iframe id="inner" scrolling="no" frameborder="0" style="width:100%"></iframe>');
outerDoc.close();
const innerWindow = outerDoc.querySelector("#inner").contentWindow;
const innerDoc = innerWindow.document;
innerDoc.open();
innerDoc.write('<body style="margin:0"><div style="width:100%"></div>');
innerDoc.close();
innerDoc.body.offsetWidth; // Make sure we layout the top document.
test(() => {
assert_equals(innerWindow.getComputedStyle(innerDoc.querySelector("div")).width, "100px");
}, "Check that the initial width is 100px.");
test(() => {
outer.setAttribute("width", "200");
assert_equals(innerWindow.getComputedStyle(innerDoc.querySelector("div")).width, "200px");
}, "Check that the resolved width of the inner div is affected by changing the width of outer iframe.");
</script>