diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/ng/mathml/ng_math_space_layout_algorithm.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/layout/ng/mathml/ng_math_space_layout_algorithm.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/mathml/ng_math_space_layout_algorithm.cc b/chromium/third_party/blink/renderer/core/layout/ng/mathml/ng_math_space_layout_algorithm.cc new file mode 100644 index 00000000000..4abfa765870 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/layout/ng/mathml/ng_math_space_layout_algorithm.cc @@ -0,0 +1,42 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/layout/ng/mathml/ng_math_space_layout_algorithm.h" + +#include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h" +#include "third_party/blink/renderer/core/layout/ng/ng_length_utils.h" + +namespace blink { + +NGMathSpaceLayoutAlgorithm::NGMathSpaceLayoutAlgorithm( + const NGLayoutAlgorithmParams& params) + : NGLayoutAlgorithm(params), + border_padding_(params.fragment_geometry.border + + params.fragment_geometry.padding) { + DCHECK(params.fragment_geometry.scrollbar.IsEmpty()); + container_builder_.SetIsNewFormattingContext(true); + container_builder_.SetInitialFragmentGeometry(params.fragment_geometry); +} + +scoped_refptr<const NGLayoutResult> NGMathSpaceLayoutAlgorithm::Layout() { + DCHECK(!BreakToken()); + + LayoutUnit block_size = ComputeBlockSizeForFragment( + ConstraintSpace(), Style(), border_padding_, border_padding_.BlockSum()); + + container_builder_.SetIntrinsicBlockSize(border_padding_.BlockSum()); + container_builder_.SetBlockSize(block_size); + + container_builder_.SetBaseline( + border_padding_.block_start + + ValueForLength(Style().GetMathBaseline(), LayoutUnit())); + return container_builder_.ToBoxFragment(); +} + +base::Optional<MinMaxSizes> NGMathSpaceLayoutAlgorithm::ComputeMinMaxSizes( + const MinMaxSizesInput& input) const { + return CalculateMinMaxSizesIgnoringChildren(Node(), border_padding_); +} + +} // namespace blink |