Commit 334b1dda authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Chromium LUCI CQ

Make container queries rely on size containment.

Bug: 1146097
Change-Id: I73f285c2c8cc828ae11132ae3c57148670b30b76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2621813Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842497}
parent 75b4a953
...@@ -3746,9 +3746,14 @@ void SetDependsOnContainerQueries(HTMLCollection& affected) { ...@@ -3746,9 +3746,14 @@ void SetDependsOnContainerQueries(HTMLCollection& affected) {
TEST_F(StyleEngineTest, UpdateStyleAndLayoutTreeForContainer) { TEST_F(StyleEngineTest, UpdateStyleAndLayoutTreeForContainer) {
GetDocument().body()->setInnerHTML(R"HTML( GetDocument().body()->setInnerHTML(R"HTML(
<div id="container1" style="contain:layout"> <style>
.container {
contain: layout size;
}
</style>
<div id="container1" class="container">
<span class="affected"></span> <span class="affected"></span>
<div id="container2" style="contain:layout" class="affected"> <div id="container2" class="container affected">
<span class="affected"></span> <span class="affected"></span>
<span></span> <span></span>
<span class="affected"></span> <span class="affected"></span>
...@@ -3763,7 +3768,7 @@ TEST_F(StyleEngineTest, UpdateStyleAndLayoutTreeForContainer) { ...@@ -3763,7 +3768,7 @@ TEST_F(StyleEngineTest, UpdateStyleAndLayoutTreeForContainer) {
</div> </div>
</div> </div>
<span></span> <span></span>
<div id="container3" style="contain:layout"> <div id="container3" class="container">
<span class="affected"></span> <span class="affected"></span>
<span class="affected"></span> <span class="affected"></span>
</div> </div>
...@@ -3795,7 +3800,7 @@ TEST_F(StyleEngineTest, UpdateStyleAndLayoutTreeForContainer) { ...@@ -3795,7 +3800,7 @@ TEST_F(StyleEngineTest, UpdateStyleAndLayoutTreeForContainer) {
TEST_F(StyleEngineTest, MarkStyleDirtyFromContainerRecalc) { TEST_F(StyleEngineTest, MarkStyleDirtyFromContainerRecalc) {
GetDocument().body()->setInnerHTML(R"HTML( GetDocument().body()->setInnerHTML(R"HTML(
<div id="container" style="contain:layout"> <div id="container" style="contain: layout size">
<input id="input" type="text" class="affected"> <input id="input" type="text" class="affected">
</div> </div>
)HTML"); )HTML");
......
...@@ -2662,7 +2662,9 @@ class ComputedStyle : public ComputedStyleBase, ...@@ -2662,7 +2662,9 @@ class ComputedStyle : public ComputedStyleBase,
return LogicalSize(LayoutUnit(ratio.Width()), LayoutUnit(ratio.Height())); return LogicalSize(LayoutUnit(ratio.Width()), LayoutUnit(ratio.Height()));
} }
bool IsContainerForContainerQueries() const { return ContainsLayout(); } bool IsContainerForContainerQueries() const {
return ContainsLayout() && ContainsSize();
}
private: private:
EClear Clear() const { return ClearInternal(); } EClear Clear() const { return ClearInternal(); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment