Skip to content

Commit 65dcf3d

Browse files
mstenshoChromium LUCI CQ
authored andcommitted
Don't store bools in NGLayoutResult::RareData().
There's plenty of room in NGLayoutResult::Bitfields. Change-Id: If0138c4385acde5b0cc4762876c941d854decf48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3132980 Commit-Queue: Ian Kilpatrick <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/main@{#916813}
1 parent 50eb0e9 commit 65dcf3d

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

third_party/blink/renderer/core/layout/ng/ng_layout_result.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ NGLayoutResult::NGLayoutResult(
8484
rare_data->minimal_space_shortage = builder->minimal_space_shortage_;
8585
}
8686

87-
rare_data->has_violating_break =
87+
bitfields_.has_violating_break =
8888
builder->HasViolatingDescendantBreak() ||
8989
(builder->DidBreakSelf() &&
9090
builder->break_appeal_ < kBreakAppealPerfect);
@@ -244,8 +244,7 @@ NGLayoutResult::NGLayoutResult(
244244

245245
if (builder->column_spanner_) {
246246
EnsureRareData()->column_spanner = builder->column_spanner_;
247-
EnsureRareData()->is_empty_spanner_parent =
248-
builder->is_empty_spanner_parent_;
247+
bitfields_.is_empty_spanner_parent = builder->is_empty_spanner_parent_;
249248
}
250249

251250
if (HasRareData()) {

third_party/blink/renderer/core/layout/ng/ng_layout_result.h

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,16 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
112112
return HasRareData() ? rare_data_->column_spanner : NGBlockNode(nullptr);
113113
}
114114

115+
// True if this result is the parent of a column spanner and is empty (i.e.
116+
// has no children). This is used to determine whether the column spanner
117+
// margins should collapse. Note that |is_empty_spanner_parent| may be false
118+
// even if this column spanner parent is actually empty. This can happen in
119+
// the case where the spanner parent has no children but has not broken
120+
// previously - in which case, we shouldn't collapse the spanner margins since
121+
// we do not want to collapse margins with a column spanner outside of this
122+
// parent.
115123
bool IsEmptySpannerParent() const {
116-
return HasRareData() && rare_data_->is_empty_spanner_parent;
124+
return bitfields_.is_empty_spanner_parent;
117125
}
118126

119127
const NGEarlyBreak* GetEarlyBreak() const {
@@ -219,9 +227,7 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
219227
// by break-{after,before,inside}:avoid or orphans / widows, or if we had to
220228
// break at an invalid breakpoint (e.g. before/after the first/last
221229
// child). This is used for column balancing.
222-
bool HasViolatingBreak() const {
223-
return HasRareData() && rare_data_->has_violating_break;
224-
}
230+
bool HasViolatingBreak() const { return bitfields_.has_violating_break; }
225231

226232
SerializedScriptValue* CustomLayoutData() const {
227233
return HasRareData() ? rare_data_->custom_layout_data.get() : nullptr;
@@ -449,7 +455,6 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
449455
line_box_bfc_block_offset(rare_data.line_box_bfc_block_offset),
450456
annotation_overflow(rare_data.annotation_overflow),
451457
block_end_annotation_space(rare_data.block_end_annotation_space),
452-
has_violating_break(rare_data.has_violating_break),
453458
lines_until_clamp(rare_data.lines_until_clamp),
454459
table_column_count_(rare_data.table_column_count_),
455460
math_layout_data_(rare_data.math_layout_data_) {
@@ -485,16 +490,6 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
485490
absl::optional<LayoutUnit> line_box_bfc_block_offset;
486491
LayoutUnit annotation_overflow;
487492
LayoutUnit block_end_annotation_space;
488-
bool has_violating_break = false;
489-
// True if this result is the parent of a column spanner and is empty (i.e.
490-
// has no children). This is used to determine whether the column spanner
491-
// margins should collapse. Note that |is_empty_spanner_parent| may be false
492-
// even if this column spanner parent is actually empty. This can happen in
493-
// the case where the spanner parent has no children but has not broken
494-
// previously - in which case, we shouldn't collapse the spanner margins
495-
// since we do not want to collapse margins with a column spanner outside of
496-
// this parent.
497-
bool is_empty_spanner_parent = false;
498493
int lines_until_clamp = 0;
499494
wtf_size_t table_column_count_ = 0;
500495
std::unique_ptr<const NGGridData> grid_layout_data_;
@@ -551,6 +546,8 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
551546
unsigned is_bfc_block_offset_nullopt : 1;
552547

553548
unsigned has_forced_break : 1;
549+
unsigned has_violating_break : 1;
550+
unsigned is_empty_spanner_parent : 1;
554551

555552
unsigned is_self_collapsing : 1;
556553
unsigned is_pushed_by_floats : 1;

0 commit comments

Comments
 (0)