Commit 86056635 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Make sure we don't have an outdated cached_result_

cached_result_ is used for CurrentFragment(); we need to make sure it
is up-to-date. Therefore, we can't just refuse to store a fragment
if we have unpositioned floats. Instead, we just store the new
fragment in these cases and handle the check when checking whether
we can reuse the fragment.

This supersedes https://crrev.com/c/1001722

Bug: 591099
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I934d2290ec496da6dbdd4a8a9c5e3dc78907049e
Reviewed-on: https://chromium-review.googlesource.com/1004586Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549531}
parent 904e7cbb
......@@ -131,6 +131,9 @@ scoped_refptr<NGLayoutResult> LayoutNGMixin<Base>::CachedLayoutResult(
return nullptr;
if (constraint_space != *cached_constraint_space_)
return nullptr;
if (cached_constraint_space_->UnpositionedFloats().size() ||
cached_result_->UnpositionedFloats().size())
return nullptr;
return cached_result_->CloneWithoutOffset();
}
......@@ -139,9 +142,7 @@ void LayoutNGMixin<Base>::SetCachedLayoutResult(
const NGConstraintSpace& constraint_space,
NGBreakToken* break_token,
scoped_refptr<NGLayoutResult> layout_result) {
if (break_token || constraint_space.UnpositionedFloats().size() ||
layout_result->UnpositionedFloats().size() ||
layout_result->Status() != NGLayoutResult::kSuccess) {
if (break_token || layout_result->Status() != NGLayoutResult::kSuccess) {
// We can't cache these yet
return;
}
......
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