diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-16 20:19:06 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-16 20:19:06 -0400 |
commit | de45820b64ab03768336c7242622ef9f499347cf (patch) | |
tree | 718a67a64a29f2440850e693f8ba707f3b91c179 /layout/style/test | |
parent | ab05e6f9ad185a1f7c405fd29876edca9e0567ba (diff) | |
download | UXP-de45820b64ab03768336c7242622ef9f499347cf.tar UXP-de45820b64ab03768336c7242622ef9f499347cf.tar.gz UXP-de45820b64ab03768336c7242622ef9f499347cf.tar.lz UXP-de45820b64ab03768336c7242622ef9f499347cf.tar.xz UXP-de45820b64ab03768336c7242622ef9f499347cf.zip |
Bug 1346623 - Allow anonymous content created with nsIDocument::InsertAnonymousContent can change from non-native to native AC
* Prevent canvas custom content from becoming NAC when reframing the root element
* Add an API to get computed style values through an AnonymousContent object
Tag #1375
Diffstat (limited to 'layout/style/test')
-rw-r--r-- | layout/style/test/chrome/chrome.ini | 1 | ||||
-rw-r--r-- | layout/style/test/chrome/test_bug1346623.html | 60 |
2 files changed, 61 insertions, 0 deletions
diff --git a/layout/style/test/chrome/chrome.ini b/layout/style/test/chrome/chrome.ini index e34fce671..dd3bdf8f5 100644 --- a/layout/style/test/chrome/chrome.ini +++ b/layout/style/test/chrome/chrome.ini @@ -10,6 +10,7 @@ support-files = mismatch.png [test_author_specified_style.html] +[test_bug1346623.html] [test_bug418986-2.xul] [test_bug1157097.html] [test_bug1160724.xul] diff --git a/layout/style/test/chrome/test_bug1346623.html b/layout/style/test/chrome/test_bug1346623.html new file mode 100644 index 000000000..d24d66646 --- /dev/null +++ b/layout/style/test/chrome/test_bug1346623.html @@ -0,0 +1,60 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for bug 1346623</title> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> +</head> +<body onload="startTest();"> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1346623">Mozilla Bug 1346623</a> +<div id="display"> + +</div> +<pre id="test"> +<script type="application/javascript"> + +var Ci = Components.interfaces; +var winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); + +function startTest() { + // load some styles at the agent level + var css = ` + #ac-parent { color: green; } + #ac-child.abc { } + `; + var sheetURL = "data:text/css," + encodeURIComponent(css); + winUtils.loadSheetUsingURIString(sheetURL, winUtils.AGENT_SHEET); + + // add canvas anonymous content + var bq = document.createElement("blockquote"); + bq.id = "ac-parent"; + bq.textContent = "This blockquote text should be green."; + var div = document.createElement("div"); + div.id = "ac-child"; + div.textContent = " This div text should be green."; + bq.appendChild(div); + var ac = document.insertAnonymousContent(bq); + document.body.offsetWidth; + + is(ac.getComputedStylePropertyValue("ac-child", "color"), "rgb(0, 128, 0)", + "color before reframing"); + + // reframe the root + document.documentElement.style.display = "flex"; + document.body.offsetWidth; + + // restyle the div + ac.setAttributeForElement("ac-child", "class", "abc"); + document.body.offsetWidth; + + is(ac.getComputedStylePropertyValue("ac-child", "color"), "rgb(0, 128, 0)", + "color after reframing"); + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); +</script> +</pre> +</body> +</html> |