chromium/third_party/blink/renderer/core/layout/layout_utils.cc

// Copyright 2018 The Chromium Authors
// 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/layout_utils.h"

#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/layout/constraint_space.h"
#include "third_party/blink/renderer/core/layout/layout_result.h"
#include "third_party/blink/renderer/core/layout/logical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/block_layout_algorithm_utils.h"
#include "third_party/blink/renderer/core/layout/length_utils.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"

namespace blink {

namespace {

// LengthResolveType indicates what type length the function is being passed
// based on its CSS property. E.g.
// kMinSize - min-width / min-height
// kMaxSize - max-width / max-height
// kMainSize - width / height
enum class LengthResolveType {};

inline bool InlineLengthMayChange(const ComputedStyle& style,
                                  const Length& length,
                                  LengthResolveType type,
                                  const ConstraintSpace& new_space,
                                  const ConstraintSpace& old_space,
                                  const LayoutResult& layout_result) {}

inline bool BlockLengthMayChange(const Length& length,
                                 const ConstraintSpace& new_space,
                                 const ConstraintSpace& old_space) {}

bool BlockSizeMayChange(const BlockNode& node,
                        const ConstraintSpace& new_space,
                        const ConstraintSpace& old_space,
                        const LayoutResult& layout_result) {}

// Return true if it's possible (but not necessarily guaranteed) that the new
// constraint space will give a different size compared to the old one, when
// computed style and child content remain unchanged.
bool SizeMayChange(const BlockNode& node,
                   const ConstraintSpace& new_space,
                   const ConstraintSpace& old_space,
                   const LayoutResult& layout_result) {}

// Given the pre-computed |fragment_geometry| calcuates the
// |LayoutCacheStatus| based on this sizing information. Returns:
//  - |LayoutCacheStatus::kNeedsLayout| if the |new_space| will produce a
//    different sized fragment, or if any %-block-size children will change
//    size.
//  - |LayoutCacheStatus::kNeedsSimplifiedLayout| if the block-size of the
//    fragment will change, *without* affecting any descendants (no descendants
//    have %-block-sizes).
//  - |LayoutCacheStatus::kHit| otherwise.
LayoutCacheStatus CalculateSizeBasedLayoutCacheStatusWithGeometry(
    const BlockNode& node,
    const FragmentGeometry& fragment_geometry,
    const LayoutResult& layout_result,
    const ConstraintSpace& new_space,
    const ConstraintSpace& old_space) {}

bool IntrinsicSizeWillChange(
    const BlockNode& node,
    const BlockBreakToken* break_token,
    const LayoutResult& cached_layout_result,
    const ConstraintSpace& new_space,
    std::optional<FragmentGeometry>* fragment_geometry) {}

}  // namespace

LayoutCacheStatus CalculateSizeBasedLayoutCacheStatus(
    const BlockNode& node,
    const BlockBreakToken* break_token,
    const LayoutResult& cached_layout_result,
    const ConstraintSpace& new_space,
    std::optional<FragmentGeometry>* fragment_geometry) {}

bool MaySkipLayoutWithinBlockFormattingContext(
    const LayoutResult& cached_layout_result,
    const ConstraintSpace& new_space,
    std::optional<LayoutUnit>* bfc_block_offset,
    LayoutUnit* block_offset_delta,
    MarginStrut* end_margin_strut) {}

}  // namespace blink