Commit 26ca019a authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Reland "[LayoutNG] Turn AssertLaidOut into a CHECK for LayoutNG"

This reverts commit ec11fe81.

Reason for revert: Try to catch more crashes in the wild after
a fix (crrev.com/c/1546713) has been landed.

Original change's description:
> Revert "[LayoutNG] Turn AssertLaidOut into a CHECK for LayoutNG"
> 
> This reverts commit bade42c5.
> 
> Reason for revert: New crashes already caught. Reverting CHECKs
> back into DCHECKs to reduce noises.
> 
> Original change's description:
> > [LayoutNG] Turn AssertLaidOut into a CHECK for LayoutNG
> > 
> > Bug: 946004
> > Change-Id: I9e2aa69a32f7a0373196d57e629256dbc7d78d2a
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540305
> > Reviewed-by: Koji Ishii <kojii@chromium.org>
> > Reviewed-by: Emil A Eklund <eae@chromium.org>
> > Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#644907}
> 
> TBR=eae@chromium.org,kojii@chromium.org,xiaochengh@chromium.org
> 
> Change-Id: I15fb43370f58757e09e7b7abc7c40d4af4a6101a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 946004
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1544156
> Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#645407}

TBR=eae@chromium.org,kojii@chromium.org,xiaochengh@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 946004
Change-Id: Iccb8c2b998d28f659381c3f89a1686614600860c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1548248Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646516}
parent 6f719904
......@@ -961,11 +961,11 @@ void LocalFrameView::UpdateLayout() {
if (nested_layout_count_)
return;
#if DCHECK_IS_ON()
// TODO(crbug.com/946004): Move the following line into a DCHECK_IS_ON() block
// when we no longer see missing layout reports in LayoutNG.
// Post-layout assert that nobody was re-marked as needing layout during
// layout.
GetLayoutView()->AssertSubtreeIsLaidOut();
#endif
if (frame_->IsMainFrame()) {
// Scrollbars changing state can cause a visual viewport size change.
......@@ -2884,9 +2884,9 @@ void LocalFrameView::UpdateStyleAndLayoutIfNeededRecursive() {
// These asserts ensure that parent frames are clean, when child frames
// finished updating layout and style.
CheckDoesNotNeedLayout();
#if DCHECK_IS_ON()
// TODO(crbug.com/946004): Move the following line into a DCHECK_IS_ON() block
// when we no longer see missing layout reports in LayoutNG.
frame_->GetDocument()->GetLayoutView()->AssertLaidOut();
#endif
UpdateGeometriesIfNeeded();
......
......@@ -392,6 +392,11 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
LayoutObject& layout_object_;
bool preexisting_forbidden_;
};
#endif // DCHECK_IS_ON()
// TODO(crbug.com/946004): When we no longer see missing layouts in LayoutNG,
// move the following two functions back to the DCHECK_IS_ON() block and
// remove relevant branches and CHECK.
void AssertLaidOut() const {
#ifndef NDEBUG
......@@ -399,9 +404,16 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
ShowLayoutTreeForThis();
#endif
SECURITY_DCHECK(!NeedsLayout() || LayoutBlockedByDisplayLock());
if (!RuntimeEnabledFeatures::LayoutNGEnabled())
return;
CHECK(!NeedsLayout() || LayoutBlockedByDisplayLock()) << this;
}
void AssertSubtreeIsLaidOut() const {
#if !DCHECK_IS_ON()
if (!RuntimeEnabledFeatures::LayoutNGEnabled())
return;
#endif
for (const LayoutObject* layout_object = this; layout_object;
layout_object = layout_object->LayoutBlockedByDisplayLock()
? layout_object->NextInPreOrderAfterChildren()
......@@ -410,6 +422,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
}
}
#if DCHECK_IS_ON()
void AssertClearedPaintInvalidationFlags() const {
#ifndef NDEBUG
if (PaintInvalidationStateIsDirty() && !PrePaintBlockedByDisplayLock()) {
......@@ -428,7 +441,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
}
}
#endif
#endif // DCHECK_IS_ON()
// LayoutObject tree manipulation
//////////////////////////////////////////
......
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