Commit 59a7dfca authored by Aleks Totic's avatar Aleks Totic Committed by Chromium LUCI CQ

[TablesNG] 4 final fixes

4 small fixes left over from previous code reviews.

Bug: 958381
Change-Id: Ie0718f273ab6656b01eca5af1930bd8111c2436f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566307
Commit-Queue: Aleks Totic <atotic@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832604}
parent 47613fcb
...@@ -1597,6 +1597,10 @@ MinMaxSizes LayoutBlock::PreferredLogicalWidths() const { ...@@ -1597,6 +1597,10 @@ MinMaxSizes LayoutBlock::PreferredLogicalWidths() const {
sizes.max_size = LayoutUnit(sizes.max_size.Ceil()); sizes.max_size = LayoutUnit(sizes.max_size.Ceil());
} }
if (IsLayoutNGMixin() && IsTable()) {
sizes.Encompass(IntrinsicLogicalWidths().min_size);
}
return sizes; return sizes;
} }
......
...@@ -91,6 +91,8 @@ ...@@ -91,6 +91,8 @@
#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
#include "third_party/blink/renderer/core/layout/ng/ng_outline_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_outline_utils.h"
#include "third_party/blink/renderer/core/layout/ng/ng_unpositioned_float.h" #include "third_party/blink/renderer/core/layout/ng/ng_unpositioned_float.h"
#include "third_party/blink/renderer/core/layout/ng/table/layout_ng_table.h"
#include "third_party/blink/renderer/core/layout/ng/table/layout_ng_table_cell.h"
#include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_clipper.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_clipper.h"
#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources.h"
#include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h"
...@@ -1345,13 +1347,25 @@ inline void LayoutObject::InvalidateContainerIntrinsicLogicalWidths() { ...@@ -1345,13 +1347,25 @@ inline void LayoutObject::InvalidateContainerIntrinsicLogicalWidths() {
// In order to avoid pathological behavior when inlines are deeply nested, we // In order to avoid pathological behavior when inlines are deeply nested, we
// do include them in the chain that we mark dirty (even though they're kind // do include them in the chain that we mark dirty (even though they're kind
// of irrelevant). // of irrelevant).
LayoutObject* o = IsTableCell() ? ContainingBlock() : Container(); auto IntrinsicContainer = [](const LayoutObject* current) -> LayoutObject* {
// Table cell intrinsic logical-widths are queried directly from a <table>
// rather than from their parents (sections or rows). Skip these when
// invalidating.
if (current->IsTableCell()) {
if (current->IsTableCellLegacy())
return current->ContainingBlock();
else
return To<LayoutNGTableCell>(current)->Table();
}
return current->Container();
};
LayoutObject* o = IntrinsicContainer(this);
while (o && while (o &&
(!o->IntrinsicLogicalWidthsDirty() || NGKeepInvalidatingBeyond(o))) { (!o->IntrinsicLogicalWidthsDirty() || NGKeepInvalidatingBeyond(o))) {
// Don't invalidate the outermost object of an unrooted subtree. That object // Don't invalidate the outermost object of an unrooted subtree. That object
// will be invalidated when the subtree is added to the document. // will be invalidated when the subtree is added to the document.
LayoutObject* container = LayoutObject* container = IntrinsicContainer(o);
o->IsTableCell() ? o->ContainingBlock() : o->Container();
if (!container && !IsA<LayoutView>(o)) if (!container && !IsA<LayoutView>(o))
break; break;
......
...@@ -2687,6 +2687,13 @@ void NGBlockLayoutAlgorithm::PropagateBaselineFromChild( ...@@ -2687,6 +2687,13 @@ void NGBlockLayoutAlgorithm::PropagateBaselineFromChild(
return; return;
} }
// When computing the baseline for an inline-block, table's don't contribute
// to any baselines.
if (child.IsTableNG() && ConstraintSpace().BaselineAlgorithmType() !=
NGBaselineAlgorithmType::kFirstLine) {
return;
}
NGBoxFragment fragment(ConstraintSpace().GetWritingDirection(), NGBoxFragment fragment(ConstraintSpace().GetWritingDirection(),
To<NGPhysicalBoxFragment>(child)); To<NGPhysicalBoxFragment>(child));
......
...@@ -51,8 +51,14 @@ inline void InlineSizesFromStyle( ...@@ -51,8 +51,14 @@ inline void InlineSizesFromStyle(
if (*min_inline_size) if (*min_inline_size)
*max_inline_size = std::max(**min_inline_size, **max_inline_size); *max_inline_size = std::max(**min_inline_size, **max_inline_size);
} }
if (length.IsPercent()) if (length.IsPercent()) {
*percentage_inline_size = length.Percent(); *percentage_inline_size = length.Percent();
} else if (length.IsCalculated()) {
// crbug.com/1154376 Style engine should handle %+0px case automatically.
PixelsAndPercent pixels_and_percent = length.GetPixelsAndPercent();
if (pixels_and_percent.pixels == 0.0f)
*percentage_inline_size = pixels_and_percent.percent;
}
if (*percentage_inline_size && max_length.IsPercent()) { if (*percentage_inline_size && max_length.IsPercent()) {
*percentage_inline_size = *percentage_inline_size =
...@@ -265,8 +271,6 @@ void NGTableTypes::CellInlineConstraint::Encompass( ...@@ -265,8 +271,6 @@ void NGTableTypes::CellInlineConstraint::Encompass(
max_inline_size = std::max(min_inline_size, other.max_inline_size); max_inline_size = std::max(min_inline_size, other.max_inline_size);
} }
is_constrained = is_constrained || other.is_constrained; is_constrained = is_constrained || other.is_constrained;
max_inline_size = std::max(max_inline_size, other.max_inline_size);
percent = std::max(percent, other.percent);
if (other.percent > percent) { if (other.percent > percent) {
percent = other.percent; percent = other.percent;
percent_border_padding = other.percent_border_padding; percent_border_padding = other.percent_border_padding;
......
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