Commit 9ee2d8c8 authored by ikilpatrick's avatar ikilpatrick Committed by Commit bot

[LayoutNG] Fix enum values to conform to kEnumName in style guide.

Review-Url: https://codereview.chromium.org/2536323003
Cr-Commit-Position: refs/heads/master@{#435526}
parent ec1ab21b
......@@ -25,18 +25,18 @@ class NGAbsoluteUtilsTest : public ::testing::Test {
style_->setBorderBottomStyle(EBorderStyle::BorderStyleSolid);
style_->setBoxSizing(EBoxSizing::BoxSizingBorderBox);
container_size_ = NGLogicalSize(LayoutUnit(200), LayoutUnit(300));
NGConstraintSpaceBuilder builder(HorizontalTopBottom);
NGConstraintSpaceBuilder builder(kHorizontalTopBottom);
ltr_space_ = new NGConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
builder.SetAvailableSize(container_size_).ToConstraintSpace());
rtl_space_ = new NGConstraintSpace(
HorizontalTopBottom, RTL,
kHorizontalTopBottom, RTL,
builder.SetAvailableSize(container_size_).ToConstraintSpace());
vertical_lr_space_ = new NGConstraintSpace(
VerticalLeftRight, LTR,
kVerticalLeftRight, LTR,
builder.SetAvailableSize(container_size_).ToConstraintSpace());
vertical_rl_space_ = new NGConstraintSpace(
VerticalLeftRight, LTR,
kVerticalLeftRight, LTR,
builder.SetAvailableSize(container_size_).ToConstraintSpace());
}
......
......@@ -221,7 +221,7 @@ NGLayoutStatus NGBlockLayoutAlgorithm::Layout(
space_builder_ =
new NGConstraintSpaceBuilder(constraint_space_->WritingMode());
if (Style().specifiesColumns()) {
space_builder_->SetFragmentationType(FragmentColumn);
space_builder_->SetFragmentationType(kFragmentColumn);
adjusted_inline_size =
ResolveUsedColumnInlineSize(adjusted_inline_size, Style());
}
......@@ -232,7 +232,7 @@ NGLayoutStatus NGBlockLayoutAlgorithm::Layout(
content_size_ = border_and_padding_.block_start;
builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox);
builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::kFragmentBox);
builder_->SetDirection(constraint_space_->Direction());
builder_->SetWritingMode(constraint_space_->WritingMode());
builder_->SetInlineSize(inline_size).SetBlockSize(block_size);
......@@ -241,20 +241,20 @@ NGLayoutStatus NGBlockLayoutAlgorithm::Layout(
space_for_current_child_ = CreateConstraintSpaceForCurrentChild();
state_ = kStateChildLayout;
return NotFinished;
return kNotFinished;
}
case kStateChildLayout: {
if (current_child_) {
if (!LayoutCurrentChild())
return NotFinished;
return kNotFinished;
current_child_ = current_child_->NextSibling();
if (current_child_) {
space_for_current_child_ = CreateConstraintSpaceForCurrentChild();
return NotFinished;
return kNotFinished;
}
}
state_ = kStateFinalize;
return NotFinished;
return kNotFinished;
}
case kStateFinalize: {
content_size_ += border_and_padding_.block_end;
......@@ -268,12 +268,12 @@ NGLayoutStatus NGBlockLayoutAlgorithm::Layout(
.SetBlockOverflow(content_size_);
*fragment_out = builder_->ToFragment();
state_ = kStateInit;
return NewFragment;
return kNewFragment;
}
};
NOTREACHED();
*fragment_out = nullptr;
return NewFragment;
return kNewFragment;
}
bool NGBlockLayoutAlgorithm::LayoutCurrentChild() {
......@@ -398,12 +398,12 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionFloatFragment(
space_for_current_child_, fragment, margins);
DCHECK(!opportunity.IsEmpty()) << "Opportunity is empty but it shouldn't be";
NGExclusion::Type exclusion_type = NGExclusion::NG_FLOAT_LEFT;
NGExclusion::Type exclusion_type = NGExclusion::kFloatLeft;
// Calculate the float offset if needed.
LayoutUnit float_offset;
if (CurrentChildStyle().floating() == EFloat::Right) {
float_offset = opportunity.size.inline_size - fragment.InlineSize();
exclusion_type = NGExclusion::NG_FLOAT_RIGHT;
exclusion_type = NGExclusion::kFloatRight;
}
// Add the float as an exclusion.
......
......@@ -48,7 +48,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
style_->setHeight(Length(40, Fixed));
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragmentBase* frag = RunBlockLayoutAlgorithm(space, nullptr);
......@@ -78,13 +78,13 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) {
first_child->SetNextSibling(second_child);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
EXPECT_EQ(LayoutUnit(kWidth), frag->Width());
EXPECT_EQ(LayoutUnit(kHeight1 + kHeight2 + kMarginTop), frag->Height());
EXPECT_EQ(NGPhysicalFragmentBase::FragmentBox, frag->Type());
EXPECT_EQ(NGPhysicalFragmentBase::kFragmentBox, frag->Type());
ASSERT_EQ(frag->Children().size(), 2UL);
const NGPhysicalFragmentBase* child = frag->Children()[0];
......@@ -124,7 +124,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {
div1->SetFirstChild(div2);
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR,
ConstructConstraintSpace(kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -168,11 +168,11 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1) {
div1->SetFirstChild(div2);
NGLogicalSize size(LayoutUnit(100), NGSizeIndefinite);
NGConstraintSpaceBuilder builder(HorizontalTopBottom);
NGConstraintSpaceBuilder builder(kHorizontalTopBottom);
builder.SetAvailableSize(size)
.SetPercentageResolutionSize(size)
.SetIsNewFormattingContext(true);
auto* space = new NGConstraintSpace(HorizontalTopBottom, LTR,
auto* space = new NGConstraintSpace(kHorizontalTopBottom, LTR,
builder.ToConstraintSpace());
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -247,7 +247,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2) {
div6->SetNextSibling(div7);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -296,7 +296,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
div1->SetFirstChild(div2);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -345,7 +345,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
div1->SetFirstChild(div2);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -401,7 +401,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
vertical_div->SetNextSibling(horizontal_div);
auto* space = ConstructConstraintSpace(
VerticalLeftRight, LTR, NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
kVerticalLeftRight, LTR, NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, vertical_div);
ASSERT_EQ(frag->Children().size(), 2UL);
......@@ -458,7 +458,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase6) {
div1->SetNextSibling(div3);
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR,
ConstructConstraintSpace(kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -521,7 +521,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
div1->SetFirstChild(div2);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
......@@ -534,7 +534,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
EXPECT_EQ(kBorderTop + kPaddingTop + kHeight + kPaddingBottom + kBorderBottom,
child->Height());
ASSERT_TRUE(child->Type() == NGPhysicalFragmentBase::FragmentBox);
ASSERT_TRUE(child->Type() == NGPhysicalFragmentBase::kFragmentBox);
ASSERT_EQ(static_cast<const NGPhysicalFragment*>(child)->Children().size(),
1UL);
......@@ -555,12 +555,12 @@ TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) {
NGBlockNode* first_child = new NGBlockNode(first_style.get());
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Width());
EXPECT_EQ(NGPhysicalFragmentBase::FragmentBox, frag->Type());
EXPECT_EQ(NGPhysicalFragmentBase::kFragmentBox, frag->Type());
ASSERT_EQ(frag->Children().size(), 1UL);
const NGPhysicalFragmentBase* child = frag->Children()[0];
......@@ -583,12 +583,12 @@ TEST_F(NGBlockLayoutAlgorithmTest, AutoMargin) {
NGBlockNode* first_child = new NGBlockNode(first_style.get());
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Width());
EXPECT_EQ(NGPhysicalFragmentBase::FragmentBox, frag->Type());
EXPECT_EQ(NGPhysicalFragmentBase::kFragmentBox, frag->Type());
EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->WidthOverflow());
ASSERT_EQ(1UL, frag->Children().size());
......@@ -664,7 +664,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
div3->SetNextSibling(div4);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
ASSERT_EQ(frag->Children().size(), 4UL);
......@@ -741,7 +741,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFragmentsWithClear) {
// clear: left;
div3_style->setClear(EClear::ClearLeft);
auto* space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
const NGPhysicalFragmentBase* child3 = frag->Children()[2];
......@@ -750,7 +750,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFragmentsWithClear) {
// clear: right;
div3_style->setClear(EClear::ClearRight);
space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
frag = RunBlockLayoutAlgorithm(space, div1);
child3 = frag->Children()[2];
......@@ -759,11 +759,11 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFragmentsWithClear) {
// clear: both;
div3_style->setClear(EClear::ClearBoth);
space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
frag = RunBlockLayoutAlgorithm(space, div1);
space = ConstructConstraintSpace(
HorizontalTopBottom, LTR,
kHorizontalTopBottom, LTR,
NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
child3 = frag->Children()[2];
EXPECT_EQ(kDiv1Size + kDiv2Size, child3->TopOffset());
......
......@@ -23,13 +23,13 @@
namespace blink {
NGBlockNode::NGBlockNode(LayoutObject* layout_object)
: NGLayoutInputNode(NGLayoutInputNodeType::LegacyBlock),
: NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock),
layout_box_(toLayoutBox(layout_object)) {
DCHECK(layout_box_);
}
NGBlockNode::NGBlockNode(ComputedStyle* style)
: NGLayoutInputNode(NGLayoutInputNodeType::LegacyBlock),
: NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock),
layout_box_(nullptr),
style_(style) {
DCHECK(style_);
......@@ -110,11 +110,11 @@ bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
// TODO(cbiesinger): For orthogonal children, we need to always synthesize.
NGLayoutAlgorithm::MinAndMaxState state =
minmax_algorithm_->ComputeMinAndMaxContentSizes(sizes);
if (state == NGLayoutAlgorithm::Success)
if (state == NGLayoutAlgorithm::kSuccess)
return true;
if (state == NGLayoutAlgorithm::Pending)
if (state == NGLayoutAlgorithm::kPending)
return false;
DCHECK_EQ(state, NGLayoutAlgorithm::NotImplemented);
DCHECK_EQ(state, NGLayoutAlgorithm::kNotImplemented);
// TODO(cbiesinger): Replace the loops below with a state machine like in
// Layout.
......@@ -309,7 +309,7 @@ NGPhysicalFragment* NGBlockNode::RunOldLayout(
LayoutRect overflow = layout_box_->layoutOverflowRect();
// TODO(layout-ng): This does not handle writing modes correctly (for
// overflow)
NGFragmentBuilder builder(NGPhysicalFragmentBase::FragmentBox);
NGFragmentBuilder builder(NGPhysicalFragmentBase::kFragmentBox);
builder.SetInlineSize(layout_box_->logicalWidth())
.SetBlockSize(layout_box_->logicalHeight())
.SetDirection(layout_box_->styleRef().direction())
......
......@@ -86,8 +86,8 @@ class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode {
DEFINE_TYPE_CASTS(NGBlockNode,
NGLayoutInputNode,
node,
node->Type() == NGLayoutInputNode::LegacyBlock,
node.Type() == NGLayoutInputNode::LegacyBlock);
node->Type() == NGLayoutInputNode::kLegacyBlock,
node.Type() == NGLayoutInputNode::kLegacyBlock);
} // namespace blink
......
......@@ -103,30 +103,30 @@ bool NGConstraintSpace::IsNewFormattingContext() const {
}
bool NGConstraintSpace::InlineTriggersScrollbar() const {
return writing_mode_ == HorizontalTopBottom
return writing_mode_ == kHorizontalTopBottom
? physical_space_->width_direction_triggers_scrollbar_
: physical_space_->height_direction_triggers_scrollbar_;
}
bool NGConstraintSpace::BlockTriggersScrollbar() const {
return writing_mode_ == HorizontalTopBottom
return writing_mode_ == kHorizontalTopBottom
? physical_space_->height_direction_triggers_scrollbar_
: physical_space_->width_direction_triggers_scrollbar_;
}
bool NGConstraintSpace::FixedInlineSize() const {
return writing_mode_ == HorizontalTopBottom ? physical_space_->fixed_width_
: physical_space_->fixed_height_;
return writing_mode_ == kHorizontalTopBottom ? physical_space_->fixed_width_
: physical_space_->fixed_height_;
}
bool NGConstraintSpace::FixedBlockSize() const {
return writing_mode_ == HorizontalTopBottom ? physical_space_->fixed_height_
: physical_space_->fixed_width_;
return writing_mode_ == kHorizontalTopBottom ? physical_space_->fixed_height_
: physical_space_->fixed_width_;
}
NGFragmentationType NGConstraintSpace::BlockFragmentationType() const {
return static_cast<NGFragmentationType>(
writing_mode_ == HorizontalTopBottom
writing_mode_ == kHorizontalTopBottom
? physical_space_->height_direction_fragmentation_type_
: physical_space_->width_direction_fragmentation_type_);
}
......
......@@ -108,7 +108,7 @@ class CORE_EXPORT NGConstraintSpace final
void Subtract(const NGFragment*);
NGLayoutOpportunityIterator* LayoutOpportunities(
unsigned clear = NGClearNone,
unsigned clear = kNGClearNone,
bool for_inline_or_bfc = false);
DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); }
......
......@@ -12,7 +12,7 @@ NGConstraintSpaceBuilder::NGConstraintSpaceBuilder(NGWritingMode writing_mode)
is_fixed_size_block_(false),
is_inline_direction_triggers_scrollbar_(false),
is_block_direction_triggers_scrollbar_(false),
fragmentation_type_(NGFragmentationType::FragmentNone),
fragmentation_type_(NGFragmentationType::kFragmentNone),
is_new_fc_(false) {}
NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetAvailableSize(
......@@ -74,18 +74,18 @@ NGPhysicalConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace() {
percentage_resolution_size_.ConvertToPhysical(
static_cast<NGWritingMode>(writing_mode_));
if (writing_mode_ == HorizontalTopBottom) {
if (writing_mode_ == kHorizontalTopBottom) {
return new NGPhysicalConstraintSpace(
available_size, percentage_resolution_size, is_fixed_size_inline_,
is_fixed_size_block_, is_inline_direction_triggers_scrollbar_,
is_block_direction_triggers_scrollbar_, FragmentNone,
is_block_direction_triggers_scrollbar_, kFragmentNone,
static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_);
} else {
return new NGPhysicalConstraintSpace(
available_size, percentage_resolution_size, is_fixed_size_block_,
is_fixed_size_inline_, is_block_direction_triggers_scrollbar_,
is_inline_direction_triggers_scrollbar_,
static_cast<NGFragmentationType>(fragmentation_type_), FragmentNone,
static_cast<NGFragmentationType>(fragmentation_type_), kFragmentNone,
is_new_fc_);
}
}
......
......@@ -21,8 +21,8 @@ NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode,
new NGPhysicalConstraintSpace(
size, size, /* fixed_width */ true, /* fixed_height */ false,
/* width_direction_triggers_scrollbar */ true,
/* height_direction_triggers_scrollbar */ false, FragmentNone,
FragmentColumn, /* is_new_fc */ false));
/* height_direction_triggers_scrollbar */ false, kFragmentNone,
kFragmentColumn, /* is_new_fc */ false));
}
TEST(NGConstraintSpaceTest, WritingMode) {
......@@ -30,14 +30,14 @@ TEST(NGConstraintSpaceTest, WritingMode) {
NGPhysicalSize(LayoutUnit(200), LayoutUnit(100)),
NGPhysicalSize(LayoutUnit(200), LayoutUnit(100)), /* fixed_width */ true,
/* fixed_height */ false, /* width_direction_triggers_scrollbar */ true,
/* height_direction_triggers_scrollbar */ false, FragmentNone,
FragmentColumn, /* is_new_fc */ false);
/* height_direction_triggers_scrollbar */ false, kFragmentNone,
kFragmentColumn, /* is_new_fc */ false);
NGConstraintSpace* horz_space =
new NGConstraintSpace(HorizontalTopBottom, LTR, phy_space);
new NGConstraintSpace(kHorizontalTopBottom, LTR, phy_space);
NGConstraintSpace* vert_space =
new NGConstraintSpace(VerticalRightLeft, LTR, phy_space);
new NGConstraintSpace(kVerticalRightLeft, LTR, phy_space);
EXPECT_EQ(LayoutUnit(200), horz_space->AvailableSize().inline_size);
EXPECT_EQ(LayoutUnit(200), vert_space->AvailableSize().block_size);
......@@ -57,8 +57,8 @@ TEST(NGConstraintSpaceTest, WritingMode) {
EXPECT_FALSE(horz_space->FixedBlockSize());
EXPECT_FALSE(vert_space->FixedInlineSize());
EXPECT_EQ(FragmentColumn, horz_space->BlockFragmentationType());
EXPECT_EQ(FragmentNone, vert_space->BlockFragmentationType());
EXPECT_EQ(kFragmentColumn, horz_space->BlockFragmentationType());
EXPECT_EQ(kFragmentNone, vert_space->BlockFragmentationType());
}
static String OpportunityToString(const NGLayoutOpportunity& opportunity) {
......@@ -71,7 +71,7 @@ TEST(NGConstraintSpaceTest, LayoutOpportunitiesNoExclusions) {
physical_size.height = LayoutUnit(400);
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR, physical_size);
ConstructConstraintSpace(kHorizontalTopBottom, LTR, physical_size);
auto* iterator = space->LayoutOpportunities();
EXPECT_EQ("0,0 600x400", OpportunityToString(iterator->Next()));
......@@ -85,7 +85,7 @@ TEST(NGConstraintSpaceTest, LayoutOpportunitiesTopRightExclusion) {
// Create a space with a 100x100 exclusion in the top right corner.
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR, physical_size);
ConstructConstraintSpace(kHorizontalTopBottom, LTR, physical_size);
NGExclusion exclusion;
exclusion.rect.size = {/* inline_size */ LayoutUnit(100),
/* block_size */ LayoutUnit(100)};
......@@ -111,7 +111,7 @@ TEST(NGConstraintSpaceTest, LayoutOpportunitiesTopLeftExclusion) {
// Create a space with a 100x100 exclusion in the top left corner.
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR, physical_size);
ConstructConstraintSpace(kHorizontalTopBottom, LTR, physical_size);
NGExclusion exclusion;
exclusion.rect.size = {/* inline_size */ LayoutUnit(100),
/* block_size */ LayoutUnit(100)};
......@@ -160,7 +160,7 @@ TEST(NGConstraintSpaceTest, LayoutOpportunitiesTwoInMiddle) {
physical_size.height = LayoutUnit(400);
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR, physical_size);
ConstructConstraintSpace(kHorizontalTopBottom, LTR, physical_size);
// Add exclusions
NGExclusion exclusion1;
exclusion1.rect.size = {/* inline_size */ LayoutUnit(100),
......@@ -215,7 +215,7 @@ TEST(NGConstraintSpaceTest, LayoutOpportunitiesTwoInMiddleWithOriginAndLeader) {
physical_size.height = LayoutUnit(400);
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR, physical_size);
ConstructConstraintSpace(kHorizontalTopBottom, LTR, physical_size);
// Add exclusions
NGExclusion exclusion1;
exclusion1.rect.size = {/* inline_size */ LayoutUnit(100),
......@@ -271,7 +271,7 @@ TEST(NGConstraintSpaceTest, LayoutOpportunitiesWithOutOfBoundsExclusions) {
physical_size.height = LayoutUnit(100);
auto* space =
ConstructConstraintSpace(HorizontalTopBottom, LTR, physical_size);
ConstructConstraintSpace(kHorizontalTopBottom, LTR, physical_size);
NGExclusion exclusion;
exclusion.rect.size = {/* inline_size */ LayoutUnit(100),
/* block_size */ LayoutUnit(100)};
......
......@@ -30,8 +30,8 @@ class CORE_EXPORT NGFragment final : public NGFragmentBase {
DEFINE_TYPE_CASTS(NGFragment,
NGFragmentBase,
fragment,
fragment->Type() == NGPhysicalFragmentBase::FragmentBox,
fragment.Type() == NGPhysicalFragmentBase::FragmentBox);
fragment->Type() == NGPhysicalFragmentBase::kFragmentBox,
fragment.Type() == NGPhysicalFragmentBase::kFragmentBox);
} // namespace blink
......
......@@ -9,34 +9,35 @@
namespace blink {
LayoutUnit NGFragmentBase::InlineSize() const {
return writing_mode_ == HorizontalTopBottom ? physical_fragment_->Width()
: physical_fragment_->Height();
return writing_mode_ == kHorizontalTopBottom ? physical_fragment_->Width()
: physical_fragment_->Height();
}
LayoutUnit NGFragmentBase::BlockSize() const {
return writing_mode_ == HorizontalTopBottom ? physical_fragment_->Height()
: physical_fragment_->Width();
return writing_mode_ == kHorizontalTopBottom ? physical_fragment_->Height()
: physical_fragment_->Width();
}
LayoutUnit NGFragmentBase::InlineOverflow() const {
return writing_mode_ == HorizontalTopBottom
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->WidthOverflow()
: physical_fragment_->HeightOverflow();
}
LayoutUnit NGFragmentBase::BlockOverflow() const {
return writing_mode_ == HorizontalTopBottom
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->HeightOverflow()
: physical_fragment_->WidthOverflow();
}
LayoutUnit NGFragmentBase::InlineOffset() const {
return writing_mode_ == HorizontalTopBottom ? physical_fragment_->LeftOffset()
: physical_fragment_->TopOffset();
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->LeftOffset()
: physical_fragment_->TopOffset();
}
LayoutUnit NGFragmentBase::BlockOffset() const {
return writing_mode_ == HorizontalTopBottom
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->TopOffset()
: physical_fragment_->LeftOffset();
}
......
......@@ -10,7 +10,7 @@ namespace blink {
NGFragmentBuilder::NGFragmentBuilder(
NGPhysicalFragmentBase::NGFragmentType type)
: type_(type), writing_mode_(HorizontalTopBottom), direction_(LTR) {}
: type_(type), writing_mode_(kHorizontalTopBottom), direction_(LTR) {}
NGFragmentBuilder& NGFragmentBuilder::SetWritingMode(
NGWritingMode writing_mode) {
......@@ -45,7 +45,7 @@ NGFragmentBuilder& NGFragmentBuilder::SetBlockOverflow(LayoutUnit size) {
NGFragmentBuilder& NGFragmentBuilder::AddChild(NGFragmentBase* child,
NGLogicalOffset offset) {
DCHECK_EQ(type_, NGPhysicalFragmentBase::FragmentBox)
DCHECK_EQ(type_, NGPhysicalFragmentBase::kFragmentBox)
<< "Only box fragments can have children";
children_.append(child->PhysicalFragment());
offsets_.append(offset);
......@@ -68,7 +68,7 @@ NGFragmentBuilder& NGFragmentBuilder::SetMarginStrutBlockEnd(
NGPhysicalFragment* NGFragmentBuilder::ToFragment() {
// TODO(layout-ng): Support text fragments
DCHECK_EQ(type_, NGPhysicalFragmentBase::FragmentBox);
DCHECK_EQ(type_, NGPhysicalFragmentBase::kFragmentBox);
DCHECK_EQ(offsets_.size(), children_.size());
NGPhysicalSize physical_size = size_.ConvertToPhysical(writing_mode_);
......
......@@ -28,10 +28,10 @@ NGLayoutStatus NGInlineLayoutAlgorithm::Layout(
NGFragmentBase*,
NGPhysicalFragmentBase** fragment_out,
NGLayoutAlgorithm**) {
NGFragmentBuilder builder(NGPhysicalFragmentBase::FragmentBox);
NGFragmentBuilder builder(NGPhysicalFragmentBase::kFragmentBox);
*fragment_out = builder.ToFragment();
return NewFragment;
return kNewFragment;
}
DEFINE_TRACE(NGInlineLayoutAlgorithm) {
......
......@@ -26,7 +26,7 @@ namespace blink {
NGInlineNode::NGInlineNode(LayoutObject* start_inline,
ComputedStyle* block_style)
: NGLayoutInputNode(NGLayoutInputNodeType::LegacyInline),
: NGLayoutInputNode(NGLayoutInputNodeType::kLegacyInline),
start_inline_(start_inline),
last_inline_(nullptr),
block_style_(block_style) {
......@@ -35,7 +35,7 @@ NGInlineNode::NGInlineNode(LayoutObject* start_inline,
}
NGInlineNode::NGInlineNode()
: NGLayoutInputNode(NGLayoutInputNodeType::LegacyInline),
: NGLayoutInputNode(NGLayoutInputNodeType::kLegacyInline),
start_inline_(nullptr),
last_inline_(nullptr),
block_style_(nullptr) {}
......
......@@ -123,8 +123,8 @@ class NGLayoutInlineItem {
DEFINE_TYPE_CASTS(NGInlineNode,
NGLayoutInputNode,
node,
node->Type() == NGLayoutInputNode::LegacyInline,
node.Type() == NGLayoutInputNode::LegacyInline);
node->Type() == NGLayoutInputNode::kLegacyInline,
node.Type() == NGLayoutInputNode::kLegacyInline);
} // namespace blink
......
......@@ -19,7 +19,7 @@ class NGFragmentBase;
class NGPhysicalFragmentBase;
class NGPhysicalFragment;
enum NGLayoutStatus { NotFinished, ChildAlgorithmRequired, NewFragment };
enum NGLayoutStatus { kNotFinished, kChildAlgorithmRequired, kNewFragment };
// Base class for all LayoutNG algorithms.
class CORE_EXPORT NGLayoutAlgorithm
......@@ -44,7 +44,7 @@ class CORE_EXPORT NGLayoutAlgorithm
NGPhysicalFragmentBase**,
NGLayoutAlgorithm**) = 0;
enum MinAndMaxState { Success, Pending, NotImplemented };
enum MinAndMaxState { kSuccess, kPending, kNotImplemented };
// Computes the min-content and max-content intrinsic sizes for the given box.
// The result will not take any min-width. max-width or width properties into
......@@ -55,7 +55,7 @@ class CORE_EXPORT NGLayoutAlgorithm
// A Pending return value has the same meaning as a false return from layout,
// i.e. it is a request to call this function again.
virtual MinAndMaxState ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) {
return NotImplemented;
return kNotImplemented;
}
DEFINE_INLINE_VIRTUAL_TRACE() {}
......
......@@ -25,12 +25,12 @@ bool NGLayoutCoordinator::Tick(NGPhysicalFragmentBase** fragment) {
// TODO(layout-dev): store box from last tick and pass it into Layout here.
switch (
layout_algorithms_.back()->Layout(nullptr, fragment, &child_algorithm)) {
case NotFinished:
case kNotFinished:
return false;
case NewFragment:
case kNewFragment:
layout_algorithms_.pop_back();
return (layout_algorithms_.size() == 0);
case ChildAlgorithmRequired:
case kChildAlgorithmRequired:
layout_algorithms_.append(child_algorithm);
return false;
}
......
......@@ -20,7 +20,7 @@ NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode(
// At least for now, this should never be called on LegacyInline
// children. However, there will be other kinds of input_node so
// it makes sense to do this here.
DCHECK(input_node->Type() == LegacyBlock);
DCHECK(input_node->Type() == kLegacyBlock);
NGBlockNode* block = toNGBlockNode(input_node);
if (block->HasInlineChildren())
......
......@@ -20,7 +20,7 @@ class NGLayoutAlgorithm;
class CORE_EXPORT NGLayoutInputNode
: public GarbageCollectedFinalized<NGLayoutInputNode> {
public:
enum NGLayoutInputNodeType { LegacyBlock = 0, LegacyInline = 1 };
enum NGLayoutInputNodeType { kLegacyBlock = 0, kLegacyInline = 1 };
virtual ~NGLayoutInputNode(){};
......
......@@ -38,16 +38,16 @@ LayoutUnit ResolveInlineLength(
DCHECK(!length.isMaxSizeNone());
DCHECK_GE(constraint_space.AvailableSize().inline_size, LayoutUnit());
if (type == LengthResolveType::MinSize && length.isAuto())
if (type == LengthResolveType::kMinSize && length.isAuto())
return LayoutUnit();
if (type == LengthResolveType::MarginBorderPaddingSize && length.isAuto())
if (type == LengthResolveType::kMarginBorderPaddingSize && length.isAuto())
return LayoutUnit();
// We don't need this when we're resolving margin/border/padding; skip
// computing it as an optimization and to simplify the code below.
NGBoxStrut border_and_padding;
if (type != LengthResolveType::MarginBorderPaddingSize) {
if (type != LengthResolveType::kMarginBorderPaddingSize) {
border_and_padding =
ComputeBorders(style) + ComputePadding(constraint_space, style);
}
......@@ -114,9 +114,9 @@ LayoutUnit ResolveBlockLength(const NGConstraintSpace& constraint_space,
LayoutUnit content_size,
LengthResolveType type) {
DCHECK(!length.isMaxSizeNone());
DCHECK(type != LengthResolveType::MarginBorderPaddingSize);
DCHECK(type != LengthResolveType::kMarginBorderPaddingSize);
if (type == LengthResolveType::MinSize && length.isAuto())
if (type == LengthResolveType::kMinSize && length.isAuto())
return LayoutUnit();
// Make sure that indefinite percentages resolve to NGSizeIndefinite, not to
......@@ -129,7 +129,7 @@ LayoutUnit ResolveBlockLength(const NGConstraintSpace& constraint_space,
// We don't need this when we're resolving margin/border/padding; skip
// computing it as an optimization and to simplify the code below.
NGBoxStrut border_and_padding;
if (type != LengthResolveType::MarginBorderPaddingSize) {
if (type != LengthResolveType::kMarginBorderPaddingSize) {
border_and_padding =
ComputeBorders(style) + ComputePadding(constraint_space, style);
}
......@@ -182,21 +182,21 @@ LayoutUnit ComputeInlineSizeForFragment(
if (constraint_space.FixedInlineSize())
return constraint_space.AvailableSize().inline_size;
LayoutUnit extent =
ResolveInlineLength(constraint_space, style, min_and_max,
style.logicalWidth(), LengthResolveType::ContentSize);
LayoutUnit extent = ResolveInlineLength(constraint_space, style, min_and_max,
style.logicalWidth(),
LengthResolveType::kContentSize);
Length max_length = style.logicalMaxWidth();
if (!max_length.isMaxSizeNone()) {
LayoutUnit max =
ResolveInlineLength(constraint_space, style, min_and_max, max_length,
LengthResolveType::MaxSize);
LengthResolveType::kMaxSize);
extent = std::min(extent, max);
}
LayoutUnit min =
ResolveInlineLength(constraint_space, style, min_and_max,
style.logicalMinWidth(), LengthResolveType::MinSize);
style.logicalMinWidth(), LengthResolveType::kMinSize);
extent = std::max(extent, min);
return extent;
}
......@@ -210,7 +210,7 @@ LayoutUnit ComputeBlockSizeForFragment(
LayoutUnit extent =
ResolveBlockLength(constraint_space, style, style.logicalHeight(),
content_size, LengthResolveType::ContentSize);
content_size, LengthResolveType::kContentSize);
if (extent == NGSizeIndefinite) {
DCHECK_EQ(content_size, NGSizeIndefinite);
return extent;
......@@ -220,13 +220,13 @@ LayoutUnit ComputeBlockSizeForFragment(
if (!max_length.isMaxSizeNone()) {
LayoutUnit max =
ResolveBlockLength(constraint_space, style, max_length, content_size,
LengthResolveType::MaxSize);
LengthResolveType::kMaxSize);
extent = std::min(extent, max);
}
LayoutUnit min =
ResolveBlockLength(constraint_space, style, style.logicalMinHeight(),
content_size, LengthResolveType::MinSize);
content_size, LengthResolveType::kMinSize);
extent = std::max(extent, min);
return extent;
}
......@@ -289,16 +289,16 @@ NGBoxStrut ComputeMargins(const NGConstraintSpace& constraint_space,
NGPhysicalBoxStrut physical_dim;
physical_dim.left = ResolveInlineLength(
constraint_space, style, empty_sizes, style.marginLeft(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
physical_dim.right = ResolveInlineLength(
constraint_space, style, empty_sizes, style.marginRight(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
physical_dim.top = ResolveInlineLength(
constraint_space, style, empty_sizes, style.marginTop(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
physical_dim.bottom = ResolveInlineLength(
constraint_space, style, empty_sizes, style.marginBottom(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
return physical_dim.ConvertToLogical(writing_mode, direction);
}
......@@ -320,16 +320,16 @@ NGBoxStrut ComputePadding(const NGConstraintSpace& constraint_space,
NGBoxStrut padding;
padding.inline_start = ResolveInlineLength(
constraint_space, style, empty_sizes, style.paddingStart(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
padding.inline_end = ResolveInlineLength(
constraint_space, style, empty_sizes, style.paddingEnd(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
padding.block_start = ResolveInlineLength(
constraint_space, style, empty_sizes, style.paddingBefore(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
padding.block_end = ResolveInlineLength(
constraint_space, style, empty_sizes, style.paddingAfter(),
LengthResolveType::MarginBorderPaddingSize);
LengthResolveType::kMarginBorderPaddingSize);
return padding;
}
......
......@@ -21,10 +21,10 @@ struct NGBoxStrut;
class NGFragmentBase;
enum class LengthResolveType {
MinSize,
MaxSize,
ContentSize,
MarginBorderPaddingSize
kMinSize,
kMaxSize,
kContentSize,
kMarginBorderPaddingSize
};
#define NGSizeIndefinite LayoutUnit(-1)
......
......@@ -28,7 +28,7 @@ class NGLengthUtilsTest : public ::testing::Test {
int block_size,
bool fixed_inline = false,
bool fixed_block = false) {
NGConstraintSpaceBuilder builder(HorizontalTopBottom);
NGConstraintSpaceBuilder builder(kHorizontalTopBottom);
builder
.SetAvailableSize(
NGLogicalSize(LayoutUnit(inline_size), LayoutUnit(block_size)))
......@@ -37,13 +37,13 @@ class NGLengthUtilsTest : public ::testing::Test {
.SetIsFixedSizeInline(fixed_inline)
.SetIsFixedSizeBlock(fixed_block);
return new NGConstraintSpace(HorizontalTopBottom, LTR,
return new NGConstraintSpace(kHorizontalTopBottom, LTR,
builder.ToConstraintSpace());
}
LayoutUnit ResolveInlineLength(
const Length& length,
LengthResolveType type = LengthResolveType::ContentSize,
LengthResolveType type = LengthResolveType::kContentSize,
const WTF::Optional<MinAndMaxContentSizes>& sizes = WTF::nullopt) {
NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200, 300);
return ::blink::ResolveInlineLength(*constraintSpace, *style_, sizes,
......@@ -52,7 +52,7 @@ class NGLengthUtilsTest : public ::testing::Test {
LayoutUnit ResolveBlockLength(
const Length& length,
LengthResolveType type = LengthResolveType::ContentSize,
LengthResolveType type = LengthResolveType::kContentSize,
LayoutUnit contentSize = LayoutUnit()) {
NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200, 300);
return ::blink::ResolveBlockLength(*constraintSpace, *style_, length,
......@@ -82,30 +82,30 @@ TEST_F(NGLengthUtilsTest, testResolveInlineLength) {
EXPECT_EQ(LayoutUnit(60), ResolveInlineLength(Length(30, Percent)));
EXPECT_EQ(LayoutUnit(150), ResolveInlineLength(Length(150, Fixed)));
EXPECT_EQ(LayoutUnit(0),
ResolveInlineLength(Length(Auto), LengthResolveType::MinSize));
ResolveInlineLength(Length(Auto), LengthResolveType::kMinSize));
EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(Auto)));
EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(FillAvailable)));
EXPECT_EQ(LayoutUnit(200),
ResolveInlineLength(Length(Auto), LengthResolveType::MaxSize));
ResolveInlineLength(Length(Auto), LengthResolveType::kMaxSize));
EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(FillAvailable),
LengthResolveType::MaxSize));
LengthResolveType::kMaxSize));
MinAndMaxContentSizes sizes;
sizes.min_content = LayoutUnit(30);
sizes.max_content = LayoutUnit(40);
EXPECT_EQ(LayoutUnit(30),
ResolveInlineLength(Length(MinContent),
LengthResolveType::ContentSize, sizes));
LengthResolveType::kContentSize, sizes));
EXPECT_EQ(LayoutUnit(40),
ResolveInlineLength(Length(MaxContent),
LengthResolveType::ContentSize, sizes));
LengthResolveType::kContentSize, sizes));
EXPECT_EQ(LayoutUnit(40),
ResolveInlineLength(Length(FitContent),
LengthResolveType::ContentSize, sizes));
LengthResolveType::kContentSize, sizes));
sizes.max_content = LayoutUnit(800);
EXPECT_EQ(LayoutUnit(200),
ResolveInlineLength(Length(FitContent),
LengthResolveType::ContentSize, sizes));
LengthResolveType::kContentSize, sizes));
#ifndef NDEBUG
// This should fail a DCHECK.
EXPECT_DEATH(ResolveInlineLength(Length(FitContent)), "Check failed");
......@@ -119,10 +119,10 @@ TEST_F(NGLengthUtilsTest, testResolveBlockLength) {
EXPECT_EQ(LayoutUnit(300), ResolveBlockLength(Length(FillAvailable)));
EXPECT_EQ(LayoutUnit(0),
ResolveBlockLength(Length(Auto), LengthResolveType::ContentSize));
ResolveBlockLength(Length(Auto), LengthResolveType::kContentSize));
EXPECT_EQ(LayoutUnit(300),
ResolveBlockLength(Length(FillAvailable),
LengthResolveType::ContentSize));
LengthResolveType::kContentSize));
}
TEST_F(NGLengthUtilsTest, testComputeInlineSizeForFragment) {
......@@ -277,7 +277,7 @@ TEST_F(NGLengthUtilsTest, testMargins) {
NGConstraintSpace* constraintSpace(ConstructConstraintSpace(200, 300));
NGBoxStrut margins =
ComputeMargins(*constraintSpace, *style_, HorizontalTopBottom, LTR);
ComputeMargins(*constraintSpace, *style_, kHorizontalTopBottom, LTR);
EXPECT_EQ(LayoutUnit(20), margins.block_start);
EXPECT_EQ(LayoutUnit(52), margins.inline_end);
......@@ -325,11 +325,11 @@ TEST_F(NGLengthUtilsTest, testAutoMargins) {
style_->setMarginRight(Length(Auto));
style_->setMarginLeft(Length(Auto));
NGFragmentBuilder builder(NGPhysicalFragmentBase::FragmentBox);
NGFragmentBuilder builder(NGPhysicalFragmentBase::kFragmentBox);
builder.SetInlineSize(LayoutUnit(150));
NGPhysicalFragment* physical_fragment = builder.ToFragment();
NGFragment* fragment =
new NGFragment(HorizontalTopBottom, LTR, physical_fragment);
new NGFragment(kHorizontalTopBottom, LTR, physical_fragment);
NGConstraintSpace* constraint_space(ConstructConstraintSpace(200, 300));
......
......@@ -31,9 +31,9 @@ NGPhysicalConstraintSpace::NGPhysicalConstraintSpace(
void NGPhysicalConstraintSpace::AddExclusion(const NGExclusion& exclusion) {
NGExclusion* exclusion_ptr = new NGExclusion(exclusion);
exclusions_.append(WTF::wrapUnique(exclusion_ptr));
if (exclusion.type == NGExclusion::NG_FLOAT_LEFT) {
if (exclusion.type == NGExclusion::kFloatLeft) {
last_left_float_exclusion_ = exclusions_.rbegin()->get();
} else if (exclusion.type == NGExclusion::NG_FLOAT_RIGHT) {
} else if (exclusion.type == NGExclusion::kFloatRight) {
last_right_float_exclusion_ = exclusions_.rbegin()->get();
}
}
......
......@@ -15,17 +15,17 @@ namespace blink {
// TODO(glebl@): unused, delete.
enum NGExclusionType {
NGClearNone = 0,
NGClearFloatLeft = 1,
NGClearFloatRight = 2,
NGClearFragment = 4
kNGClearNone = 0,
kNGClearFloatLeft = 1,
kNGClearFloatRight = 2,
kNGClearFragment = 4
};
enum NGFragmentationType {
FragmentNone,
FragmentPage,
FragmentColumn,
FragmentRegion
kFragmentNone,
kFragmentPage,
kFragmentColumn,
kFragmentRegion
};
// The NGPhysicalConstraintSpace contains the underlying data for the
......
......@@ -16,7 +16,7 @@ NGPhysicalFragment::NGPhysicalFragment(
HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants,
Vector<NGLogicalOffset> out_of_flow_offsets,
NGMarginStrut margin_strut)
: NGPhysicalFragmentBase(size, overflow, FragmentBox),
: NGPhysicalFragmentBase(size, overflow, kFragmentBox),
margin_strut_(margin_strut) {
children_.swap(children);
out_of_flow_descendants_.swap(out_of_flow_descendants);
......
......@@ -54,8 +54,8 @@ WILL_NOT_BE_EAGERLY_TRACED_CLASS(NGPhysicalFragment);
DEFINE_TYPE_CASTS(NGPhysicalFragment,
NGPhysicalFragmentBase,
fragment,
fragment->Type() == NGPhysicalFragmentBase::FragmentBox,
fragment.Type() == NGPhysicalFragmentBase::FragmentBox);
fragment->Type() == NGPhysicalFragmentBase::kFragmentBox,
fragment.Type() == NGPhysicalFragmentBase::kFragmentBox);
} // namespace blink
......
......@@ -10,14 +10,14 @@
namespace blink {
DEFINE_TRACE(NGPhysicalFragmentBase) {
if (Type() == FragmentText)
if (Type() == kFragmentText)
static_cast<NGPhysicalTextFragment*>(this)->traceAfterDispatch(visitor);
else
static_cast<NGPhysicalFragment*>(this)->traceAfterDispatch(visitor);
}
void NGPhysicalFragmentBase::finalizeGarbageCollectedObject() {
if (Type() == FragmentText)
if (Type() == kFragmentText)
static_cast<NGPhysicalTextFragment*>(this)->~NGPhysicalTextFragment();
else
static_cast<NGPhysicalFragment*>(this)->~NGPhysicalFragment();
......
......@@ -25,7 +25,7 @@ namespace blink {
class CORE_EXPORT NGPhysicalFragmentBase
: public GarbageCollectedFinalized<NGPhysicalFragmentBase> {
public:
enum NGFragmentType { FragmentBox = 0, FragmentText = 1 };
enum NGFragmentType { kFragmentBox = 0, kFragmentText = 1 };
NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); }
......
......@@ -16,7 +16,7 @@ namespace blink {
class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragmentBase {
public:
NGPhysicalTextFragment(NGPhysicalSize size, NGPhysicalSize overflow)
: NGPhysicalFragmentBase(size, overflow, FragmentText) {}
: NGPhysicalFragmentBase(size, overflow, kFragmentText) {}
DEFINE_INLINE_TRACE_AFTER_DISPATCH() {
NGPhysicalFragmentBase::traceAfterDispatch(visitor);
......@@ -26,8 +26,8 @@ class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragmentBase {
DEFINE_TYPE_CASTS(NGPhysicalTextFragment,
NGPhysicalFragmentBase,
text,
text->Type() == NGPhysicalFragmentBase::FragmentText,
text.Type() == NGPhysicalFragmentBase::FragmentText);
text->Type() == NGPhysicalFragmentBase::kFragmentText,
text.Type() == NGPhysicalFragmentBase::kFragmentText);
} // namespace blink
......
......@@ -25,7 +25,7 @@ NGLayoutStatus NGTextLayoutAlgorithm::Layout(
NGLayoutAlgorithm**) {
// TODO(layout-dev): implement.
*fragment_out = nullptr;
return NewFragment;
return kNewFragment;
}
DEFINE_TRACE(NGTextLayoutAlgorithm) {
......
......@@ -14,8 +14,8 @@ LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const {
}
NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const {
return mode == HorizontalTopBottom ? NGPhysicalSize(inline_size, block_size)
: NGPhysicalSize(block_size, inline_size);
return mode == kHorizontalTopBottom ? NGPhysicalSize(inline_size, block_size)
: NGPhysicalSize(block_size, inline_size);
}
bool NGLogicalSize::operator==(const NGLogicalSize& other) const {
......@@ -24,8 +24,8 @@ bool NGLogicalSize::operator==(const NGLogicalSize& other) const {
}
NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const {
return mode == HorizontalTopBottom ? NGLogicalSize(width, height)
: NGLogicalSize(height, width);
return mode == kHorizontalTopBottom ? NGLogicalSize(width, height)
: NGLogicalSize(height, width);
}
bool NGLogicalRect::IsEmpty() const {
......@@ -58,14 +58,14 @@ NGPhysicalOffset NGLogicalOffset::ConvertToPhysical(
NGPhysicalSize outer_size,
NGPhysicalSize inner_size) const {
switch (mode) {
case HorizontalTopBottom:
case kHorizontalTopBottom:
if (direction == LTR)
return NGPhysicalOffset(inline_offset, block_offset);
else
return NGPhysicalOffset(
outer_size.width - inline_offset - inner_size.width, block_offset);
case VerticalRightLeft:
case SidewaysRightLeft:
case kVerticalRightLeft:
case kSidewaysRightLeft:
if (direction == LTR)
return NGPhysicalOffset(
outer_size.width - block_offset - inner_size.width, inline_offset);
......@@ -73,14 +73,14 @@ NGPhysicalOffset NGLogicalOffset::ConvertToPhysical(
return NGPhysicalOffset(
outer_size.width - block_offset - inner_size.width,
outer_size.height - inline_offset - inner_size.height);
case VerticalLeftRight:
case kVerticalLeftRight:
if (direction == LTR)
return NGPhysicalOffset(block_offset, inline_offset);
else
return NGPhysicalOffset(
block_offset,
outer_size.height - inline_offset - inner_size.height);
case SidewaysLeftRight:
case kSidewaysLeftRight:
if (direction == LTR)
return NGPhysicalOffset(
block_offset,
......@@ -150,17 +150,17 @@ NGBoxStrut NGPhysicalBoxStrut::ConvertToLogical(NGWritingMode writing_mode,
TextDirection direction) const {
NGBoxStrut strut;
switch (writing_mode) {
case HorizontalTopBottom:
case kHorizontalTopBottom:
strut = {left, right, top, bottom};
break;
case VerticalRightLeft:
case SidewaysRightLeft:
case kVerticalRightLeft:
case kSidewaysRightLeft:
strut = {top, bottom, right, left};
break;
case VerticalLeftRight:
case kVerticalLeftRight:
strut = {top, bottom, left, right};
break;
case SidewaysLeftRight:
case kSidewaysLeftRight:
strut = {bottom, top, left, right};
break;
}
......
......@@ -170,11 +170,11 @@ struct CORE_EXPORT NGExclusion {
enum Type {
// Undefined exclusion type.
// At this moment it's also used to represent CSS3 exclusion.
NG_EXCLUSION_TYPE_UNDEFINED = 0,
kExclusionTypeUndefined = 0,
// Exclusion that is created by LEFT float.
NG_FLOAT_LEFT = 1,
kFloatLeft = 1,
// Exclusion that is created by RIGHT float.
NG_FLOAT_RIGHT = 2
kFloatRight = 2
};
// Rectangle in logical coordinates the represents this exclusion.
......
......@@ -18,52 +18,52 @@ TEST(NGUnitsTest, ConvertLogicalOffsetToPhysicalOffset) {
NGPhysicalSize inner_size(LayoutUnit(5), LayoutUnit(65));
NGPhysicalOffset offset;
offset = logical_offset.ConvertToPhysical(HorizontalTopBottom, LTR,
offset = logical_offset.ConvertToPhysical(kHorizontalTopBottom, LTR,
outer_size, inner_size);
EXPECT_EQ(LayoutUnit(20), offset.left);
EXPECT_EQ(LayoutUnit(30), offset.top);
offset = logical_offset.ConvertToPhysical(HorizontalTopBottom, RTL,
offset = logical_offset.ConvertToPhysical(kHorizontalTopBottom, RTL,
outer_size, inner_size);
EXPECT_EQ(LayoutUnit(275), offset.left);
EXPECT_EQ(LayoutUnit(30), offset.top);
offset = logical_offset.ConvertToPhysical(VerticalRightLeft, LTR, outer_size,
offset = logical_offset.ConvertToPhysical(kVerticalRightLeft, LTR, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(265), offset.left);
EXPECT_EQ(LayoutUnit(20), offset.top);
offset = logical_offset.ConvertToPhysical(VerticalRightLeft, RTL, outer_size,
offset = logical_offset.ConvertToPhysical(kVerticalRightLeft, RTL, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(265), offset.left);
EXPECT_EQ(LayoutUnit(315), offset.top);
offset = logical_offset.ConvertToPhysical(SidewaysRightLeft, LTR, outer_size,
offset = logical_offset.ConvertToPhysical(kSidewaysRightLeft, LTR, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(265), offset.left);
EXPECT_EQ(LayoutUnit(20), offset.top);
offset = logical_offset.ConvertToPhysical(SidewaysRightLeft, RTL, outer_size,
offset = logical_offset.ConvertToPhysical(kSidewaysRightLeft, RTL, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(265), offset.left);
EXPECT_EQ(LayoutUnit(315), offset.top);
offset = logical_offset.ConvertToPhysical(VerticalLeftRight, LTR, outer_size,
offset = logical_offset.ConvertToPhysical(kVerticalLeftRight, LTR, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(30), offset.left);
EXPECT_EQ(LayoutUnit(20), offset.top);
offset = logical_offset.ConvertToPhysical(VerticalLeftRight, RTL, outer_size,
offset = logical_offset.ConvertToPhysical(kVerticalLeftRight, RTL, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(30), offset.left);
EXPECT_EQ(LayoutUnit(315), offset.top);
offset = logical_offset.ConvertToPhysical(SidewaysLeftRight, LTR, outer_size,
offset = logical_offset.ConvertToPhysical(kSidewaysLeftRight, LTR, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(30), offset.left);
EXPECT_EQ(LayoutUnit(315), offset.top);
offset = logical_offset.ConvertToPhysical(SidewaysLeftRight, RTL, outer_size,
offset = logical_offset.ConvertToPhysical(kSidewaysLeftRight, RTL, outer_size,
inner_size);
EXPECT_EQ(LayoutUnit(30), offset.left);
EXPECT_EQ(LayoutUnit(20), offset.top);
......@@ -75,27 +75,27 @@ TEST(NGUnitsTest, ConvertPhysicalStrutToLogical) {
LayoutUnit left{5}, right{10}, top{15}, bottom{20};
NGPhysicalBoxStrut physical{left, right, top, bottom};
NGBoxStrut logical = physical.ConvertToLogical(HorizontalTopBottom, LTR);
NGBoxStrut logical = physical.ConvertToLogical(kHorizontalTopBottom, LTR);
EXPECT_EQ(left, logical.inline_start);
EXPECT_EQ(top, logical.block_start);
logical = physical.ConvertToLogical(HorizontalTopBottom, RTL);
logical = physical.ConvertToLogical(kHorizontalTopBottom, RTL);
EXPECT_EQ(right, logical.inline_start);
EXPECT_EQ(top, logical.block_start);
logical = physical.ConvertToLogical(VerticalLeftRight, LTR);
logical = physical.ConvertToLogical(kVerticalLeftRight, LTR);
EXPECT_EQ(top, logical.inline_start);
EXPECT_EQ(left, logical.block_start);
logical = physical.ConvertToLogical(VerticalLeftRight, RTL);
logical = physical.ConvertToLogical(kVerticalLeftRight, RTL);
EXPECT_EQ(bottom, logical.inline_start);
EXPECT_EQ(left, logical.block_start);
logical = physical.ConvertToLogical(VerticalRightLeft, LTR);
logical = physical.ConvertToLogical(kVerticalRightLeft, LTR);
EXPECT_EQ(top, logical.inline_start);
EXPECT_EQ(right, logical.block_start);
logical = physical.ConvertToLogical(VerticalRightLeft, RTL);
logical = physical.ConvertToLogical(kVerticalRightLeft, RTL);
EXPECT_EQ(bottom, logical.inline_start);
EXPECT_EQ(right, logical.block_start);
}
......
......@@ -12,14 +12,14 @@ namespace blink {
NGWritingMode FromPlatformWritingMode(WritingMode mode) {
switch (mode) {
case TopToBottomWritingMode:
return HorizontalTopBottom;
return kHorizontalTopBottom;
case RightToLeftWritingMode:
return VerticalRightLeft;
return kVerticalRightLeft;
case LeftToRightWritingMode:
return VerticalLeftRight;
return kVerticalLeftRight;
default:
NOTREACHED();
return HorizontalTopBottom;
return kHorizontalTopBottom;
}
}
......
......@@ -11,11 +11,11 @@
namespace blink {
enum NGWritingMode {
HorizontalTopBottom = 0,
VerticalRightLeft = 1,
VerticalLeftRight = 2,
SidewaysRightLeft = 3,
SidewaysLeftRight = 4
kHorizontalTopBottom = 0,
kVerticalRightLeft = 1,
kVerticalLeftRight = 2,
kSidewaysRightLeft = 3,
kSidewaysLeftRight = 4
};
CORE_EXPORT NGWritingMode FromPlatformWritingMode(WritingMode);
......
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