Commit d7154fc2 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[css-layout-api] Don't use LayoutNG for custom layout children.

Custom layout children may not establish new formatting contexts, and
since the custom container itself is laid out by the legacy engine, we
need to force its children to be laid out by legacy as well.

Added a margin collapsing test that used to fail in NG because of this.

Change-Id: Id320f60fb76b0ed6563fb2b88f6936ac37efc1fd
Reviewed-on: https://chromium-review.googlesource.com/1131179Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573864}
parent bf42cc6f
<!DOCTYPE html> <!DOCTYPE html>
<style> <style>
.container { .container {
float: left;
margin: 20px 0; margin: 20px 0;
border: solid 2px; border: solid 2px;
width: 100px; width: 100px;
...@@ -27,3 +28,7 @@ ...@@ -27,3 +28,7 @@
<div class="inflow" style="background: hotpink"></div> <div class="inflow" style="background: hotpink"></div>
<div class="inflow" style="background: green"></div> <div class="inflow" style="background: green"></div>
</div> </div>
<div class="container">
<div style="height:100px; background:green;"></div>
</div>
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
} }
.container { .container {
float: left;
margin: 20px 0; margin: 20px 0;
border: solid 2px; border: solid 2px;
width: 100px; width: 100px;
...@@ -47,3 +48,15 @@ ...@@ -47,3 +48,15 @@
<div class="float"></div> <div class="float"></div>
<div class="test" style="width: 100%; height: 40px; background: green;"></div> <div class="test" style="width: 100%; height: 40px; background: green;"></div>
</div> </div>
<div class="container">
<!-- This tests that margins in two "layout()" box children collapse as normally. -->
<div class="test" style="background: green;">
<div style="margin:100px 0;">
<div style="margin:100px 0;"></div>
</div>
<div style="margin:100px 0;">
<div style="margin:100px 0;"></div>
</div>
</div>
</div>
...@@ -694,6 +694,14 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state, ...@@ -694,6 +694,14 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state,
style.SetForceLegacyLayout(true); style.SetForceLegacyLayout(true);
} }
} }
if (!style.ForceLegacyLayout()) {
// The custom container is laid out by the legacy engine. Its children may
// not establish new formatting contexts, so we need to protect against
// re-entering LayoutNG there.
if (style.Display() == EDisplay::kLayoutCustom ||
style.Display() == EDisplay::kInlineLayoutCustom)
style.SetForceLegacyLayout(true);
}
} }
// If intrinsically sized images or videos are disallowed by feature policy, // If intrinsically sized images or videos are disallowed by feature policy,
......
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