Mark the outmost dirty style containment scope only if it has changed

During the creation of the style containment scope the ancestors are
created on the fly and are marked as outmost dirty in such cases.
But that's not correct as if nothing is changed in the new
ancestor, we don't need to update the outmost dirty scope.
Dirtying parent style containment scopes outside a size query container
during layout leads to modifying the layout box tree outside the query
container which is not allowed.

Bug: 1505164
Change-Id: Ic267a863201223d1b3c669ae5216c1eef7dddff7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075697
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231862}
diff --git a/css/css-lists/counters-container-crash.html b/css/css-lists/counters-container-crash.html
new file mode 100644
index 0000000..d195db9
--- /dev/null
+++ b/css/css-lists/counters-container-crash.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>Crash in line layout in Chrome with quotes and container queries</title>
+<link rel="help" href="http://crbug.com/1505164">
+<style>
+#quote {
+  container-type: size;
+  display: inline-block;
+}
+div {
+  appearance: auto;
+  container-type: size;
+}
+</style>
+<q></q>
+<div>
+  <q id="quote"></q>
+  <q></q>
+</div>
+