mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:27:35 +00:00
LibWeb: Generate a TextPaintable for every Layout::TextNode
This is prep work for moving event handling over to the painting tree.
This commit is contained in:
parent
aae356baf1
commit
4d98851aea
7 changed files with 68 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibWeb/Layout/Box.h>
|
||||
#include <LibWeb/Layout/LineBox.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
#include <LibWeb/Painting/StackingContext.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
|
21
Userland/Libraries/LibWeb/Painting/TextPaintable.cpp
Normal file
21
Userland/Libraries/LibWeb/Painting/TextPaintable.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Painting/TextPaintable.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
NonnullOwnPtr<TextPaintable> TextPaintable::create(Layout::TextNode const& layout_node)
|
||||
{
|
||||
return adopt_own(*new TextPaintable(layout_node));
|
||||
}
|
||||
|
||||
TextPaintable::TextPaintable(Layout::TextNode const& layout_node)
|
||||
: Paintable(layout_node)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
23
Userland/Libraries/LibWeb/Painting/TextPaintable.h
Normal file
23
Userland/Libraries/LibWeb/Painting/TextPaintable.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
class TextPaintable : public Paintable {
|
||||
public:
|
||||
static NonnullOwnPtr<TextPaintable> create(Layout::TextNode const&);
|
||||
|
||||
Layout::TextNode const& layout_node() const { return static_cast<Layout::TextNode const&>(Paintable::layout_node()); }
|
||||
|
||||
private:
|
||||
explicit TextPaintable(Layout::TextNode const&);
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue