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

LibHTML: Hide debugging output unless HTML_DEBUG is defined

This commit is contained in:
Sergey Bugaev 2019-09-25 12:42:10 +03:00 committed by Andreas Kling
parent 235dee8c42
commit 6491493e26
4 changed files with 14 additions and 0 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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.

View file

@ -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()));
}