Commit bade42c5 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Turn AssertLaidOut into a CHECK for LayoutNG

Bug: 946004
Change-Id: I9e2aa69a32f7a0373196d57e629256dbc7d78d2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540305Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644907}
parent 261ab98f
...@@ -961,11 +961,11 @@ void LocalFrameView::UpdateLayout() { ...@@ -961,11 +961,11 @@ void LocalFrameView::UpdateLayout() {
if (nested_layout_count_) if (nested_layout_count_)
return; 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 // Post-layout assert that nobody was re-marked as needing layout during
// layout. // layout.
GetLayoutView()->AssertSubtreeIsLaidOut(); GetLayoutView()->AssertSubtreeIsLaidOut();
#endif
if (frame_->IsMainFrame()) { if (frame_->IsMainFrame()) {
// Scrollbars changing state can cause a visual viewport size change. // Scrollbars changing state can cause a visual viewport size change.
...@@ -2886,9 +2886,9 @@ void LocalFrameView::UpdateStyleAndLayoutIfNeededRecursive() { ...@@ -2886,9 +2886,9 @@ void LocalFrameView::UpdateStyleAndLayoutIfNeededRecursive() {
// These asserts ensure that parent frames are clean, when child frames // These asserts ensure that parent frames are clean, when child frames
// finished updating layout and style. // finished updating layout and style.
CheckDoesNotNeedLayout(); 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(); frame_->GetDocument()->GetLayoutView()->AssertLaidOut();
#endif
UpdateGeometriesIfNeeded(); UpdateGeometriesIfNeeded();
......
...@@ -392,6 +392,11 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -392,6 +392,11 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
LayoutObject& layout_object_; LayoutObject& layout_object_;
bool preexisting_forbidden_; 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 { void AssertLaidOut() const {
#ifndef NDEBUG #ifndef NDEBUG
...@@ -399,9 +404,16 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -399,9 +404,16 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
ShowLayoutTreeForThis(); ShowLayoutTreeForThis();
#endif #endif
SECURITY_DCHECK(!NeedsLayout() || LayoutBlockedByDisplayLock()); SECURITY_DCHECK(!NeedsLayout() || LayoutBlockedByDisplayLock());
if (!RuntimeEnabledFeatures::LayoutNGEnabled())
return;
CHECK(!NeedsLayout() || LayoutBlockedByDisplayLock()) << this;
} }
void AssertSubtreeIsLaidOut() const { void AssertSubtreeIsLaidOut() const {
#if !DCHECK_IS_ON()
if (!RuntimeEnabledFeatures::LayoutNGEnabled())
return;
#endif
for (const LayoutObject* layout_object = this; layout_object; for (const LayoutObject* layout_object = this; layout_object;
layout_object = layout_object->LayoutBlockedByDisplayLock() layout_object = layout_object->LayoutBlockedByDisplayLock()
? layout_object->NextInPreOrderAfterChildren() ? layout_object->NextInPreOrderAfterChildren()
...@@ -410,6 +422,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -410,6 +422,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
} }
} }
#if DCHECK_IS_ON()
void AssertClearedPaintInvalidationFlags() const { void AssertClearedPaintInvalidationFlags() const {
#ifndef NDEBUG #ifndef NDEBUG
if (PaintInvalidationStateIsDirty() && !PrePaintBlockedByDisplayLock()) { if (PaintInvalidationStateIsDirty() && !PrePaintBlockedByDisplayLock()) {
...@@ -428,7 +441,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -428,7 +441,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
} }
} }
#endif #endif // DCHECK_IS_ON()
// LayoutObject tree manipulation // 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