summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-03 10:25:00 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-03 10:25:34 +0200
commit9290117b7741a1210426e76dd1d02c4013bb6e5d (patch)
treefb3fec12f142bf79b85224ed84bdddf4a69e9207 /Libraries
parent786494b62dd6f369e6758f33ac4414403b8e833c (diff)
downloadserenity-9290117b7741a1210426e76dd1d02c4013bb6e5d.zip
LibHTML: Let's put debug output on the debugger stream
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibHTML/CSS/StyleResolver.cpp2
-rw-r--r--Libraries/LibHTML/Dump.cpp40
-rw-r--r--Libraries/LibHTML/HtmlView.cpp4
3 files changed, 23 insertions, 23 deletions
diff --git a/Libraries/LibHTML/CSS/StyleResolver.cpp b/Libraries/LibHTML/CSS/StyleResolver.cpp
index 1c53f53422..17ef4b5a4d 100644
--- a/Libraries/LibHTML/CSS/StyleResolver.cpp
+++ b/Libraries/LibHTML/CSS/StyleResolver.cpp
@@ -48,7 +48,7 @@ NonnullRefPtrVector<StyleRule> StyleResolver::collect_matching_rules(const Eleme
}
#ifdef HTML_DEBUG
- printf("Rules matching Element{%p}\n", &element);
+ dbgprintf("Rules matching Element{%p}\n", &element);
for (auto& rule : matching_rules) {
dump_rule(rule);
}
diff --git a/Libraries/LibHTML/Dump.cpp b/Libraries/LibHTML/Dump.cpp
index ee7a3a55a5..03d8263d1b 100644
--- a/Libraries/LibHTML/Dump.cpp
+++ b/Libraries/LibHTML/Dump.cpp
@@ -11,17 +11,17 @@ void dump_tree(const Node& node)
{
static int indent = 0;
for (int i = 0; i < indent; ++i)
- printf(" ");
+ dbgprintf(" ");
if (node.is_document()) {
- printf("*Document*\n");
+ dbgprintf("*Document*\n");
} else if (node.is_element()) {
- printf("<%s", static_cast<const Element&>(node).tag_name().characters());
+ dbgprintf("<%s", static_cast<const Element&>(node).tag_name().characters());
static_cast<const Element&>(node).for_each_attribute([](auto& name, auto& value) {
- printf(" %s=%s", name.characters(), value.characters());
+ dbgprintf(" %s=%s", name.characters(), value.characters());
});
- printf(">\n");
+ dbgprintf(">\n");
} else if (node.is_text()) {
- printf("\"%s\"\n", static_cast<const Text&>(node).data().characters());
+ dbgprintf("\"%s\"\n", static_cast<const Text&>(node).data().characters());
}
++indent;
if (node.is_parent_node()) {
@@ -36,7 +36,7 @@ void dump_tree(const LayoutNode& layout_node)
{
static int indent = 0;
for (int i = 0; i < indent; ++i)
- printf(" ");
+ dbgprintf(" ");
String tag_name;
if (layout_node.is_anonymous())
@@ -50,7 +50,7 @@ void dump_tree(const LayoutNode& layout_node)
else
tag_name = "???";
- printf("%s {%s} at (%d,%d) size %dx%d",
+ dbgprintf("%s {%s} at (%d,%d) size %dx%d",
layout_node.class_name(),
tag_name.characters(),
layout_node.rect().x(),
@@ -59,7 +59,7 @@ void dump_tree(const LayoutNode& layout_node)
layout_node.rect().height());
// Dump the horizontal box properties
- printf(" [%d+%d+%d %d %d+%d+%d]",
+ dbgprintf(" [%d+%d+%d %d %d+%d+%d]",
layout_node.style().margin().left.to_px(),
layout_node.style().border().left.to_px(),
layout_node.style().padding().left.to_px(),
@@ -69,7 +69,7 @@ void dump_tree(const LayoutNode& layout_node)
layout_node.style().margin().right.to_px());
// And the vertical box properties
- printf(" [%d+%d+%d %d %d+%d+%d]",
+ dbgprintf(" [%d+%d+%d %d %d+%d+%d]",
layout_node.style().margin().top.to_px(),
layout_node.style().border().top.to_px(),
layout_node.style().padding().top.to_px(),
@@ -80,15 +80,15 @@ void dump_tree(const LayoutNode& layout_node)
if (layout_node.is_text()) {
const LayoutText& layout_text = static_cast<const LayoutText&>(layout_node);
- printf(" \"%s\", %d runs", layout_text.text().characters(), layout_text.runs().size());
+ dbgprintf(" \"%s\", %d runs", layout_text.text().characters(), layout_text.runs().size());
}
- printf("\n");
+ dbgprintf("\n");
layout_node.style_properties().for_each_property([&](auto& key, auto& value) {
for (int i = 0; i < indent; ++i)
- printf(" ");
- printf(" (%s: %s)\n", key.characters(), value.to_string().characters());
+ dbgprintf(" ");
+ dbgprintf(" (%s: %s)\n", key.characters(), value.to_string().characters());
});
++indent;
@@ -100,9 +100,9 @@ void dump_tree(const LayoutNode& layout_node)
void dump_rule(const StyleRule& rule)
{
- printf("Rule:\n");
+ dbgprintf("Rule:\n");
for (auto& selector : rule.selectors()) {
- printf(" Selector:\n");
+ dbgprintf(" Selector:\n");
for (auto& component : selector.components()) {
const char* type_description = "Unknown";
switch (component.type) {
@@ -119,18 +119,18 @@ void dump_rule(const StyleRule& rule)
type_description = "TagName";
break;
}
- printf(" %s:%s\n", type_description, component.value.characters());
+ dbgprintf(" %s:%s\n", type_description, component.value.characters());
}
}
- printf(" Declarations:\n");
+ dbgprintf(" Declarations:\n");
for (auto& property : rule.declaration().properties()) {
- printf(" '%s': '%s'\n", property.name.characters(), property.value->to_string().characters());
+ dbgprintf(" '%s': '%s'\n", property.name.characters(), property.value->to_string().characters());
}
}
void dump_sheet(const StyleSheet& sheet)
{
- printf("StyleSheet{%p}: %d rule(s)\n", &sheet, sheet.rules().size());
+ dbgprintf("StyleSheet{%p}: %d rule(s)\n", &sheet, sheet.rules().size());
for (auto& rule : sheet.rules()) {
dump_rule(rule);
diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp
index b3d277602b..6b927df91c 100644
--- a/Libraries/LibHTML/HtmlView.cpp
+++ b/Libraries/LibHTML/HtmlView.cpp
@@ -32,7 +32,7 @@ void HtmlView::set_document(Document* document)
#ifdef HTML_DEBUG
if (document != nullptr) {
- printf("\033[33;1mLayout tree before layout:\033[0m\n");
+ dbgprintf("\033[33;1mLayout tree before layout:\033[0m\n");
::dump_tree(*m_layout_root);
}
#endif
@@ -51,7 +51,7 @@ void HtmlView::layout_and_sync_size()
set_content_size(m_layout_root->rect().size());
#ifdef HTML_DEBUG
- printf("\033[33;1mLayout tree after layout:\033[0m\n");
+ dbgprintf("\033[33;1mLayout tree after layout:\033[0m\n");
::dump_tree(*m_layout_root);
#endif
}