Commit 175eb654 authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Commit Bot

Change in NGOutOfFlowLayoutPart

This patch stores a boolean instead of the NGConstraintSpace
in NGOutOfFlowLayoutPart.
That way container_space.HasBlockFragmentation() is only called
once for each NGOutOfFlowLayoutPart element.

BUG=1091797

Change-Id: I7cb19821e20503210d247e2167b7994308db7dea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526421
Commit-Queue: Manuel Rego <rego@igalia.com>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825778}
parent afd44191
...@@ -101,11 +101,11 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( ...@@ -101,11 +101,11 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart(
const NGConstraintSpace& container_space, const NGConstraintSpace& container_space,
NGBoxFragmentBuilder* container_builder, NGBoxFragmentBuilder* container_builder,
base::Optional<LogicalSize> initial_containing_block_fixed_size) base::Optional<LogicalSize> initial_containing_block_fixed_size)
: container_space_(container_space), : container_builder_(container_builder),
container_builder_(container_builder),
writing_mode_(container_style.GetWritingMode()), writing_mode_(container_style.GetWritingMode()),
is_absolute_container_(is_absolute_container), is_absolute_container_(is_absolute_container),
is_fixed_container_(is_fixed_container) { is_fixed_container_(is_fixed_container),
has_block_fragmentation_(container_space.HasBlockFragmentation()) {
if (!container_builder->HasOutOfFlowPositionedCandidates() && if (!container_builder->HasOutOfFlowPositionedCandidates() &&
!To<LayoutBlock>(container_builder_->GetLayoutObject()) !To<LayoutBlock>(container_builder_->GetLayoutObject())
->HasPositionedObjects()) ->HasPositionedObjects())
...@@ -129,7 +129,7 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( ...@@ -129,7 +129,7 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart(
void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) { void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) {
if (container_builder_->IsBlockFragmentationContextRoot() && if (container_builder_->IsBlockFragmentationContextRoot() &&
!container_space_.HasBlockFragmentation() && !has_block_fragmentation_ &&
container_builder_->HasOutOfFlowFragmentainerDescendants()) { container_builder_->HasOutOfFlowFragmentainerDescendants()) {
Vector<NGLogicalOutOfFlowPositionedNode> fragmentainer_descendants; Vector<NGLogicalOutOfFlowPositionedNode> fragmentainer_descendants;
container_builder_->SwapOutOfFlowFragmentainerDescendants( container_builder_->SwapOutOfFlowFragmentainerDescendants(
...@@ -194,7 +194,7 @@ void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) { ...@@ -194,7 +194,7 @@ void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) {
// every OOF candidate not in placed_objects, and treat them as a legacy // every OOF candidate not in placed_objects, and treat them as a legacy
// object (even if they aren't one), while in fact it could be an NG object // object (even if they aren't one), while in fact it could be an NG object
// that we have finished laying out in an earlier fragmentainer. Just bail. // that we have finished laying out in an earlier fragmentainer. Just bail.
if (container_space_.HasBlockFragmentation()) if (has_block_fragmentation_)
return; return;
wtf_size_t prev_placed_objects_size = placed_objects.size(); wtf_size_t prev_placed_objects_size = placed_objects.size();
...@@ -496,7 +496,7 @@ void NGOutOfFlowLayoutPart::LayoutCandidates( ...@@ -496,7 +496,7 @@ void NGOutOfFlowLayoutPart::LayoutCandidates(
candidate.static_position); candidate.static_position);
if (IsContainingBlockForCandidate(candidate) && if (IsContainingBlockForCandidate(candidate) &&
(!only_layout || layout_box == only_layout)) { (!only_layout || layout_box == only_layout)) {
if (container_space_.HasBlockFragmentation()) { if (has_block_fragmentation_) {
// If the containing block is fragmented, adjust the offset to be from // If the containing block is fragmented, adjust the offset to be from
// the first containing block fragment to the fragmentation context // the first containing block fragment to the fragmentation context
// root. Also, adjust the static position to be relative to the // root. Also, adjust the static position to be relative to the
......
...@@ -149,7 +149,6 @@ class CORE_EXPORT NGOutOfFlowLayoutPart { ...@@ -149,7 +149,6 @@ class CORE_EXPORT NGOutOfFlowLayoutPart {
wtf_size_t* start_index, wtf_size_t* start_index,
LogicalOffset* offset) const; LogicalOffset* offset) const;
const NGConstraintSpace& container_space_;
NGBoxFragmentBuilder* container_builder_; NGBoxFragmentBuilder* container_builder_;
ContainingBlockInfo default_containing_block_; ContainingBlockInfo default_containing_block_;
HashMap<const LayoutObject*, ContainingBlockInfo> containing_blocks_map_; HashMap<const LayoutObject*, ContainingBlockInfo> containing_blocks_map_;
...@@ -167,6 +166,7 @@ class CORE_EXPORT NGOutOfFlowLayoutPart { ...@@ -167,6 +166,7 @@ class CORE_EXPORT NGOutOfFlowLayoutPart {
bool is_absolute_container_; bool is_absolute_container_;
bool is_fixed_container_; bool is_fixed_container_;
bool allow_first_tier_oof_cache_; bool allow_first_tier_oof_cache_;
bool has_block_fragmentation_;
}; };
} // namespace blink } // namespace blink
......
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