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