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

[FragmentItem] Check CullRect in NGBoxFragmentPainter

This patch adds checking CullRect in |NGBoxFragmentPainter|.

The logic is the same as |NGPaintFragment| versions of the
corresponding functions.

Bug: 982194
Change-Id: Iaf1c7bdf9ac04ced4a772ee04f2f8497e1cb8911
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2145522Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758746}
parent f8e57e1e
......@@ -1433,6 +1433,13 @@ void NGBoxFragmentPainter::PaintTextItem(const NGInlineCursor& cursor,
paint_info.phase != PaintPhase::kMask)
return;
// Skip if this child does not intersect with CullRect.
if (!paint_info.IntersectsCullRect(
item.InkOverflow(), paint_offset + item.OffsetInContainerBlock()) &&
// Don't skip <br>, it doesn't have ink but need to paint selection.
!item.IsLineBreak())
return;
NGTextFragmentPainter<NGInlineCursor> text_painter(cursor, parent_offset);
text_painter.Paint(paint_info, paint_offset);
}
......@@ -1451,7 +1458,10 @@ void NGBoxFragmentPainter::PaintBoxItem(
if (child_fragment.HasSelfPaintingLayer() || child_fragment.IsFloating())
return;
// TODO(kojii): Check CullRect.
// Skip if this child does not intersect with CullRect.
if (!paint_info.IntersectsCullRect(
item.InkOverflow(), paint_offset + item.OffsetInContainerBlock()))
return;
if (child_fragment.IsAtomicInline() || child_fragment.IsListMarker()) {
if (FragmentRequiresLegacyFallback(child_fragment)) {
......@@ -1480,6 +1490,11 @@ void NGBoxFragmentPainter::PaintBoxItem(const NGFragmentItem& item,
return;
}
// Skip if this child does not intersect with CullRect.
if (!paint_info.IntersectsCullRect(
item.InkOverflow(), paint_offset + item.OffsetInContainerBlock()))
return;
// This |item| is a culled inline box.
DCHECK(item.GetLayoutObject()->IsLayoutInline());
NGInlineCursor children = cursor.CursorForDescendants();
......
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