content-visibility: Ensure we don't change values twice with animations.

This patch ensures that when computing style, we defer any display lock
state adjustments until we process both base style and adjust it for
animations.

Since the state changes can affect whether we are observing
intersections and whether to synchronously notify of intersection
changes, having the state go from visible (via base calculation) to
auto (via animation) is incorrect. Instead, the state should always
remain auto, even though we go to visible in the interim.

This is all done by saving the pending state and applying it after
both base and animation adjustments have happened.

R=chrishtr@chromium.org, futhark@chromium.org

Bug: 1146181
Change-Id: I499580c6c3c9e9e14dc59a93bd3325436088f05e
diff --git a/css/css-contain/content-visibility/content-visibility-077.html b/css/css-contain/content-visibility/content-visibility-077.html
new file mode 100644
index 0000000..4d9c698
--- /dev/null
+++ b/css/css-contain/content-visibility/content-visibility-077.html
@@ -0,0 +1,35 @@
+<!doctype HTML>
+<meta charset="utf8">
+<title>CSS Content Visibility: animation with auto works as if auto was specified.</title>
+<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
+<link rel="match" href="container-with-child-ref.html">
+<meta name="assert" content="content-visibility auto applied via animation paints contents when in viewport">
+
+<script src="/common/reftest-wait.js"></script>
+
+<style>
+@keyframes cv {
+  from { content-visibility: auto }
+  to { content-visibility: auto }
+}
+
+#container {
+  animation: cv 1s;
+
+  width: 150px;
+  height: 150px;
+  background: lightblue;
+}
+#child {
+  width: 50px;
+  height: 50px;
+  background: lightgreen;
+}
+</style>
+
+<div id=container>
+  Text.
+  <div id=child></div>
+</div>
+</html>