Skip to content

Commit

Permalink
FrameSet NG: Add FrameSetLayoutData
Browse files Browse the repository at this point in the history
This is a preparation to add NGFrameSetLayoutAlgorithm.
This CL has no behavior changes.

Bug: 1346221
Change-Id: Iec8b1c765f8deebe4dd737b68e74530bf09833ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3818343
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032869}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Aug 9, 2022
1 parent 0b15ea5 commit 687ed73
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions third_party/blink/renderer/core/layout/build.gni
Expand Up @@ -343,6 +343,7 @@ blink_core_sources_layout = [
"ng/flex/ng_flex_layout_algorithm.cc",
"ng/flex/ng_flex_layout_algorithm.h",
"ng/flex/ng_flex_line.h",
"ng/frame_set_layout_data.h",
"ng/geometry/ng_bfc_offset.cc",
"ng/geometry/ng_bfc_offset.h",
"ng/geometry/ng_bfc_rect.h",
Expand Down
31 changes: 31 additions & 0 deletions third_party/blink/renderer/core/layout/ng/frame_set_layout_data.h
@@ -0,0 +1,31 @@
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_FRAME_SET_LAYOUT_DATA_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_FRAME_SET_LAYOUT_DATA_H_

#include "third_party/blink/renderer/platform/geometry/layout_unit.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"

namespace blink {

// An instance of FrameSetLayoutData is produced by NGFrameSetLayoutAlgorithm,
// and is owned by NGBoxFragmentBuilder and NGPhysicalBoxFragment. It is used
// by NGFrameSetPainter and resize handling of HTMLFrameSetElement.
struct FrameSetLayoutData {
// Frame grid sizes.
Vector<LayoutUnit> col_sizes;
Vector<LayoutUnit> row_sizes;

// Border existence.
Vector<bool> col_allow_border;
Vector<bool> row_allow_border;

int border_thickness;
bool has_border_color;
};

} // namespace blink

#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_FRAME_SET_LAYOUT_DATA_H_
Expand Up @@ -12,6 +12,7 @@
#include "third_party/blink/renderer/core/layout/geometry/box_sides.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/ng/flex/ng_flex_data.h"
#include "third_party/blink/renderer/core/layout/ng/frame_set_layout_data.h"
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_box_strut.h"
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_fragment_geometry.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_fragment_items_builder.h"
Expand Down Expand Up @@ -607,6 +608,9 @@ class CORE_EXPORT NGBoxFragmentBuilder final
std::unique_ptr<DevtoolsFlexInfo> flex_layout_data) {
flex_layout_data_ = std::move(flex_layout_data);
}
void TransferFrameSetLayoutData(std::unique_ptr<FrameSetLayoutData> data) {
frame_set_layout_data_ = std::move(data);
}

const NGGridLayoutData& GridLayoutData() const {
DCHECK(grid_layout_data_);
Expand Down Expand Up @@ -776,6 +780,7 @@ class CORE_EXPORT NGBoxFragmentBuilder final
std::unique_ptr<NGGridLayoutData> grid_layout_data_;

std::unique_ptr<DevtoolsFlexInfo> flex_layout_data_;
std::unique_ptr<FrameSetLayoutData> frame_set_layout_data_;

LogicalBoxSides sides_to_include_;

Expand Down
Expand Up @@ -193,7 +193,8 @@ const NGPhysicalBoxFragment* NGPhysicalBoxFragment::Create(
has_fragment_items = true;
}

bool has_rare_data = builder->mathml_paint_info_ ||
bool has_rare_data = builder->frame_set_layout_data_ ||
builder->mathml_paint_info_ ||
builder->table_grid_rect_ ||
!builder->table_column_geometries_.IsEmpty() ||
builder->table_collapsed_borders_ ||
Expand Down Expand Up @@ -581,7 +582,8 @@ NGPhysicalFragment::FragmentedOutOfFlowDataFromBuilder(
}

NGPhysicalBoxFragment::RareData::RareData(NGBoxFragmentBuilder* builder)
: mathml_paint_info(std::move(builder->mathml_paint_info_)) {
: frame_set_layout_data(std::move(builder->frame_set_layout_data_)),
mathml_paint_info(std::move(builder->mathml_paint_info_)) {
if (builder->table_grid_rect_)
table_grid_rect = *builder->table_grid_rect_;
if (!builder->table_column_geometries_.IsEmpty())
Expand Down
Expand Up @@ -25,6 +25,7 @@ namespace blink {

class NGBoxFragmentBuilder;
enum class NGOutlineType;
struct FrameSetLayoutData;

class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
public:
Expand Down Expand Up @@ -388,6 +389,10 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
bool check_same_block_size) const;
#endif

const FrameSetLayoutData* GetFrameSetLayoutData() const {
return ComputeRareDataAddress()->frame_set_layout_data.get();
}

bool HasExtraMathMLPainting() const {
if (IsMathMLFraction())
return true;
Expand Down Expand Up @@ -487,6 +492,7 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
explicit RareData(NGBoxFragmentBuilder*);
void Trace(Visitor*) const;

const std::unique_ptr<const FrameSetLayoutData> frame_set_layout_data;
const std::unique_ptr<const NGMathMLPaintInfo> mathml_paint_info;

// Table rare-data.
Expand Down

0 comments on commit 687ed73

Please sign in to comment.