Commit 99b55faa authored by Koji Ishii's avatar Koji Ishii Committed by Chromium LUCI CQ

Remove NGPaintFragment From NGTextFragmentPainter

The code to call |NGBoxFragmentPainter| was removed in r832702
<crrev.com/c/2567145> and <crrev.com/c/2586636>.

Bug: 1154531
Change-Id: I5f09a206dc15464bda98f577e0a26f3132039f6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586450Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836172}
parent ea4ddecc
......@@ -1677,19 +1677,7 @@ void NGBoxFragmentPainter::PaintAtomicInlineChild(const NGPaintFragment& child,
void NGBoxFragmentPainter::PaintTextChild(const NGPaintFragment& paint_fragment,
const PaintInfo& paint_info,
const PhysicalOffset& paint_offset) {
// Inline blocks should be painted by PaintAtomicInlineChild.
DCHECK(!paint_fragment.PhysicalFragment().IsAtomicInline());
// Only paint during the foreground/selection phases.
if (paint_info.phase != PaintPhase::kForeground &&
paint_info.phase != PaintPhase::kSelectionDragImage &&
paint_info.phase != PaintPhase::kTextClip &&
paint_info.phase != PaintPhase::kMask)
return;
NGTextPainterCursor cursor(paint_fragment);
NGTextFragmentPainter<NGTextPainterCursor> text_painter(cursor);
text_painter.Paint(paint_info, paint_offset);
NOTREACHED();
}
void NGBoxFragmentPainter::PaintTextItem(const NGInlineCursor& cursor,
......@@ -1717,7 +1705,7 @@ void NGBoxFragmentPainter::PaintTextItem(const NGInlineCursor& cursor,
ScopedDisplayItemFragment display_item_fragment(paint_info.context,
item.FragmentId());
NGTextFragmentPainter<NGInlineCursor> text_painter(cursor, parent_offset);
NGTextFragmentPainter text_painter(cursor, parent_offset);
text_painter.Paint(paint_info, paint_offset);
}
......
......@@ -7,7 +7,6 @@
#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.h"
#include "third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h"
#include "third_party/blink/renderer/core/style/computed_style_constants.h"
#include "third_party/blink/renderer/platform/geometry/layout_rect.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
......@@ -17,7 +16,6 @@ namespace blink {
class ComputedStyle;
class DisplayItemClient;
class LayoutObject;
class NGPaintFragment;
class NGInlineCursor;
struct NGTextFragmentPaintInfo;
struct PaintInfo;
......@@ -25,41 +23,16 @@ struct PhysicalOffset;
struct PhysicalRect;
struct PhysicalSize;
// The helper class for templatize |NGTextFragmentPainter|.
// TODO(yosin): Remove |NGTextPainterCursor| once the transition to
// |NGFragmentItem| is done. http://crbug.com/982194
class NGTextPainterCursor {
STACK_ALLOCATED();
public:
explicit NGTextPainterCursor(const NGPaintFragment& paint_fragment)
: paint_fragment_(paint_fragment),
text_fragment_(
To<NGPhysicalTextFragment>(paint_fragment.PhysicalFragment())) {}
const NGPaintFragment& PaintFragment() const { return paint_fragment_; }
const NGPhysicalTextFragment* CurrentItem() const { return &text_fragment_; }
StringView CurrentText() const;
const NGPaintFragment& RootPaintFragment() const;
private:
const NGPaintFragment& paint_fragment_;
const NGPhysicalTextFragment& text_fragment_;
mutable const NGPaintFragment* root_paint_fragment_ = nullptr;
};
// Text fragment painter for LayoutNG. Operates on NGPhysicalTextFragments and
// handles clipping, selection, etc. Delegates to NGTextPainter to paint the
// Text fragment painter for LayoutNG. Operates on NGFragmentItem that IsText()
// and handles clipping, selection, etc. Delegates to NGTextPainter to paint the
// text itself.
// TODO(yosin): We should make |NGTextFragmentPainter| non-template class onnce
// we get rid of |NGPaintFragment|.
template <typename Cursor>
class NGTextFragmentPainter {
STACK_ALLOCATED();
public:
explicit NGTextFragmentPainter(const Cursor& cursor) : cursor_(cursor) {}
NGTextFragmentPainter(const Cursor& cursor,
explicit NGTextFragmentPainter(const NGInlineCursor& cursor)
: cursor_(cursor) {}
NGTextFragmentPainter(const NGInlineCursor& cursor,
const PhysicalOffset& parent_offset)
: cursor_(cursor), parent_offset_(parent_offset) {}
......@@ -83,14 +56,11 @@ class NGTextFragmentPainter {
const PaintInfo& paint_info,
const PhysicalOffset& paint_offset);
const Cursor& cursor_;
const NGInlineCursor& cursor_;
PhysicalOffset parent_offset_;
base::Optional<NGInlineCursor> inline_cursor_for_block_flow_;
};
extern template class NGTextFragmentPainter<NGTextPainterCursor>;
extern template class NGTextFragmentPainter<NGInlineCursor>;
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_NG_NG_TEXT_FRAGMENT_PAINTER_H_
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