Commit 61120ebd authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] IsBlockLayoutRoot -> IsBlockFormattingContextRoot

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I4dcc14002fc786887ed5dbbe1523c4ba22af94df
Reviewed-on: https://chromium-review.googlesource.com/1163518Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581189}
parent 33a899d1
......@@ -61,7 +61,7 @@ class NGPhysicalFragmentCollectorBase {
// Traverse descendants unless the fragment is laid out separately from the
// inline layout algorithm.
if (&fragment != root_fragment_ && fragment.IsBlockLayoutRoot())
if (&fragment != root_fragment_ && fragment.IsBlockFormattingContextRoot())
return;
DCHECK(fragment.IsContainer());
......
......@@ -72,7 +72,7 @@ const NGPhysicalFragment* NGPhysicalLineBoxFragment::FirstLogicalLeaf() const {
// should compute and store it during layout.
const TextDirection direction = Style().Direction();
const NGPhysicalFragment* runner = this;
while (runner->IsContainer() && !runner->IsBlockLayoutRoot()) {
while (runner->IsContainer() && !runner->IsBlockFormattingContextRoot()) {
const NGPhysicalContainerFragment* runner_as_container =
ToNGPhysicalContainerFragment(runner);
if (runner_as_container->Children().IsEmpty())
......@@ -92,7 +92,7 @@ const NGPhysicalFragment* NGPhysicalLineBoxFragment::LastLogicalLeaf() const {
// should compute and store it during layout.
const TextDirection direction = Style().Direction();
const NGPhysicalFragment* runner = this;
while (runner->IsContainer() && !runner->IsBlockLayoutRoot()) {
while (runner->IsContainer() && !runner->IsBlockFormattingContextRoot()) {
const NGPhysicalContainerFragment* runner_as_container =
ToNGPhysicalContainerFragment(runner);
if (runner_as_container->Children().IsEmpty())
......
......@@ -153,10 +153,10 @@ void CopyFragmentDataToLayoutBoxForInlineChildren(
}
// The Location() of inline LayoutObject is relative to the
// LayoutBlockFlow. If |child| is a block layout root (e.g., inline block,
// float, etc.), it creates another inline formatting context. Do not copy
// to its descendants in this case.
if (!child->IsBlockLayoutRoot()) {
// LayoutBlockFlow. If |child| establishes a new block formatting context,
// it also creates another inline formatting context. Do not copy to its
// descendants in this case.
if (!child->IsBlockFormattingContextRoot()) {
CopyFragmentDataToLayoutBoxForInlineChildren(
ToNGPhysicalContainerFragment(*child), initial_container_width,
initial_container_is_flipped, child_offset);
......
......@@ -30,7 +30,7 @@ TEST_F(NGPhysicalBoxFragmentTest, DISABLED_NormalOldLayoutRoot) {
EXPECT_TRUE(fragment->IsBox());
EXPECT_EQ(NGPhysicalFragment::kNormalBox, fragment->BoxType());
EXPECT_TRUE(fragment->IsOldLayoutRoot());
EXPECT_TRUE(fragment->IsBlockLayoutRoot());
EXPECT_TRUE(fragment->IsBlockFormattingContextRoot());
}
// TODO(editing-dev): Once LayoutNG supports editing, we should change this
......@@ -44,7 +44,7 @@ TEST_F(NGPhysicalBoxFragmentTest, DISABLED_FloatOldLayoutRoot) {
EXPECT_TRUE(fragment->IsBox());
EXPECT_EQ(NGPhysicalFragment::kFloating, fragment->BoxType());
EXPECT_TRUE(fragment->IsOldLayoutRoot());
EXPECT_TRUE(fragment->IsBlockLayoutRoot());
EXPECT_TRUE(fragment->IsBlockFormattingContextRoot());
}
// TODO(editing-dev): Once LayoutNG supports editing, we should change this
......@@ -60,7 +60,7 @@ TEST_F(NGPhysicalBoxFragmentTest, DISABLED_InlineBlockOldLayoutRoot) {
EXPECT_TRUE(fragment->IsBox());
EXPECT_EQ(NGPhysicalFragment::kAtomicInline, fragment->BoxType());
EXPECT_TRUE(fragment->IsOldLayoutRoot());
EXPECT_TRUE(fragment->IsBlockLayoutRoot());
EXPECT_TRUE(fragment->IsBlockFormattingContextRoot());
}
// TODO(editing-dev): Once LayoutNG supports editing, we should change this
......@@ -77,7 +77,7 @@ TEST_F(NGPhysicalBoxFragmentTest, DISABLED_OutOfFlowPositionedOldLayoutRoot) {
EXPECT_TRUE(fragment->IsBox());
EXPECT_EQ(NGPhysicalFragment::kOutOfFlowPositioned, fragment->BoxType());
EXPECT_TRUE(fragment->IsOldLayoutRoot());
EXPECT_TRUE(fragment->IsBlockLayoutRoot());
EXPECT_TRUE(fragment->IsBlockFormattingContextRoot());
}
} // namespace blink
......@@ -63,9 +63,10 @@ class CORE_EXPORT NGPhysicalFragment
// When adding new values, make sure the bit size of |sub_type_| is large
// enough to store.
// Also, add after kMinimumBlockLayoutRoot if the box type is a block layout
// root, or before otherwise. See IsBlockLayoutRoot().
kMinimumBlockLayoutRoot = kAtomicInline
// Also, add after kMinimumBlockFormattingContextRoot if the box type is a
// block formatting context root, or before otherwise. See
// IsBlockFormattingContextRoot().
kMinimumBlockFormattingContextRoot = kAtomicInline
};
~NGPhysicalFragment();
......@@ -113,11 +114,9 @@ class CORE_EXPORT NGPhysicalFragment
// Returns whether the fragment is old layout root.
bool IsOldLayoutRoot() const { return is_old_layout_root_; }
// A block sub-layout starts on this fragment. Inline blocks, floats, out of
// flow positioned objects are such examples. This is also true on NG/legacy
// boundary.
bool IsBlockLayoutRoot() const {
return (IsBox() && BoxType() >= NGBoxType::kMinimumBlockLayoutRoot) ||
bool IsBlockFormattingContextRoot() const {
return (IsBox() &&
BoxType() >= NGBoxType::kMinimumBlockFormattingContextRoot) ||
IsOldLayoutRoot();
}
......
......@@ -331,7 +331,7 @@ namespace {
bool FragmentRequiresLegacyFallback(const NGPhysicalFragment& fragment) {
// Fallback to LayoutObject if this is a root of NG block layout.
// If this box is for this painter, LayoutNGBlockFlow will call back.
if (fragment.IsBlockLayoutRoot())
if (fragment.IsBlockFormattingContextRoot())
return true;
// TODO(kojii): Review if this is still needed.
......
......@@ -271,12 +271,12 @@ void NGPaintFragment::PopulateDescendants(
child->inline_offset_to_container_box_ =
inline_offset_to_container_box + child_fragment->Offset();
// Recurse chlidren, except when this is a block layout root.
// TODO(kojii): At the block layout root, chlidren maybe for NGPaint,
// LayoutNG but not for NGPaint, or legacy. In order to get the maximum
// test coverage, split the NGPaintFragment tree at all possible engine
// boundaries.
if (!child_fragment->IsBlockLayoutRoot()) {
// Recurse children, except when this is a block formatting context root.
// TODO(kojii): At the block formatting context root, children may be for
// NGPaint, LayoutNG but not for NGPaint, or legacy. In order to get the
// maximum test coverage, split the NGPaintFragment tree at all possible
// engine boundaries.
if (!child_fragment->IsBlockFormattingContextRoot()) {
child->PopulateDescendants(child->inline_offset_to_container_box_,
first_fragment_map, last_fragment_map);
}
......
......@@ -56,7 +56,7 @@ class InlineFilter {
}
bool IsTraverse(const NGPaintFragment* fragment) {
return fragment->PhysicalFragment().IsContainer() &&
!fragment->PhysicalFragment().IsBlockLayoutRoot();
!fragment->PhysicalFragment().IsBlockFormattingContextRoot();
}
};
......
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