Commit cff74f3e authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Fix incorrect DCHECK

Reduces crashes in the enabling CL[1].

[1] https://crrev.com/c/1719913

Bug: 988015
Change-Id: I78cbd3730957616ce5f70e9c69368a18b1d9d996
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757965
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Auto-Submit: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687693}
parent 349a8363
...@@ -187,14 +187,16 @@ inline NGBoxFragmentPainter::NGBoxFragmentPainter( ...@@ -187,14 +187,16 @@ inline NGBoxFragmentPainter::NGBoxFragmentPainter(
paint_fragment_(paint_fragment) { paint_fragment_(paint_fragment) {
DCHECK(box.IsBox() || box.IsRenderedLegend()); DCHECK(box.IsBox() || box.IsRenderedLegend());
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
if (box.ChildrenInline() || box.IsInlineBox()) { if ((box.ChildrenInline() && !box.Children().empty()) || box.IsInlineBox()) {
DCHECK(paint_fragment); DCHECK(paint_fragment);
DCHECK_EQ(&paint_fragment->PhysicalFragment(), &box); DCHECK_EQ(&paint_fragment->PhysicalFragment(), &box);
} else if (box.ChildrenInline() && box.Children().empty()) {
// If no children, there maybe or may not be NGPaintFragment.
// TODO(kojii): To be investigated if this correct or should be fixed.
} else if (box.GetLayoutObject()->SlowFirstChild() && } else if (box.GetLayoutObject()->SlowFirstChild() &&
box.GetLayoutObject()->SlowFirstChild()->IsLayoutFlowThread()) { box.GetLayoutObject()->SlowFirstChild()->IsLayoutFlowThread()) {
// TODO(kojii): NGPaintFragment for multicol has non-inline children // TODO(kojii): NGPaintFragment for multicol has non-inline children
// (kColumnBox). Could this be regular box fragments? // (kColumnBox). Could this be regular box fragments?
DCHECK(paint_fragment);
} else { } else {
DCHECK(!paint_fragment); DCHECK(!paint_fragment);
} }
......
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