Don't ignore parent frame during UpdateStyleAndLayoutTreeForNode
We would incorrectly behave as if were were style-clean if an outer
frame was dirtied with an inner media query. This causes getAnimations
(and probably other cases) to report the wrong thing.
Note: The provided test passes in Firefox.
Change-Id: Ia0743f775804463fb4cf98cce2be013f44ee6c87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2968003
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#893776}
diff --git a/web-animations/interfaces/Animatable/getAnimations-iframe.html b/web-animations/interfaces/Animatable/getAnimations-iframe.html
new file mode 100644
index 0000000..c43cf57
--- /dev/null
+++ b/web-animations/interfaces/Animatable/getAnimations-iframe.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<title>getAnimations in dirty iframe</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+ iframe {
+ width: 200px;
+ height: 40px;
+ }
+</style>
+<iframe id=iframe srcdoc="
+ <style>
+ div { color: red; }
+ @keyframes test {
+ from { color: green; }
+ to { color: green; }
+ }
+ @media (min-width: 300px) {
+ div { animation: test 1s linear forwards; }
+ }
+ </style>
+ <div id=div>Green</div>
+"></iframe>
+<script>
+
+ function waitForLoad(w) {
+ return new Promise(resolve => w.addEventListener('load', resolve));
+ }
+
+ promise_test(async () => {
+ await waitForLoad(window);
+ let inner_div = iframe.contentDocument.getElementById('div');
+ assert_equals(getComputedStyle(inner_div).color, 'rgb(255, 0, 0)');
+
+ iframe.style.width = '400px';
+ assert_equals(inner_div.getAnimations().length, 1);
+ assert_equals(getComputedStyle(inner_div).color, 'rgb(0, 128, 0)');
+ }, 'Calling getAnimations updates layout of parent frame if needed');
+</script>