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

// Copyright 2016 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/block_layout_algorithm.h"

#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/renderer/core/dom/dom_token_list.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/tag_collection.h"
#include "third_party/blink/renderer/core/layout/base_layout_algorithm_test.h"
#include "third_party/blink/renderer/core/layout/block_break_token.h"
#include "third_party/blink/renderer/core/layout/block_node.h"
#include "third_party/blink/renderer/core/layout/constraint_space.h"
#include "third_party/blink/renderer/core/layout/constraint_space_builder.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_result.h"
#include "third_party/blink/renderer/core/layout/length_utils.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/physical_fragment.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"

namespace blink {
namespace {

ElementsAre;
Pointee;

class BlockLayoutAlgorithmTest : public BaseLayoutAlgorithmTest {};

TEST_F(BlockLayoutAlgorithmTest, FixedSize) {}

TEST_F(BlockLayoutAlgorithmTest, Caching) {}

TEST_F(BlockLayoutAlgorithmTest, MinInlineSizeCaching) {}

TEST_F(BlockLayoutAlgorithmTest, PercentageBlockSizeQuirkDescendantsCaching) {}

TEST_F(BlockLayoutAlgorithmTest, LineOffsetCaching) {}

// Verifies that two children are laid out with the correct size and position.
TEST_F(BlockLayoutAlgorithmTest, LayoutBlockChildren) {}

// Verifies that a child is laid out correctly if it's writing mode is different
// from the parent's one.
TEST_F(BlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {}

// Verifies that floats are positioned at the top of the first child that can
// determine its position after margins collapsed.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase1WithFloats) {}

// Verifies the collapsing margins case for the next pairs:
// - bottom margin of box and top margin of its next in-flow following sibling.
// - top and bottom margins of a box that does not establish a new block
//   formatting context and that has zero computed 'min-height', zero or 'auto'
//   computed 'height', and no in-flow children
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase2WithFloats) {}

// Verifies the collapsing margins case for the next pair:
// - bottom margin of a last in-flow child and bottom margin of its parent if
//   the parent has 'auto' computed height
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase3) {}

// Verifies that 2 adjoining margins are not collapsed if there is padding or
// border that separates them.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase4) {}

// Verifies that margins of 2 adjoining blocks with different writing modes
// get collapsed.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase5) {}

// Verifies that margins collapsing logic works with Layout Inline.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsWithText) {}

// Verifies that the margin strut of a child with a different writing mode does
// not get used in the collapsing margins calculation.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase6) {}

// Verifies that a child with clearance - which does nothing - still shifts its
// parent's offset.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsCase7) {}

// An empty block level element (with margins collapsing through it) has
// non-trivial behavior with margins collapsing.
TEST_F(BlockLayoutAlgorithmTest, CollapsingMarginsEmptyBlockWithClearance) {}

// Tests that when auto margins are applied to a new formatting context, they
// are applied within the layout opportunity.
TEST_F(BlockLayoutAlgorithmTest, NewFormattingContextAutoMargins) {}

// Verifies that a box's size includes its borders and padding, and that
// children are positioned inside the content box.
TEST_F(BlockLayoutAlgorithmTest, BorderAndPadding) {}

TEST_F(BlockLayoutAlgorithmTest, PercentageResolutionSize) {}

// A very simple auto margin case. We rely on the tests in length_utils_test
// for the more complex cases; just make sure we handle auto at all here.
TEST_F(BlockLayoutAlgorithmTest, AutoMargin) {}

// Verifies that floats can be correctly positioned if they are inside of nested
// empty blocks.
TEST_F(BlockLayoutAlgorithmTest, PositionFloatInsideEmptyBlocks) {}

// Verifies that left/right floating and regular blocks can be positioned
// correctly by the algorithm.
TEST_F(BlockLayoutAlgorithmTest, PositionFloatFragments) {}

// Verifies that NG block layout algorithm respects "clear" CSS property.
TEST_F(BlockLayoutAlgorithmTest, PositionFragmentsWithClear) {}

// Verifies that we compute the right min and max-content size.
TEST_F(BlockLayoutAlgorithmTest, ComputeMinMaxContent) {}

TEST_F(BlockLayoutAlgorithmTest, ComputeMinMaxContentFloats) {}

TEST_F(BlockLayoutAlgorithmTest, ComputeMinMaxContentFloatsClearance) {}

TEST_F(BlockLayoutAlgorithmTest, ComputeMinMaxContentNewFormattingContext) {}

TEST_F(BlockLayoutAlgorithmTest,
       ComputeMinMaxContentNewFormattingContextNegativeMargins) {}

TEST_F(BlockLayoutAlgorithmTest,
       ComputeMinMaxContentSingleNewFormattingContextNegativeMargins) {}

// Tests that we correctly handle shrink-to-fit
TEST_F(BlockLayoutAlgorithmTest, ShrinkToFit) {}

// Verifies that we position empty blocks and floats correctly inside of the
// block that establishes new BFC.
TEST_F(BlockLayoutAlgorithmTest, PositionEmptyBlocksInNewBfc) {}

// Verifies that we can correctly position blocks with clearance and
// intruding floats.
TEST_F(BlockLayoutAlgorithmTest,
       PositionBlocksWithClearanceAndIntrudingFloats) {}

// Tests that a block won't fragment if it doesn't reach the fragmentation line.
TEST_F(BlockLayoutAlgorithmTest, NoFragmentation) {}

// Tests that a block will fragment if it reaches the fragmentation line.
TEST_F(BlockLayoutAlgorithmTest, SimpleFragmentation) {}

// Tests that children inside the same block formatting context fragment when
// reaching a fragmentation line.
TEST_F(BlockLayoutAlgorithmTest, InnerChildrenFragmentation) {}

// Tests that children which establish new formatting contexts fragment
// correctly.
TEST_F(BlockLayoutAlgorithmTest, InnerFormattingContextChildrenFragmentation) {}

// Tests that children inside a block container will fragment if the container
// doesn't reach the fragmentation line.
TEST_F(BlockLayoutAlgorithmTest, InnerChildrenFragmentationSmallHeight) {}

// Tests that float children fragment correctly inside a parallel flow.
TEST_F(BlockLayoutAlgorithmTest, DISABLED_FloatFragmentationParallelFlows) {}

// Tests that float children don't fragment if they aren't in the same writing
// mode as their parent.
TEST_F(BlockLayoutAlgorithmTest, FloatFragmentationOrthogonalFlows) {}

// Tests that a float child inside a zero height block fragments correctly.
TEST_F(BlockLayoutAlgorithmTest, DISABLED_FloatFragmentationZeroHeight) {}

// Verifies that we correctly position a new FC block with the Layout
// Opportunity iterator.
TEST_F(BlockLayoutAlgorithmTest, NewFcBlockWithAdjoiningFloatCollapsesMargins) {}

TEST_F(BlockLayoutAlgorithmTest, NewFcAvoidsFloats) {}

TEST_F(BlockLayoutAlgorithmTest, ZeroBlockSizeAboveEdge) {}

TEST_F(BlockLayoutAlgorithmTest, NewFcFirstChildIsZeroBlockSize) {}

// This test assumes that tables are not yet implemented in LayoutNG.
TEST_F(BlockLayoutAlgorithmTest, RootFragmentOffsetInsideLegacy) {}

TEST_F(BlockLayoutAlgorithmTest, LayoutRubyTextCrash) {}

TEST_F(BlockLayoutAlgorithmTest, HandleTextControlPlaceholderCrash) {}

}  // namespace
}  // namespace blink