summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibHTML/HtmlView.cpp1
-rw-r--r--Libraries/LibHTML/HtmlView.h4
-rw-r--r--Libraries/LibHTML/Layout/LayoutBlock.cpp2
-rw-r--r--Libraries/LibHTML/RenderingContext.h4
4 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp
index f3f8388158..6ac1a9ff0b 100644
--- a/Libraries/LibHTML/HtmlView.cpp
+++ b/Libraries/LibHTML/HtmlView.cpp
@@ -111,6 +111,7 @@ void HtmlView::paint_event(GPaintEvent& event)
painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
RenderingContext context { painter };
+ context.set_should_show_line_box_borders(m_should_show_line_box_borders);
m_layout_root->render(context);
}
diff --git a/Libraries/LibHTML/HtmlView.h b/Libraries/LibHTML/HtmlView.h
index bccd78286a..3d147b8f7e 100644
--- a/Libraries/LibHTML/HtmlView.h
+++ b/Libraries/LibHTML/HtmlView.h
@@ -23,6 +23,8 @@ public:
URL url() const;
+ void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
+
Function<void(const String&)> on_link_click;
Function<void(const String&)> on_title_change;
Function<void(const URL&)> on_load_start;
@@ -41,4 +43,6 @@ private:
RefPtr<Frame> m_main_frame;
RefPtr<Document> m_document;
RefPtr<LayoutNode> m_layout_root;
+
+ bool m_should_show_line_box_borders { false };
};
diff --git a/Libraries/LibHTML/Layout/LayoutBlock.cpp b/Libraries/LibHTML/Layout/LayoutBlock.cpp
index 4373624c76..86f17ee514 100644
--- a/Libraries/LibHTML/Layout/LayoutBlock.cpp
+++ b/Libraries/LibHTML/Layout/LayoutBlock.cpp
@@ -204,6 +204,8 @@ void LayoutBlock::render(RenderingContext& context)
if (children_are_inline()) {
for (auto& line_box : m_line_boxes) {
for (auto& fragment : line_box.fragments()) {
+ if (context.should_show_line_box_borders())
+ context.painter().draw_rect(fragment.rect(), Color::Green);
fragment.render(context);
}
}
diff --git a/Libraries/LibHTML/RenderingContext.h b/Libraries/LibHTML/RenderingContext.h
index 2e50ed82a5..bfba539968 100644
--- a/Libraries/LibHTML/RenderingContext.h
+++ b/Libraries/LibHTML/RenderingContext.h
@@ -11,6 +11,10 @@ public:
GPainter& painter() const { return m_painter; }
+ bool should_show_line_box_borders() const { return m_should_show_line_box_borders; }
+ void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
+
private:
GPainter& m_painter;
+ bool m_should_show_line_box_borders { false };
};