Commit 10cfbd03 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[FragmentItem] Fix DCHECK in PaintTextItem

This patch fixes a DCHECK fialure in |PaintTextItem|.

In |NGInlineLayoutAlgorithm|, all text runs have parent boxes
and that checking styles of text runs can be omitted. But in
the paint phase, painters need to check styles of all text
runs because inline boxes can be culled.

Bug: 982194
Change-Id: Id4af4889fa4fc3c82640e8fa3877f9b65fb643bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892981Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712000}
parent 8512dc76
......@@ -1178,12 +1178,10 @@ void NGBoxFragmentPainter::PaintTextItem(const NGInlineCursor& cursor,
paint_info.phase != PaintPhase::kMask)
return;
// Need to check |IsHiddenForPaint()| for each item, but checking the style is
// not needed if we reach here, because text items should have the same style
// as their parents.
if (UNLIKELY(item.IsHiddenForPaint()))
// Need to check the style of each text items because they can have different
// styles than its siblings if inline boxes are culled.
if (UNLIKELY(IsVisibleToPaint(item, item.Style())))
return;
DCHECK(IsVisibleToPaint(item, item.Style()));
NGTextFragmentPainter<NGInlineCursor> text_painter(cursor);
text_painter.Paint(paint_info, paint_offset);
......
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