2022-03-10 12:46:44 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-03-10 12:46:44 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-08 13:17:32 -03:00
|
|
|
#include <LibWeb/Painting/PaintableWithLines.h>
|
2022-03-10 12:46:44 -03:00
|
|
|
#include <LibWeb/Painting/TextPaintable.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Painting {
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(TextPaintable);
|
2024-04-06 14:16:04 -03:00
|
|
|
|
2025-09-10 10:52:34 -03:00
|
|
|
GC::Ref<TextPaintable> TextPaintable::create(Layout::TextNode const& layout_node)
|
2022-03-10 12:46:44 -03:00
|
|
|
{
|
2025-09-10 10:52:34 -03:00
|
|
|
return layout_node.heap().allocate<TextPaintable>(layout_node);
|
2022-03-10 12:46:44 -03:00
|
|
|
}
|
|
|
|
|
|
2025-09-10 10:52:34 -03:00
|
|
|
TextPaintable::TextPaintable(Layout::TextNode const& layout_node)
|
2022-03-10 12:46:44 -03:00
|
|
|
: Paintable(layout_node)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-02 17:57:41 -03:00
|
|
|
void TextPaintable::paint_inspector_overlay_internal(DisplayListRecordingContext& context) const
|
|
|
|
|
{
|
|
|
|
|
if (auto const* parent_paintable = as_if<PaintableWithLines>(parent())) {
|
|
|
|
|
for (auto const& fragment : parent_paintable->fragments()) {
|
|
|
|
|
if (&fragment.paintable() == this) {
|
2026-01-08 13:17:32 -03:00
|
|
|
PaintableWithLines::paint_text_fragment_debug_highlight(context, fragment);
|
2025-09-02 17:57:41 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-10 12:46:44 -03:00
|
|
|
}
|