summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-18 21:35:44 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-18 21:37:20 +0200
commit8c82d2666889c154983bb138959a36590fa324c8 (patch)
treeead6053e8e39a8f0c9b19a049919dc9cef860c44 /Libraries/LibWeb/Layout
parentdec0cd375525573ebc787276b0e2a594220ceca3 (diff)
downloadserenity-8c82d2666889c154983bb138959a36590fa324c8.zip
LibWeb: Rename LayoutNode::render() to paint()
"Paint" matches what we call this in the rest of the system. Let's not confuse things by mixing paint/render/draw all the time. I'm guilty of this in more places.. Also rename RenderingContext => PaintContext.
Diffstat (limited to 'Libraries/LibWeb/Layout')
-rw-r--r--Libraries/LibWeb/Layout/LayoutBlock.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutBlock.h2
-rw-r--r--Libraries/LibWeb/Layout/LayoutBox.cpp6
-rw-r--r--Libraries/LibWeb/Layout/LayoutBox.h4
-rw-r--r--Libraries/LibWeb/Layout/LayoutCanvas.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutCanvas.h2
-rw-r--r--Libraries/LibWeb/Layout/LayoutDocument.cpp14
-rw-r--r--Libraries/LibWeb/Layout/LayoutDocument.h4
-rw-r--r--Libraries/LibWeb/Layout/LayoutFrame.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutFrame.h2
-rw-r--r--Libraries/LibWeb/Layout/LayoutImage.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutImage.h2
-rw-r--r--Libraries/LibWeb/Layout/LayoutListItemMarker.cpp2
-rw-r--r--Libraries/LibWeb/Layout/LayoutListItemMarker.h2
-rw-r--r--Libraries/LibWeb/Layout/LayoutNode.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutNode.h4
-rw-r--r--Libraries/LibWeb/Layout/LayoutText.cpp2
-rw-r--r--Libraries/LibWeb/Layout/LayoutText.h2
-rw-r--r--Libraries/LibWeb/Layout/LineBoxFragment.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LineBoxFragment.h2
-rw-r--r--Libraries/LibWeb/Layout/StackingContext.cpp10
-rw-r--r--Libraries/LibWeb/Layout/StackingContext.h2
22 files changed, 43 insertions, 43 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp
index daa47775e2..38b9d0f641 100644
--- a/Libraries/LibWeb/Layout/LayoutBlock.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp
@@ -660,12 +660,12 @@ void LayoutBlock::compute_height()
}
}
-void LayoutBlock::render(RenderingContext& context, PaintPhase phase)
+void LayoutBlock::paint(PaintContext& context, PaintPhase phase)
{
if (!is_visible())
return;
- LayoutBox::render(context, phase);
+ LayoutBox::paint(context, phase);
// FIXME: Inline backgrounds etc.
if (phase == PaintPhase::Foreground) {
diff --git a/Libraries/LibWeb/Layout/LayoutBlock.h b/Libraries/LibWeb/Layout/LayoutBlock.h
index 436c427255..226fce2869 100644
--- a/Libraries/LibWeb/Layout/LayoutBlock.h
+++ b/Libraries/LibWeb/Layout/LayoutBlock.h
@@ -41,7 +41,7 @@ public:
virtual const char* class_name() const override { return "LayoutBlock"; }
virtual void layout(LayoutMode = LayoutMode::Default) override;
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
virtual LayoutNode& inline_wrapper() override;
diff --git a/Libraries/LibWeb/Layout/LayoutBox.cpp b/Libraries/LibWeb/Layout/LayoutBox.cpp
index aa98a3c8f3..4a1301c150 100644
--- a/Libraries/LibWeb/Layout/LayoutBox.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBox.cpp
@@ -33,7 +33,7 @@
namespace Web {
-void LayoutBox::paint_border(RenderingContext& context, Edge edge, const Gfx::FloatRect& rect, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id)
+void LayoutBox::paint_border(PaintContext& context, Edge edge, const Gfx::FloatRect& rect, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id)
{
auto border_width = style().property(width_property_id);
if (!border_width.has_value())
@@ -186,7 +186,7 @@ void LayoutBox::paint_border(RenderingContext& context, Edge edge, const Gfx::Fl
}
}
-void LayoutBox::render(RenderingContext& context, PaintPhase phase)
+void LayoutBox::paint(PaintContext& context, PaintPhase phase)
{
if (!is_visible())
return;
@@ -230,7 +230,7 @@ void LayoutBox::render(RenderingContext& context, PaintPhase phase)
paint_border(context, Edge::Bottom, bordered_rect, CSS::PropertyID::BorderBottomStyle, CSS::PropertyID::BorderBottomColor, CSS::PropertyID::BorderBottomWidth);
}
- LayoutNodeWithStyleAndBoxModelMetrics::render(context, phase);
+ LayoutNodeWithStyleAndBoxModelMetrics::paint(context, phase);
if (phase == PaintPhase::Overlay && node() && document().inspected_node() == node())
context.painter().draw_rect(enclosing_int_rect(absolute_rect()), Color::Magenta);
diff --git a/Libraries/LibWeb/Layout/LayoutBox.h b/Libraries/LibWeb/Layout/LayoutBox.h
index 633601318d..bad3078489 100644
--- a/Libraries/LibWeb/Layout/LayoutBox.h
+++ b/Libraries/LibWeb/Layout/LayoutBox.h
@@ -67,7 +67,7 @@ public:
void set_stacking_context(NonnullOwnPtr<StackingContext> context) { m_stacking_context = move(context); }
StackingContext* enclosing_stacking_context();
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
protected:
LayoutBox(const Node* node, NonnullRefPtr<StyleProperties> style)
@@ -86,7 +86,7 @@ private:
Bottom,
Left,
};
- void paint_border(RenderingContext&, Edge, const Gfx::FloatRect&, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id);
+ void paint_border(PaintContext&, Edge, const Gfx::FloatRect&, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id);
Gfx::FloatPoint m_offset;
Gfx::FloatSize m_size;
diff --git a/Libraries/LibWeb/Layout/LayoutCanvas.cpp b/Libraries/LibWeb/Layout/LayoutCanvas.cpp
index 89b2390799..2b905219c4 100644
--- a/Libraries/LibWeb/Layout/LayoutCanvas.cpp
+++ b/Libraries/LibWeb/Layout/LayoutCanvas.cpp
@@ -49,12 +49,12 @@ void LayoutCanvas::layout(LayoutMode layout_mode)
LayoutReplaced::layout(layout_mode);
}
-void LayoutCanvas::render(RenderingContext& context, PaintPhase phase)
+void LayoutCanvas::paint(PaintContext& context, PaintPhase phase)
{
if (!is_visible())
return;
- LayoutReplaced::render(context, phase);
+ LayoutReplaced::paint(context, phase);
if (phase == PaintPhase::Foreground) {
// FIXME: This should be done at a different level. Also rect() does not include padding etc!
diff --git a/Libraries/LibWeb/Layout/LayoutCanvas.h b/Libraries/LibWeb/Layout/LayoutCanvas.h
index c97bf745a9..13733079e1 100644
--- a/Libraries/LibWeb/Layout/LayoutCanvas.h
+++ b/Libraries/LibWeb/Layout/LayoutCanvas.h
@@ -39,7 +39,7 @@ public:
virtual ~LayoutCanvas() override;
virtual void layout(LayoutMode = LayoutMode::Default) override;
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
const HTMLCanvasElement& node() const { return static_cast<const HTMLCanvasElement&>(LayoutReplaced::node()); }
diff --git a/Libraries/LibWeb/Layout/LayoutDocument.cpp b/Libraries/LibWeb/Layout/LayoutDocument.cpp
index 41667e6a28..f4821f4bac 100644
--- a/Libraries/LibWeb/Layout/LayoutDocument.cpp
+++ b/Libraries/LibWeb/Layout/LayoutDocument.cpp
@@ -100,17 +100,17 @@ void LayoutDocument::did_set_viewport_rect(Badge<Frame>, const Gfx::IntRect& a_v
});
}
-void LayoutDocument::paint_all_phases(RenderingContext& context)
+void LayoutDocument::paint_all_phases(PaintContext& context)
{
- render(context, PaintPhase::Background);
- render(context, PaintPhase::Border);
- render(context, PaintPhase::Foreground);
- render(context, PaintPhase::Overlay);
+ paint(context, PaintPhase::Background);
+ paint(context, PaintPhase::Border);
+ paint(context, PaintPhase::Foreground);
+ paint(context, PaintPhase::Overlay);
}
-void LayoutDocument::render(RenderingContext& context, PaintPhase phase)
+void LayoutDocument::paint(PaintContext& context, PaintPhase phase)
{
- stacking_context()->render(context, phase);
+ stacking_context()->paint(context, phase);
}
}
diff --git a/Libraries/LibWeb/Layout/LayoutDocument.h b/Libraries/LibWeb/Layout/LayoutDocument.h
index ed8bbdf796..56d3d0a7e3 100644
--- a/Libraries/LibWeb/Layout/LayoutDocument.h
+++ b/Libraries/LibWeb/Layout/LayoutDocument.h
@@ -40,9 +40,9 @@ public:
virtual const char* class_name() const override { return "LayoutDocument"; }
virtual void layout(LayoutMode = LayoutMode::Default) override;
- void paint_all_phases(RenderingContext&);
+ void paint_all_phases(PaintContext&);
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
const LayoutRange& selection() const { return m_selection; }
LayoutRange& selection() { return m_selection; }
diff --git a/Libraries/LibWeb/Layout/LayoutFrame.cpp b/Libraries/LibWeb/Layout/LayoutFrame.cpp
index 54dacce8af..63301c7d27 100644
--- a/Libraries/LibWeb/Layout/LayoutFrame.cpp
+++ b/Libraries/LibWeb/Layout/LayoutFrame.cpp
@@ -59,9 +59,9 @@ void LayoutFrame::layout(LayoutMode layout_mode)
LayoutReplaced::layout(layout_mode);
}
-void LayoutFrame::render(RenderingContext& context, PaintPhase phase)
+void LayoutFrame::paint(PaintContext& context, PaintPhase phase)
{
- LayoutReplaced::render(context, phase);
+ LayoutReplaced::paint(context, phase);
if (phase == PaintPhase::Foreground) {
auto* hosted_document = node().hosted_document();
diff --git a/Libraries/LibWeb/Layout/LayoutFrame.h b/Libraries/LibWeb/Layout/LayoutFrame.h
index e5e6d63a0d..9d2f2c3f4b 100644
--- a/Libraries/LibWeb/Layout/LayoutFrame.h
+++ b/Libraries/LibWeb/Layout/LayoutFrame.h
@@ -36,7 +36,7 @@ public:
LayoutFrame(const Element&, NonnullRefPtr<StyleProperties>);
virtual ~LayoutFrame() override;
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
virtual void layout(LayoutMode) override;
const HTMLIFrameElement& node() const { return static_cast<const HTMLIFrameElement&>(LayoutReplaced::node()); }
diff --git a/Libraries/LibWeb/Layout/LayoutImage.cpp b/Libraries/LibWeb/Layout/LayoutImage.cpp
index 67de3fdfe4..94de65f0ef 100644
--- a/Libraries/LibWeb/Layout/LayoutImage.cpp
+++ b/Libraries/LibWeb/Layout/LayoutImage.cpp
@@ -77,7 +77,7 @@ void LayoutImage::layout(LayoutMode layout_mode)
LayoutReplaced::layout(layout_mode);
}
-void LayoutImage::render(RenderingContext& context, PaintPhase phase)
+void LayoutImage::paint(PaintContext& context, PaintPhase phase)
{
if (!is_visible())
return;
@@ -86,7 +86,7 @@ void LayoutImage::render(RenderingContext& context, PaintPhase phase)
if (!context.viewport_rect().intersects(enclosing_int_rect(absolute_rect())))
return;
- LayoutReplaced::render(context, phase);
+ LayoutReplaced::paint(context, phase);
if (phase == PaintPhase::Foreground) {
if (renders_as_alt_text()) {
diff --git a/Libraries/LibWeb/Layout/LayoutImage.h b/Libraries/LibWeb/Layout/LayoutImage.h
index 269455710b..0e1a3cb923 100644
--- a/Libraries/LibWeb/Layout/LayoutImage.h
+++ b/Libraries/LibWeb/Layout/LayoutImage.h
@@ -39,7 +39,7 @@ public:
virtual ~LayoutImage() override;
virtual void layout(LayoutMode = LayoutMode::Default) override;
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
const Element& node() const { return static_cast<const Element&>(LayoutReplaced::node()); }
diff --git a/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp b/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp
index a103cc8e24..551f7e36ea 100644
--- a/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp
+++ b/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp
@@ -38,7 +38,7 @@ LayoutListItemMarker::~LayoutListItemMarker()
{
}
-void LayoutListItemMarker::render(RenderingContext& context, PaintPhase phase)
+void LayoutListItemMarker::paint(PaintContext& context, PaintPhase phase)
{
if (phase != PaintPhase::Foreground)
return;
diff --git a/Libraries/LibWeb/Layout/LayoutListItemMarker.h b/Libraries/LibWeb/Layout/LayoutListItemMarker.h
index 712702ea90..0c934a158a 100644
--- a/Libraries/LibWeb/Layout/LayoutListItemMarker.h
+++ b/Libraries/LibWeb/Layout/LayoutListItemMarker.h
@@ -35,7 +35,7 @@ public:
LayoutListItemMarker();
virtual ~LayoutListItemMarker() override;
- virtual void render(RenderingContext&, PaintPhase) override;
+ virtual void paint(PaintContext&, PaintPhase) override;
private:
virtual const char* class_name() const override { return "LayoutListItemMarker"; }
diff --git a/Libraries/LibWeb/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp
index 6ce138b842..a852ce2cb2 100644
--- a/Libraries/LibWeb/Layout/LayoutNode.cpp
+++ b/Libraries/LibWeb/Layout/LayoutNode.cpp
@@ -89,7 +89,7 @@ const LayoutBlock* LayoutNode::containing_block() const
return nearest_block_ancestor();
}
-void LayoutNode::render(RenderingContext& context, PaintPhase phase)
+void LayoutNode::paint(PaintContext& context, PaintPhase phase)
{
if (!is_visible())
return;
@@ -97,7 +97,7 @@ void LayoutNode::render(RenderingContext& context, PaintPhase phase)
for_each_child([&](auto& child) {
if (child.is_box() && to<LayoutBox>(child).stacking_context())
return;
- child.render(context, phase);
+ child.paint(context, phase);
});
}
diff --git a/Libraries/LibWeb/Layout/LayoutNode.h b/Libraries/LibWeb/Layout/LayoutNode.h
index b78cf1d953..df2c032a36 100644
--- a/Libraries/LibWeb/Layout/LayoutNode.h
+++ b/Libraries/LibWeb/Layout/LayoutNode.h
@@ -34,7 +34,7 @@
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/BoxModelMetrics.h>
#include <LibWeb/Layout/LayoutPosition.h>
-#include <LibWeb/RenderingContext.h>
+#include <LibWeb/Painting/PaintContext.h>
#include <LibWeb/TreeNode.h>
namespace Web {
@@ -178,7 +178,7 @@ public:
Foreground,
Overlay,
};
- virtual void render(RenderingContext&, PaintPhase);
+ virtual void paint(PaintContext&, PaintPhase);
bool is_absolutely_positioned() const;
bool is_fixed_position() const;
diff --git a/Libraries/LibWeb/Layout/LayoutText.cpp b/Libraries/LibWeb/Layout/LayoutText.cpp
index c8f3558e8b..119f8aee0c 100644
--- a/Libraries/LibWeb/Layout/LayoutText.cpp
+++ b/Libraries/LibWeb/Layout/LayoutText.cpp
@@ -65,7 +65,7 @@ const String& LayoutText::text_for_style(const StyleProperties& style) const
return node().data();
}
-void LayoutText::render_fragment(RenderingContext& context, const LineBoxFragment& fragment) const
+void LayoutText::render_fragment(PaintContext& context, const LineBoxFragment& fragment) const
{
auto& painter = context.painter();
painter.set_font(style().font());
diff --git a/Libraries/LibWeb/Layout/LayoutText.h b/Libraries/LibWeb/Layout/LayoutText.h
index bc8aac3a3e..b5860dca02 100644
--- a/Libraries/LibWeb/Layout/LayoutText.h
+++ b/Libraries/LibWeb/Layout/LayoutText.h
@@ -46,7 +46,7 @@ public:
virtual const char* class_name() const override { return "LayoutText"; }
virtual bool is_text() const final { return true; }
- void render_fragment(RenderingContext&, const LineBoxFragment&) const;
+ void render_fragment(PaintContext&, const LineBoxFragment&) const;
virtual void split_into_lines(LayoutBlock& container, LayoutMode) override;
diff --git a/Libraries/LibWeb/Layout/LineBoxFragment.cpp b/Libraries/LibWeb/Layout/LineBoxFragment.cpp
index 40b19a59e0..55a9442e32 100644
--- a/Libraries/LibWeb/Layout/LineBoxFragment.cpp
+++ b/Libraries/LibWeb/Layout/LineBoxFragment.cpp
@@ -29,12 +29,12 @@
#include <LibWeb/Layout/LayoutDocument.h>
#include <LibWeb/Layout/LayoutText.h>
#include <LibWeb/Layout/LineBoxFragment.h>
-#include <LibWeb/RenderingContext.h>
+#include <LibWeb/Painting/PaintContext.h>
#include <ctype.h>
namespace Web {
-void LineBoxFragment::render(RenderingContext& context)
+void LineBoxFragment::render(PaintContext& context)
{
for (auto* ancestor = layout_node().parent(); ancestor; ancestor = ancestor->parent()) {
if (!ancestor->is_visible())
diff --git a/Libraries/LibWeb/Layout/LineBoxFragment.h b/Libraries/LibWeb/Layout/LineBoxFragment.h
index 3dd0967a47..47f09bc890 100644
--- a/Libraries/LibWeb/Layout/LineBoxFragment.h
+++ b/Libraries/LibWeb/Layout/LineBoxFragment.h
@@ -60,7 +60,7 @@ public:
float absolute_x() const { return absolute_rect().x(); }
- void render(RenderingContext&);
+ void render(PaintContext&);
bool ends_in_whitespace() const;
bool is_justifiable_whitespace() const;
diff --git a/Libraries/LibWeb/Layout/StackingContext.cpp b/Libraries/LibWeb/Layout/StackingContext.cpp
index 13a16ed9e9..6ea1cd1381 100644
--- a/Libraries/LibWeb/Layout/StackingContext.cpp
+++ b/Libraries/LibWeb/Layout/StackingContext.cpp
@@ -47,17 +47,17 @@ StackingContext::StackingContext(LayoutBox& box, StackingContext* parent)
}
}
-void StackingContext::render(RenderingContext& context, LayoutNode::PaintPhase phase)
+void StackingContext::paint(PaintContext& context, LayoutNode::PaintPhase phase)
{
if (!m_box.is_root()) {
- m_box.render(context, phase);
+ m_box.paint(context, phase);
} else {
- // NOTE: LayoutDocument::render() merely calls StackingContext::render()
+ // NOTE: LayoutDocument::paint() merely calls StackingContext::paint()
// so we call its base class instead.
- to<LayoutDocument>(m_box).LayoutBlock::render(context, phase);
+ to<LayoutDocument>(m_box).LayoutBlock::paint(context, phase);
}
for (auto* child : m_children) {
- child->render(context, phase);
+ child->paint(context, phase);
}
}
diff --git a/Libraries/LibWeb/Layout/StackingContext.h b/Libraries/LibWeb/Layout/StackingContext.h
index 81ae17419a..72751a198a 100644
--- a/Libraries/LibWeb/Layout/StackingContext.h
+++ b/Libraries/LibWeb/Layout/StackingContext.h
@@ -40,7 +40,7 @@ public:
StackingContext* parent() { return m_parent; }
const StackingContext* parent() const { return m_parent; }
- void render(RenderingContext&, LayoutNode::PaintPhase);
+ void paint(PaintContext&, LayoutNode::PaintPhase);
void dump(int indent = 0) const;