Commit fe604577 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[FlexNG] Don't provide a baseline when an element has layout containment.

In https://chromium-review.googlesource.com/c/chromium/src/+/1988376
I added a TODO (which was bad, and actually a note to myself).

With FlexNG enabled the lack of this behaviour triggers a lot failures:
https://test-results.appspot.com/data/layout_results/linux-rel/292399/webkit_layout_tests%20%28with%20patch%29/layout-test-results/results.html

This makes it so an element with layout containment doesn't provide
a baseline to its parent.

An alternate version of this patch would to add this logic into
NGBoxFragment::Baseline. However this would likely be slightly more
expensive as we invoke that function much more than creating a fragment.

Bug: 845235
Change-Id: I2faa5042881c14e1e90088ac0219a0aa556f2bf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2019103Reviewed-by: default avatarDavid Grogan <dgrogan@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735572}
parent 5265381b
...@@ -31,7 +31,6 @@ class CORE_EXPORT NGBoxFragment final : public NGFragment { ...@@ -31,7 +31,6 @@ class CORE_EXPORT NGBoxFragment final : public NGFragment {
if (GetWritingMode() != physical_fragment_.Style().GetWritingMode()) if (GetWritingMode() != physical_fragment_.Style().GetWritingMode())
return base::nullopt; return base::nullopt;
// TODO containment?
return To<NGPhysicalBoxFragment>(physical_fragment_).Baseline(); return To<NGPhysicalBoxFragment>(physical_fragment_).Baseline();
} }
......
...@@ -83,6 +83,7 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment( ...@@ -83,6 +83,7 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment(
? kFragmentRenderedLegend ? kFragmentRenderedLegend
: kFragmentBox, : kFragmentBox,
builder->BoxType()) { builder->BoxType()) {
DCHECK(layout_object_);
DCHECK(layout_object_->IsBoxModelObject()); DCHECK(layout_object_->IsBoxModelObject());
if (NGFragmentItemsBuilder* items_builder = builder->ItemsBuilder()) { if (NGFragmentItemsBuilder* items_builder = builder->ItemsBuilder()) {
has_fragment_items_ = true; has_fragment_items_ = true;
...@@ -108,10 +109,15 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment( ...@@ -108,10 +109,15 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment(
is_painted_atomically_ = is_painted_atomically_ =
builder->space_ && builder->space_->IsPaintedAtomically(); builder->space_ && builder->space_->IsPaintedAtomically();
border_edge_ = builder->border_edges_.ToPhysical(builder->GetWritingMode()); border_edge_ = builder->border_edges_.ToPhysical(builder->GetWritingMode());
children_inline_ = children_inline_ = layout_object_->ChildrenInline();
builder->layout_object_ && builder->layout_object_->ChildrenInline(); if (builder->baseline_.has_value() &&
has_baseline_ = builder->baseline_.has_value(); !layout_object_->ShouldApplyLayoutContainment()) {
baseline_ = builder->baseline_.value_or(LayoutUnit::Min()); has_baseline_ = true;
baseline_ = *builder->baseline_;
} else {
has_baseline_ = false;
baseline_ = LayoutUnit::Min();
}
} }
scoped_refptr<const NGLayoutResult> scoped_refptr<const NGLayoutResult>
......
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