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

[LayoutNG] Move instantiating the NGSimplifiedLayoutLayout into a method.

This was consuming an additional 160-bytes of stack.
Also makes NGBlockNode::RunLegacyLayout private.

Bug: 962034, 964926
Change-Id: I1e9f4b97d85b49d6262c07ae789bb984a66cc673
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631126
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663938}
parent 3e8aceb1
......@@ -251,9 +251,7 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::Layout(
// may have gained or removed scrollbars, changing its size). In these
// cases "simplified" layout will return a null layout-result, indicating
// we need to perform a full layout.
layout_result =
NGSimplifiedLayoutAlgorithm(params, *box_->GetCachedLayoutResult())
.Layout();
layout_result = RunSimplifiedLayout(params);
#if DCHECK_IS_ON()
if (layout_result) {
......@@ -1045,6 +1043,12 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::RunLegacyLayout(
return layout_result;
}
scoped_refptr<const NGLayoutResult> NGBlockNode::RunSimplifiedLayout(
const NGLayoutAlgorithmParams& params) const {
return NGSimplifiedLayoutAlgorithm(params, *box_->GetCachedLayoutResult())
.Layout();
}
void NGBlockNode::CopyBaselinesFromLegacyLayout(
const NGConstraintSpace& constraint_space,
NGBoxFragmentBuilder* builder) {
......
......@@ -24,6 +24,7 @@ class NGPhysicalContainerFragment;
class NGPhysicalFragment;
struct MinMaxSize;
struct NGBoxStrut;
struct NGLayoutAlgorithmParams;
struct LogicalOffset;
// Represents a node to be laid out.
......@@ -108,10 +109,6 @@ class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode {
FontBaseline,
bool use_first_line_style);
// Runs layout on the underlying LayoutObject and creates a fragment for the
// resulting geometry.
scoped_refptr<const NGLayoutResult> RunLegacyLayout(const NGConstraintSpace&);
// Called if this is an out-of-flow block which needs to be
// positioned with legacy layout.
void UseLegacyOutOfFlowPositioning() const;
......@@ -131,6 +128,13 @@ class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode {
private:
void PrepareForLayout();
// Runs layout on the underlying LayoutObject and creates a fragment for the
// resulting geometry.
scoped_refptr<const NGLayoutResult> RunLegacyLayout(const NGConstraintSpace&);
scoped_refptr<const NGLayoutResult> RunSimplifiedLayout(
const NGLayoutAlgorithmParams&) const;
// If this node is a LayoutNGMixin, the caller must pass the layout object for
// this node cast to a LayoutBlockFlow as the first argument.
void FinishLayout(LayoutBlockFlow*,
......
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