| Index: third_party/WebKit/Source/core/frame/FrameView.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| index 9d93a5fb2b42126d2194a639970391c26ef15663..4540fb1dbad6fbd565bbdc172167e82988b3e6fa 100644
|
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| @@ -121,6 +121,20 @@
|
| #include "wtf/StdLibExtras.h"
|
| #include <memory>
|
|
|
| +// Change the the following line to "#if 0" to disable crash on unexpected
|
| +// dirty layout (crbug.com/590856) when dcheck is off.
|
| +#if 1
|
| +#define CHECK_FOR_DIRTY_LAYOUT CHECK
|
| +#else
|
| +#define CHECK_FOR_DIRTY_LAYOUT(arg) \
|
| +do { \
|
| + if (!(arg)) { \
|
| + NOTREACHED(); \
|
| + return false; \
|
| + } \
|
| +} while (false)
|
| +#endif
|
| +
|
| namespace blink {
|
|
|
| using namespace HTMLNames;
|
| @@ -1845,16 +1859,15 @@ void FrameView::layoutOrthogonalWritingModeRoots()
|
| }
|
| }
|
|
|
| -void FrameView::checkLayoutInvalidationIsAllowed() const
|
| +bool FrameView::checkLayoutInvalidationIsAllowed() const
|
| {
|
| if (m_allowsLayoutInvalidationAfterLayoutClean)
|
| - return;
|
| -
|
| - if (!m_frame->document())
|
| - return;
|
| + return true;
|
|
|
| // If we are updating all lifecycle phases beyond LayoutClean, we don't expect dirty layout after LayoutClean.
|
| - CHECK(lifecycle().state() < DocumentLifecycle::LayoutClean);
|
| + CHECK_FOR_DIRTY_LAYOUT(lifecycle().state() < DocumentLifecycle::LayoutClean);
|
| +
|
| + return true;
|
| }
|
|
|
| void FrameView::scheduleRelayout()
|
| @@ -1863,9 +1876,9 @@ void FrameView::scheduleRelayout()
|
|
|
| if (!m_layoutSchedulingEnabled)
|
| return;
|
| -
|
| - checkLayoutInvalidationIsAllowed();
|
| -
|
| + // TODO(crbug.com/590856): It's still broken when we choose not to crash when the check fails.
|
| + if (!checkLayoutInvalidationIsAllowed())
|
| + return;
|
| if (!needsLayout())
|
| return;
|
| if (!m_frame->document()->shouldScheduleLayout())
|
| @@ -1886,7 +1899,9 @@ void FrameView::scheduleRelayoutOfSubtree(LayoutObject* relayoutRoot)
|
| {
|
| DCHECK(m_frame->view() == this);
|
|
|
| - checkLayoutInvalidationIsAllowed();
|
| + // TODO(crbug.com/590856): It's still broken when we choose not to crash when the check fails.
|
| + if (!checkLayoutInvalidationIsAllowed())
|
| + return;
|
|
|
| // FIXME: Should this call shouldScheduleLayout instead?
|
| if (!m_frame->document()->isActive())
|
| @@ -1938,20 +1953,23 @@ bool FrameView::needsLayout() const
|
| || isSubtreeLayout();
|
| }
|
|
|
| -NOINLINE void FrameView::checkDoesNotNeedLayout() const
|
| +NOINLINE bool FrameView::checkDoesNotNeedLayout() const
|
| {
|
| - CHECK(!layoutPending());
|
| - CHECK(layoutViewItem().isNull() || !layoutViewItem().needsLayout());
|
| - CHECK(!isSubtreeLayout());
|
| + CHECK_FOR_DIRTY_LAYOUT(!layoutPending());
|
| + CHECK_FOR_DIRTY_LAYOUT(layoutViewItem().isNull() || !layoutViewItem().needsLayout());
|
| + CHECK_FOR_DIRTY_LAYOUT(!isSubtreeLayout());
|
| + return true;
|
| }
|
|
|
| void FrameView::setNeedsLayout()
|
| {
|
| - checkLayoutInvalidationIsAllowed();
|
| -
|
| LayoutViewItem layoutViewItem = this->layoutViewItem();
|
| - if (!layoutViewItem.isNull())
|
| - layoutViewItem.setNeedsLayout(LayoutInvalidationReason::Unknown);
|
| + if (layoutViewItem.isNull())
|
| + return;
|
| + // TODO(crbug.com/590856): It's still broken if we choose not to crash when the check fails.
|
| + if (!checkLayoutInvalidationIsAllowed())
|
| + return;
|
| + layoutViewItem.setNeedsLayout(LayoutInvalidationReason::Unknown);
|
| }
|
|
|
| bool FrameView::isTransparent() const
|
|
|