1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Rename Painting::Box => Paintable

Calling this "Box" made it very confusing to look at code that used both
Layout::Box and Painting::Box. Let's try calling it Paintable instead.
This commit is contained in:
Andreas Kling 2022-03-10 11:26:01 +01:00
parent 7af03df4c3
commit f6497b64ac
32 changed files with 64 additions and 64 deletions

View file

@ -284,7 +284,7 @@ set(SOURCES
Page/Page.cpp
Painting/BackgroundPainting.cpp
Painting/BorderPainting.cpp
Painting/Box.cpp
Painting/Paintable.cpp
Painting/PaintContext.cpp
Painting/ShadowPainting.cpp
Painting/StackingContext.cpp

View file

@ -35,7 +35,7 @@
#include <LibWeb/Layout/TableRowGroupBox.h>
#include <LibWeb/Layout/TreeBuilder.h>
#include <LibWeb/Namespace.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::DOM {

View file

@ -1010,7 +1010,7 @@ size_t Node::length() const
return child_count();
}
Painting::Box const* Node::paint_box() const
Painting::Paintable const* Node::paint_box() const
{
if (!layout_node())
return nullptr;

View file

@ -158,7 +158,7 @@ public:
const Layout::Node* layout_node() const { return m_layout_node; }
Layout::Node* layout_node() { return m_layout_node; }
Painting::Box const* paint_box() const;
Painting::Paintable const* paint_box() const;
void set_layout_node(Badge<Layout::Node>, Layout::Node*) const;

View file

@ -26,7 +26,7 @@
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/SVGBox.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <stdio.h>
namespace Web {

View file

@ -265,8 +265,8 @@ class PerformanceTiming;
namespace Web::Painting {
enum class PaintPhase;
class Box;
class BoxWithLines;
class Paintable;
class PaintableWithLines;
}
namespace Web::RequestIdleCallback {

View file

@ -22,7 +22,7 @@
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/BreakNode.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/UIEvents/FocusEvent.h>

View file

@ -13,7 +13,7 @@
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/Layout/ImageBox.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::HTML {

View file

@ -21,8 +21,8 @@
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Page/EventHandler.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/PaintContext.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/UIEvents/MouseEvent.h>
REGISTER_WIDGET(Web, InProcessWebView)

View file

@ -11,7 +11,7 @@
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {
@ -131,9 +131,9 @@ bool BlockContainer::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&
return true;
}
Painting::BoxWithLines const* BlockContainer::paint_box() const
Painting::PaintableWithLines const* BlockContainer::paint_box() const
{
return static_cast<Painting::BoxWithLines const*>(Box::paint_box());
return static_cast<Painting::PaintableWithLines const*>(Box::paint_box());
}
}

View file

@ -31,7 +31,7 @@ public:
const Gfx::FloatPoint& scroll_offset() const { return m_scroll_offset; }
void set_scroll_offset(const Gfx::FloatPoint&);
Painting::BoxWithLines const* paint_box() const;
Painting::PaintableWithLines const* paint_box() const;
private:
virtual bool is_block_container() const final { return true; }

View file

@ -15,7 +15,7 @@
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Painting/BackgroundPainting.h>
#include <LibWeb/Painting/BorderPainting.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Painting/ShadowPainting.h>
namespace Web::Layout {
@ -34,7 +34,7 @@ Box::~Box()
{
}
void Box::set_paint_box(OwnPtr<Painting::Box> paint_box)
void Box::set_paint_box(OwnPtr<Painting::Paintable> paint_box)
{
m_paint_box = move(paint_box);
}

View file

@ -20,10 +20,10 @@ struct LineBoxFragmentCoordinate {
class Box : public NodeWithStyleAndBoxModelMetrics {
public:
Painting::Box const* paint_box() const { return m_paint_box.ptr(); }
void set_paint_box(OwnPtr<Painting::Box>);
Painting::Paintable const* paint_box() const { return m_paint_box.ptr(); }
void set_paint_box(OwnPtr<Painting::Paintable>);
OwnPtr<Painting::Box> m_paint_box;
OwnPtr<Painting::Paintable> m_paint_box;
bool is_out_of_flow(FormattingContext const&) const;

View file

@ -12,7 +12,7 @@
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/ButtonBox.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -6,7 +6,7 @@
#include <LibGfx/Painter.h>
#include <LibWeb/Layout/CanvasBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -12,7 +12,7 @@
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/Layout/CheckBox.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -41,10 +41,10 @@ void FormattingState::commit()
// For boxes, transfer all the state needed for painting.
if (is<Layout::Box>(node)) {
auto& box = static_cast<Layout::Box&>(node);
box.set_paint_box([](Layout::Box const& layout_box) -> OwnPtr<Painting::Box> {
box.set_paint_box([](Layout::Box const& layout_box) -> OwnPtr<Painting::Paintable> {
if (is<Layout::BlockContainer>(layout_box))
return Painting::BoxWithLines::create(static_cast<Layout::BlockContainer const&>(layout_box));
return Painting::Box::create(static_cast<Layout::Box const&>(layout_box));
return Painting::PaintableWithLines::create(static_cast<Layout::BlockContainer const&>(layout_box));
return Painting::Paintable::create(static_cast<Layout::Box const&>(layout_box));
}(box));
box.m_paint_box->set_offset(node_state.offset);
box.m_paint_box->set_content_size(node_state.content_width, node_state.content_height);
@ -52,7 +52,7 @@ void FormattingState::commit()
box.m_paint_box->set_containing_line_box_fragment(node_state.containing_line_box_fragment);
if (is<Layout::BlockContainer>(box))
static_cast<Painting::BoxWithLines&>(*box.m_paint_box).set_line_boxes(move(node_state.line_boxes));
static_cast<Painting::PaintableWithLines&>(*box.m_paint_box).set_line_boxes(move(node_state.line_boxes));
}
}
}

View file

@ -10,7 +10,7 @@
#include <LibGfx/Point.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/LineBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {
@ -55,12 +55,12 @@ struct FormattingState {
float border_box_width() const { return border_box_left() + content_width + border_box_right(); }
float border_box_height() const { return border_box_top() + content_height + border_box_bottom(); }
Optional<Painting::Box::OverflowData> overflow_data;
Optional<Painting::Paintable::OverflowData> overflow_data;
Painting::Box::OverflowData& ensure_overflow_data()
Painting::Paintable::OverflowData& ensure_overflow_data()
{
if (!overflow_data.has_value())
overflow_data = Painting::Box::OverflowData {};
overflow_data = Painting::Paintable::OverflowData {};
return *overflow_data;
}

View file

@ -10,7 +10,7 @@
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -11,7 +11,7 @@
#include <LibWeb/CSS/ValueID.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/ImageBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -8,7 +8,7 @@
#include <LibWeb/Dump.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Painting/StackingContext.h>
namespace Web::Layout {

View file

@ -14,7 +14,7 @@
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Layout/LabelableNode.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -8,7 +8,7 @@
#include <AK/StringBuilder.h>
#include <LibGfx/Painter.h>
#include <LibWeb/Layout/ListItemMarkerBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -7,7 +7,7 @@
#include <LibGfx/Painter.h>
#include <LibGfx/StylePainter.h>
#include <LibWeb/Layout/Progress.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -11,7 +11,7 @@
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Layout/RadioButton.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -8,7 +8,7 @@
#include <LibGfx/AntiAliasingPainter.h>
#include <LibGfx/Painter.h>
#include <LibWeb/Layout/SVGGeometryBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/SVG/SVGPathElement.h>
#include <LibWeb/SVG/SVGSVGElement.h>

View file

@ -5,7 +5,7 @@
*/
#include <LibWeb/Layout/SVGSVGBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Layout {

View file

@ -5,29 +5,29 @@
*/
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
namespace Web::Painting {
Box::Box(Layout::Box const& layout_box)
Paintable::Paintable(Layout::Box const& layout_box)
: m_layout_box(layout_box)
{
}
Box::~Box()
Paintable::~Paintable()
{
}
BoxWithLines::BoxWithLines(Layout::BlockContainer const& layout_box)
: Box(layout_box)
PaintableWithLines::PaintableWithLines(Layout::BlockContainer const& layout_box)
: Paintable(layout_box)
{
}
BoxWithLines::~BoxWithLines()
PaintableWithLines::~PaintableWithLines()
{
}
void Box::set_offset(const Gfx::FloatPoint& offset)
void Paintable::set_offset(const Gfx::FloatPoint& offset)
{
if (m_offset == offset)
return;
@ -36,7 +36,7 @@ void Box::set_offset(const Gfx::FloatPoint& offset)
const_cast<Layout::Box&>(m_layout_box).did_set_rect();
}
void Box::set_content_size(Gfx::FloatSize const& size)
void Paintable::set_content_size(Gfx::FloatSize const& size)
{
if (m_content_size == size)
return;
@ -45,7 +45,7 @@ void Box::set_content_size(Gfx::FloatSize const& size)
const_cast<Layout::Box&>(m_layout_box).did_set_rect();
}
Gfx::FloatPoint Box::effective_offset() const
Gfx::FloatPoint Paintable::effective_offset() const
{
if (m_containing_line_box_fragment.has_value()) {
auto const& fragment = m_layout_box.containing_block()->paint_box()->line_boxes()[m_containing_line_box_fragment->line_box_index].fragments()[m_containing_line_box_fragment->fragment_index];
@ -54,7 +54,7 @@ Gfx::FloatPoint Box::effective_offset() const
return m_offset;
}
Gfx::FloatRect Box::absolute_rect() const
Gfx::FloatRect Paintable::absolute_rect() const
{
Gfx::FloatRect rect { effective_offset(), content_size() };
for (auto* block = m_layout_box.containing_block(); block; block = block->containing_block())
@ -62,12 +62,12 @@ Gfx::FloatRect Box::absolute_rect() const
return rect;
}
void Box::set_containing_line_box_fragment(Optional<Layout::LineBoxFragmentCoordinate> fragment_coordinate)
void Paintable::set_containing_line_box_fragment(Optional<Layout::LineBoxFragmentCoordinate> fragment_coordinate)
{
m_containing_line_box_fragment = fragment_coordinate;
}
Painting::StackingContext* Box::enclosing_stacking_context()
Painting::StackingContext* Paintable::enclosing_stacking_context()
{
for (auto* ancestor = m_layout_box.parent(); ancestor; ancestor = ancestor->parent()) {
if (!is<Layout::Box>(ancestor))

View file

@ -13,14 +13,14 @@
namespace Web::Painting {
class Box {
class Paintable {
public:
static NonnullOwnPtr<Box> create(Layout::Box const& layout_box)
static NonnullOwnPtr<Paintable> create(Layout::Box const& layout_box)
{
return adopt_own(*new Box(layout_box));
return adopt_own(*new Paintable(layout_box));
}
virtual ~Box();
virtual ~Paintable();
Layout::Box const& m_layout_box;
@ -110,19 +110,19 @@ public:
StackingContext* enclosing_stacking_context();
protected:
explicit Box(Layout::Box const&);
explicit Paintable(Layout::Box const&);
private:
OwnPtr<Painting::StackingContext> m_stacking_context;
};
class BoxWithLines : public Box {
class PaintableWithLines : public Paintable {
public:
static NonnullOwnPtr<BoxWithLines> create(Layout::BlockContainer const& block_container)
static NonnullOwnPtr<PaintableWithLines> create(Layout::BlockContainer const& block_container)
{
return adopt_own(*new BoxWithLines(block_container));
return adopt_own(*new PaintableWithLines(block_container));
}
virtual ~BoxWithLines() override;
virtual ~PaintableWithLines() override;
Vector<Layout::LineBox> const& line_boxes() const { return m_line_boxes; }
void set_line_boxes(Vector<Layout::LineBox>&& line_boxes) { m_line_boxes = move(line_boxes); }
@ -139,7 +139,7 @@ public:
}
private:
BoxWithLines(Layout::BlockContainer const&);
PaintableWithLines(Layout::BlockContainer const&);
Vector<Layout::LineBox> m_line_boxes;
};

View file

@ -10,7 +10,7 @@
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Painting/StackingContext.h>
namespace Web::Painting {

View file

@ -25,7 +25,7 @@
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ContentFilter.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <WebContent/ConnectionFromClient.h>
#include <WebContent/PageHost.h>
#include <WebContent/WebContentClientEndpoint.h>

View file

@ -12,7 +12,7 @@
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Painting/Box.h>
#include <LibWeb/Painting/Paintable.h>
#include <WebContent/WebContentClientEndpoint.h>
namespace WebContent {