Commit 59259586 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

blink: reorder NGConstaintSpace to match style guide

Specifically make it match the declaration order section:
https://engdoc.corp.google.com/eng/doc/devguide/cpp/styleguide.md?cl=head#Declaration_Order

BUG=none
TEST=none

Change-Id: I9380461c30c01d6c6d605764ac3638993dffd991
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2055048Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741196}
parent f4c5ef76
...@@ -632,9 +632,6 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -632,9 +632,6 @@ class CORE_EXPORT NGConstraintSpace final {
private: private:
friend class NGConstraintSpaceBuilder; friend class NGConstraintSpaceBuilder;
explicit NGConstraintSpace(WritingMode writing_mode)
: bfc_offset_(), bitfields_(writing_mode) {}
// This struct defines all of the inputs to layout which we consider rare. // This struct defines all of the inputs to layout which we consider rare.
// Primarily this is: // Primarily this is:
// - Percentage resolution sizes which differ from the available size or // - Percentage resolution sizes which differ from the available size or
...@@ -650,6 +647,16 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -650,6 +647,16 @@ class CORE_EXPORT NGConstraintSpace final {
USING_FAST_MALLOC(RareData); USING_FAST_MALLOC(RareData);
public: public:
// |RareData| unions different types of data which are mutually exclusive.
// They fall into the following categories:
enum DataUnionType {
kNone,
kBlockData, // An inflow block which doesn't establish a new FC.
kTableCellData, // A table-cell (display: table-cell).
kCustomData, // A custom layout (display: layout(foo)).
kStretchData // The target inline/block stretch sizes for MathML.
};
explicit RareData(const NGBfcOffset bfc_offset) explicit RareData(const NGBfcOffset bfc_offset)
: bfc_offset(bfc_offset), : bfc_offset(bfc_offset),
data_union_type(static_cast<unsigned>(kNone)), data_union_type(static_cast<unsigned>(kNone)),
...@@ -716,33 +723,6 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -716,33 +723,6 @@ class CORE_EXPORT NGConstraintSpace final {
} }
} }
// |RareData| unions different types of data which are mutually exclusive.
// They fall into the following categories:
enum DataUnionType {
kNone,
kBlockData, // An inflow block which doesn't establish a new FC.
kTableCellData, // A table-cell (display: table-cell).
kCustomData, // A custom layout (display: layout(foo)).
kStretchData // The target inline/block stretch sizes for MathML.
};
LogicalSize percentage_resolution_size;
LayoutUnit replaced_percentage_resolution_block_size;
NGBfcOffset bfc_offset;
LayoutUnit fragmentainer_block_size = kIndefiniteSize;
LayoutUnit fragmentainer_offset_at_bfc;
unsigned data_union_type : 3;
unsigned is_restricted_block_size_table_cell : 1;
unsigned hide_table_cell_if_empty : 1;
unsigned block_direction_fragmentation_type : 2;
unsigned is_inside_balanced_columns : 1;
unsigned is_in_column_bfc : 1;
unsigned early_break_appeal : 2; // NGBreakAppeal
bool MaySkipLayout(const RareData& other) const { bool MaySkipLayout(const RareData& other) const {
if (fragmentainer_block_size != other.fragmentainer_block_size || if (fragmentainer_block_size != other.fragmentainer_block_size ||
fragmentainer_offset_at_bfc != other.fragmentainer_offset_at_bfc || fragmentainer_offset_at_bfc != other.fragmentainer_offset_at_bfc ||
...@@ -907,6 +887,23 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -907,6 +887,23 @@ class CORE_EXPORT NGConstraintSpace final {
target_stretch_descent_size; target_stretch_descent_size;
} }
LogicalSize percentage_resolution_size;
LayoutUnit replaced_percentage_resolution_block_size;
NGBfcOffset bfc_offset;
LayoutUnit fragmentainer_block_size = kIndefiniteSize;
LayoutUnit fragmentainer_offset_at_bfc;
unsigned data_union_type : 3;
unsigned is_restricted_block_size_table_cell : 1;
unsigned hide_table_cell_if_empty : 1;
unsigned block_direction_fragmentation_type : 2;
unsigned is_inside_balanced_columns : 1;
unsigned is_in_column_bfc : 1;
unsigned early_break_appeal : 2; // NGBreakAppeal
private: private:
struct BlockData { struct BlockData {
NGMarginStrut margin_strut; NGMarginStrut margin_strut;
...@@ -915,20 +912,7 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -915,20 +912,7 @@ class CORE_EXPORT NGConstraintSpace final {
LayoutUnit clearance_offset = LayoutUnit::Min(); LayoutUnit clearance_offset = LayoutUnit::Min();
}; };
BlockData* EnsureBlockData() {
DCHECK(data_union_type == kNone || data_union_type == kBlockData);
if (data_union_type != kBlockData) {
data_union_type = kBlockData;
new (&block_data_) BlockData();
}
return &block_data_;
}
struct TableCellData { struct TableCellData {
NGBoxStrut table_cell_borders;
LayoutUnit table_cell_intrinsic_padding_block_start;
LayoutUnit table_cell_intrinsic_padding_block_end;
bool MaySkipLayout(const TableCellData& other) const { bool MaySkipLayout(const TableCellData& other) const {
return table_cell_borders == other.table_cell_borders && return table_cell_borders == other.table_cell_borders &&
table_cell_intrinsic_padding_block_start == table_cell_intrinsic_padding_block_start ==
...@@ -942,16 +926,11 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -942,16 +926,11 @@ class CORE_EXPORT NGConstraintSpace final {
table_cell_intrinsic_padding_block_start == LayoutUnit() && table_cell_intrinsic_padding_block_start == LayoutUnit() &&
table_cell_intrinsic_padding_block_end == LayoutUnit(); table_cell_intrinsic_padding_block_end == LayoutUnit();
} }
};
TableCellData* EnsureTableCellData() { NGBoxStrut table_cell_borders;
DCHECK(data_union_type == kNone || data_union_type == kTableCellData); LayoutUnit table_cell_intrinsic_padding_block_start;
if (data_union_type != kTableCellData) { LayoutUnit table_cell_intrinsic_padding_block_end;
data_union_type = kTableCellData; };
new (&table_cell_data_) TableCellData();
}
return &table_cell_data_;
}
struct CustomData { struct CustomData {
scoped_refptr<SerializedScriptValue> data; scoped_refptr<SerializedScriptValue> data;
...@@ -963,20 +942,7 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -963,20 +942,7 @@ class CORE_EXPORT NGConstraintSpace final {
bool IsInitialForMaySkipLayout() const { return !data; } bool IsInitialForMaySkipLayout() const { return !data; }
}; };
CustomData* EnsureCustomData() {
DCHECK(data_union_type == kNone || data_union_type == kCustomData);
if (data_union_type != kCustomData) {
data_union_type = kCustomData;
new (&custom_data_) CustomData();
}
return &custom_data_;
}
struct StretchData { struct StretchData {
LayoutUnit target_stretch_inline_size = kIndefiniteSize;
LayoutUnit target_stretch_ascent_size = kIndefiniteSize;
LayoutUnit target_stretch_descent_size = kIndefiniteSize;
bool MaySkipLayout(const StretchData& other) const { bool MaySkipLayout(const StretchData& other) const {
return target_stretch_inline_size == other.target_stretch_inline_size && return target_stretch_inline_size == other.target_stretch_inline_size &&
target_stretch_ascent_size == other.target_stretch_ascent_size && target_stretch_ascent_size == other.target_stretch_ascent_size &&
...@@ -988,8 +954,39 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -988,8 +954,39 @@ class CORE_EXPORT NGConstraintSpace final {
target_stretch_ascent_size == kIndefiniteSize && target_stretch_ascent_size == kIndefiniteSize &&
target_stretch_descent_size == kIndefiniteSize; target_stretch_descent_size == kIndefiniteSize;
} }
LayoutUnit target_stretch_inline_size = kIndefiniteSize;
LayoutUnit target_stretch_ascent_size = kIndefiniteSize;
LayoutUnit target_stretch_descent_size = kIndefiniteSize;
}; };
BlockData* EnsureBlockData() {
DCHECK(data_union_type == kNone || data_union_type == kBlockData);
if (data_union_type != kBlockData) {
data_union_type = kBlockData;
new (&block_data_) BlockData();
}
return &block_data_;
}
TableCellData* EnsureTableCellData() {
DCHECK(data_union_type == kNone || data_union_type == kTableCellData);
if (data_union_type != kTableCellData) {
data_union_type = kTableCellData;
new (&table_cell_data_) TableCellData();
}
return &table_cell_data_;
}
CustomData* EnsureCustomData() {
DCHECK(data_union_type == kNone || data_union_type == kCustomData);
if (data_union_type != kCustomData) {
data_union_type = kCustomData;
new (&custom_data_) CustomData();
}
return &custom_data_;
}
StretchData* EnsureStretchData() { StretchData* EnsureStretchData() {
DCHECK(data_union_type == kNone || data_union_type == kStretchData); DCHECK(data_union_type == kNone || data_union_type == kStretchData);
if (data_union_type != kStretchData) { if (data_union_type != kStretchData) {
...@@ -1099,6 +1096,9 @@ class CORE_EXPORT NGConstraintSpace final { ...@@ -1099,6 +1096,9 @@ class CORE_EXPORT NGConstraintSpace final {
unsigned replaced_percentage_block_storage : 2; // NGPercentageStorage unsigned replaced_percentage_block_storage : 2; // NGPercentageStorage
}; };
explicit NGConstraintSpace(WritingMode writing_mode)
: bfc_offset_(), bitfields_(writing_mode) {}
inline bool HasRareData() const { return bitfields_.has_rare_data; } inline bool HasRareData() const { return bitfields_.has_rare_data; }
RareData* EnsureRareData() { RareData* EnsureRareData() {
......
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