Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1455)

Unified Diff: third_party/WebKit/LayoutTests/fast/css/media-query-in-supports-dynamic.html

Issue 2081893003: Mark stylesheet as having media queries at consume time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to marking at consume time Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/css/media-query-in-supports-dynamic.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/media-query-in-supports-dynamic.html b/third_party/WebKit/LayoutTests/fast/css/media-query-in-supports-dynamic.html
new file mode 100644
index 0000000000000000000000000000000000000000..429cf801e11eb82c55d20d3e1ffa8f1adc48a43f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/media-query-in-supports-dynamic.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+ iframe { width: 10px; height: 100px }
+</style>
+<iframe id="frame" src=""></iframe>
+<script>
+ var tParser = async_test("Check that @media inside @supports respond to width changes.");
+ var tCSSOM = async_test("Check that CSSOM-inserted @media inside @supports respond to width changes.");
+
+ onload = () => {
+ frame.contentDocument.body.innerHTML =
+ "<style>@supports (color:red) { @media (min-width: 50px) { p { color:green } } }</style>"
+ + "<style>@supports (color:red) {}</style>"
+ + "<p>Should be green and italic.</p>";
+
+ frame.contentDocument.styleSheets[1].cssRules[0].insertRule("@media (min-width: 150px) { p { font-style: italic } }", 0);
+
+ var frameP = frame.contentDocument.querySelector("p");
+ var frameWindow = frame.contentDocument.defaultView;
+
+ tParser.step(() => assert_equals(frameWindow.getComputedStyle(frameP).color, "rgb(0, 0, 0)", "The color of P was not black before the resize."));
+ tParser.step(() => {
+ frame.style.width = "100px";
+ assert_equals(frameWindow.getComputedStyle(frameP).color, "rgb(0, 128, 0)", "The color of P was not green after the resize.");
+ });
+ tParser.done();
+
+ tCSSOM.step(() => assert_equals(frameWindow.getComputedStyle(frameP).fontStyle, "normal", "The font-style of P was not normal before the resize."));
+ tCSSOM.step(() => {
+ frame.style.width = "200px";
+ assert_equals(frameWindow.getComputedStyle(frameP).fontStyle, "italic", "The font-style of P was not italic after the resize.");
+ });
+ tCSSOM.done();
+ };
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698