summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibHTML/CSS/StyleResolver.cpp4
-rw-r--r--Libraries/LibHTML/Dump.h2
-rw-r--r--Libraries/LibHTML/Layout/LayoutBlock.cpp4
-rw-r--r--Libraries/LibHTML/Layout/LayoutText.cpp4
4 files changed, 14 insertions, 0 deletions
diff --git a/Libraries/LibHTML/CSS/StyleResolver.cpp b/Libraries/LibHTML/CSS/StyleResolver.cpp
index d18c5cde74..97c552ed8b 100644
--- a/Libraries/LibHTML/CSS/StyleResolver.cpp
+++ b/Libraries/LibHTML/CSS/StyleResolver.cpp
@@ -45,10 +45,14 @@ NonnullRefPtrVector<StyleRule> StyleResolver::collect_matching_rules(const Eleme
}
}
}
+
+#ifdef HTML_DEBUG
printf("Rules matching Element{%p}\n", &element);
for (auto& rule : matching_rules) {
dump_rule(rule);
}
+#endif
+
return matching_rules;
}
diff --git a/Libraries/LibHTML/Dump.h b/Libraries/LibHTML/Dump.h
index 546e556ba7..6d9d39828d 100644
--- a/Libraries/LibHTML/Dump.h
+++ b/Libraries/LibHTML/Dump.h
@@ -9,3 +9,5 @@ void dump_tree(const Node&);
void dump_tree(const LayoutNode&);
void dump_sheet(const StyleSheet&);
void dump_rule(const StyleRule&);
+
+#undef HTML_DEBUG
diff --git a/Libraries/LibHTML/Layout/LayoutBlock.cpp b/Libraries/LibHTML/Layout/LayoutBlock.cpp
index b0a9ff8ed5..5ca7a76381 100644
--- a/Libraries/LibHTML/Layout/LayoutBlock.cpp
+++ b/Libraries/LibHTML/Layout/LayoutBlock.cpp
@@ -48,15 +48,19 @@ void LayoutBlock::compute_width()
auto padding_left = style_properties.length_or_fallback("padding-left", zero_value);
auto padding_right = style_properties.length_or_fallback("padding-right", zero_value);
+#ifdef HTML_DEBUG
dbg() << " Left: " << margin_left << "+" << border_left << "+" << padding_left;
dbg() << "Right: " << margin_right << "+" << border_right << "+" << padding_right;
+#endif
int total_px = 0;
for (auto& value : { margin_left, border_left, padding_left, width, padding_right, border_right, margin_right }) {
total_px += value.to_px();
}
+#ifdef HTML_DEBUG
dbg() << "Total: " << total_px;
+#endif
// 10.3.3 Block-level, non-replaced elements in normal flow
// If 'width' is not 'auto' and 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larger than the width of the containing block, then any 'auto' values for 'margin-left' or 'margin-right' are, for the following rules, treated as zero.
diff --git a/Libraries/LibHTML/Layout/LayoutText.cpp b/Libraries/LibHTML/Layout/LayoutText.cpp
index 5d4aa1a367..f0d4b5ff5f 100644
--- a/Libraries/LibHTML/Layout/LayoutText.cpp
+++ b/Libraries/LibHTML/Layout/LayoutText.cpp
@@ -60,7 +60,11 @@ void LayoutText::load_font()
dbg() << "My text is " << node().data();
ASSERT_NOT_REACHED();
}
+
+#ifdef HTML_DEBUG
dbg() << "Found font " << file_name << " for family " << font_family << " weight " << font_weight;
+#endif
+
m_font = Font::load_from_file(String::format("/res/fonts/%s", file_name.characters()));
}