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,6 +356,7 @@ bool LayoutBlockFlow::IsSelfCollapsingBlock() const { ...@@ -356,6 +356,7 @@ bool LayoutBlockFlow::IsSelfCollapsingBlock() const {
DCHECK(CreatesNewFormattingContext()); DCHECK(CreatesNewFormattingContext());
return false; return false;
} }
if (!IsLayoutNGObject())
DCHECK_EQ(!is_self_collapsing_, !CheckIfIsSelfCollapsingBlock()); DCHECK_EQ(!is_self_collapsing_, !CheckIfIsSelfCollapsingBlock());
return is_self_collapsing_; return is_self_collapsing_;
} }
...@@ -541,7 +542,7 @@ void LayoutBlockFlow::UpdateBlockLayout(bool relayout_children) { ...@@ -541,7 +542,7 @@ void LayoutBlockFlow::UpdateBlockLayout(bool relayout_children) {
PositionDialog(); PositionDialog();
ClearNeedsLayout(); ClearNeedsLayout();
UpdateIsSelfCollapsing(); is_self_collapsing_ = CheckIfIsSelfCollapsingBlock();
NotifyDisplayLockDidLayout(DisplayLockContext::kSelf); NotifyDisplayLockDidLayout(DisplayLockContext::kSelf);
} }
......
...@@ -443,10 +443,8 @@ class CORE_EXPORT LayoutBlockFlow : public LayoutBlock { ...@@ -443,10 +443,8 @@ class CORE_EXPORT LayoutBlockFlow : public LayoutBlock {
LayoutUnit LogicalHeightWithVisibleOverflow() const final; LayoutUnit LogicalHeightWithVisibleOverflow() const final;
// This function is only public so we can call it from NGBlockNode while we're void SetIsSelfCollapsingFromNG(bool is_self_collapsing) {
// still working on LayoutNG. is_self_collapsing_ = is_self_collapsing;
void UpdateIsSelfCollapsing() {
is_self_collapsing_ = CheckIfIsSelfCollapsingBlock();
} }
// These functions are only public so we can call it from NGBlockNode while // These functions are only public so we can call it from NGBlockNode while
......
...@@ -781,7 +781,7 @@ void NGBlockNode::CopyFragmentDataToLayoutBox( ...@@ -781,7 +781,7 @@ void NGBlockNode::CopyFragmentDataToLayoutBox(
// Overflow computation depends on this being set. // Overflow computation depends on this being set.
if (LIKELY(block_flow)) 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 // We should notify the display lock that we've done layout on self, and if
// it's not blocked, on children. // 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