Commit 8d94b3c9 authored by Oriol Brufau's avatar Oriol Brufau Committed by Commit Bot

Recalculate descendant styles when display changes to custom layout

Previously this only happened if the old display was custom layout,
but not when changing from a standard display to a custom one.
This was a typo, the same condition was checked twice for old_style,
but the second occurrence should check new_style instead.
The change matters when there are inline children that should be
blockified by the custom layout, without the patch they would remain
inline.

BUG=978990
TEST=external/wpt/css/css-layout-api/layout-child-inlines-dynamic.https.html

Change-Id: I73bcf679209dd4bc4a0d7a49f4345ee699bbf37e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1678484Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#672718}
parent 6f2da658
......@@ -239,7 +239,7 @@ ComputedStyle::Difference ComputedStyle::ComputeDifference(
(old_style->IsDisplayFlexibleOrGridBox() ||
old_style->IsDisplayLayoutCustomBox() ||
new_style->IsDisplayFlexibleOrGridBox() ||
old_style->IsDisplayLayoutCustomBox())) {
new_style->IsDisplayLayoutCustomBox())) {
return Difference::kDisplayAffectingDescendantStyles;
}
if (!old_style->NonIndependentInheritedEqual(*new_style))
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Layout API: Dynamic blockification of inline children</title>
<link rel="author" href="mailto:obrufau@igalia.com" title="Oriol Brufau">
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#layout-children" title="4.1. Layout Children">
<meta name="assert" content="This test checks that inline children are correctly blockified or unblockified when the display of the parent changes dynamically." />
<style>
#wrapper {
display: layout(foo);
}
#test {
display: inline;
}
</style>
<div id="wrapper">
<div id="test">Lorem ipsum</div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/worklet-reftest.js"></script>
<script>
promise_test(async function() {
await importWorklet(CSS.layoutWorklet, {url: 'support/layout-child-worklet.js'});
const wrapper = document.getElementById("wrapper");
const test = document.getElementById("test");
assert_equals(getComputedStyle(test).display, "block", "The child should have been blockified by the custom layout");
wrapper.style.display = "block";
assert_equals(getComputedStyle(test).display, "inline", "The child should no longer be blockified in block layout");
wrapper.style.display = "";
assert_equals(getComputedStyle(test).display, "block", "The child should have been blockified again");
});
</script>
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