Commit 280ac36b authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Set IsSelfCollapsing directly from NGBlockNode.

The CheckIsSelfCollapsing code looked a little scary, e.g. for inline
children it was checking if a (legacy) linebox was was present.

This sets the self-collapsing bit directly for the layout overflow
calculation - which might have a slight perf improvement.

Change-Id: I1b214f915005b8ef21a32305be762f9d52f9156b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1556399Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682655}
parent d527e6f1
......@@ -356,7 +356,8 @@ bool LayoutBlockFlow::IsSelfCollapsingBlock() const {
DCHECK(CreatesNewFormattingContext());
return false;
}
DCHECK_EQ(!is_self_collapsing_, !CheckIfIsSelfCollapsingBlock());
if (!IsLayoutNGObject())
DCHECK_EQ(!is_self_collapsing_, !CheckIfIsSelfCollapsingBlock());
return is_self_collapsing_;
}
......@@ -541,7 +542,7 @@ void LayoutBlockFlow::UpdateBlockLayout(bool relayout_children) {
PositionDialog();
ClearNeedsLayout();
UpdateIsSelfCollapsing();
is_self_collapsing_ = CheckIfIsSelfCollapsingBlock();
NotifyDisplayLockDidLayout(DisplayLockContext::kSelf);
}
......
......@@ -443,10 +443,8 @@ class CORE_EXPORT LayoutBlockFlow : public LayoutBlock {
LayoutUnit LogicalHeightWithVisibleOverflow() const final;
// This function is only public so we can call it from NGBlockNode while we're
// still working on LayoutNG.
void UpdateIsSelfCollapsing() {
is_self_collapsing_ = CheckIfIsSelfCollapsingBlock();
void SetIsSelfCollapsingFromNG(bool is_self_collapsing) {
is_self_collapsing_ = is_self_collapsing;
}
// These functions are only public so we can call it from NGBlockNode while
......
......@@ -781,7 +781,7 @@ void NGBlockNode::CopyFragmentDataToLayoutBox(
// Overflow computation depends on this being set.
if (LIKELY(block_flow))
block_flow->UpdateIsSelfCollapsing();
block_flow->SetIsSelfCollapsingFromNG(layout_result.IsSelfCollapsing());
// We should notify the display lock that we've done layout on self, and if
// it's not blocked, on children.
......
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