Index: third_party/WebKit/LayoutTests/fast/css/media-attr-non-matching-dynamic.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/media-attr-non-matching-dynamic.html b/third_party/WebKit/LayoutTests/fast/css/media-attr-non-matching-dynamic.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..86fbd88c9c6324b53d5c328b0ccdfb0c8b685553 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/media-attr-non-matching-dynamic.html |
@@ -0,0 +1,23 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<style> |
+ iframe { |
+ height: 50px; |
+ width: 50px; |
+ } |
+</style> |
+<iframe></iframe> |
+<script> |
+ test(() => { |
+ var iframe = document.querySelector("iframe"); |
+ var doc = iframe.contentDocument; |
+ var style = doc.createElement("style"); |
+ style.setAttribute("media", "(min-width: 100px)"); |
+ style.textContent = "body { background: green }"; |
+ doc.head.appendChild(style); |
+ assert_equals(doc.defaultView.getComputedStyle(doc.body).backgroundColor, "rgba(0, 0, 0, 0)"); |
+ iframe.setAttribute("style", "height: 100px; width: 100px"); |
+ assert_equals(doc.defaultView.getComputedStyle(doc.body).backgroundColor, "rgb(0, 128, 0)"); |
+ }, "Sheet with initially non-matching viewport media query applies after resize"); |
+</script> |