Commit 7c8ab0bb authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Check if updating |CachedLayoutResult| failed for unexpected cause

r671460 (crrev.com/c/1670146) called |SetNeedsLayout| when
updating |CachedLayoutResult| failed for any reasons. It was
pointed out that we'd like to notice if it failed for other
reasons than |ComputeMinMax|, so this patch changes it to
|NOTREACHED()|.

Still calls |SetNeedsLayout()| because not doing so can lead
to bad results.

Change-Id: I39b77f748628efda354c64258dffbd92b8d59b1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1673845Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671678}
parent f0b0f5b1
......@@ -1038,8 +1038,16 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::RunLegacyLayout(
// If |SetCachedLayoutResult| did not update cached |LayoutResult|,
// |NeedsLayout()| flag should not be cleared.
if (needed_layout && layout_result != box_->GetCachedLayoutResult()) {
box_->SetNeedsLayout(layout_invalidation_reason::kUnknown);
if (needed_layout) {
if (constraint_space.IsIntermediateLayout()) {
DCHECK_NE(layout_result, box_->GetCachedLayoutResult());
box_->SetNeedsLayout(layout_invalidation_reason::kUnknown);
} else if (layout_result != box_->GetCachedLayoutResult()) {
// TODO(kojii): If we failed to update CachedLayoutResult for other
// reasons, we'd like to review it.
NOTREACHED();
box_->SetNeedsLayout(layout_invalidation_reason::kUnknown);
}
}
} else if (layout_result) {
// OOF-positioned nodes have a two-tier cache, and their layout results
......
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