From ad2180ba6ce7a68a13c2a696902b600b95f67195 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 5 Feb 2022 16:16:18 +0100 Subject: [PATCH] LibWeb: Put CSS parser debug spam behind CSS_PARSER_DEBUG --- .../Libraries/LibWeb/CSS/Parser/Parser.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 1bfb4ef4e5..991222625c 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -509,7 +509,7 @@ Result Parser::parse_simple_sel } else if (pseudo_name.equals_ignoring_case("first-line")) { simple_selector.pseudo_element = Selector::SimpleSelector::PseudoElement::FirstLine; } else { - dbgln("Unrecognized pseudo-element: '::{}'", pseudo_name); + dbgln_if(CSS_PARSER_DEBUG, "Unrecognized pseudo-element: '::{}'", pseudo_name); return ParsingResult::SyntaxError; } @@ -577,7 +577,7 @@ Result Parser::parse_simple_sel simple_selector.type = Selector::SimpleSelector::Type::PseudoElement; simple_selector.pseudo_element = Selector::SimpleSelector::PseudoElement::FirstLine; } else { - dbgln("Unrecognized pseudo-class: ':{}'", pseudo_name); + dbgln_if(CSS_PARSER_DEBUG, "Unrecognized pseudo-class: ':{}'", pseudo_name); return ParsingResult::SyntaxError; } @@ -616,7 +616,7 @@ Result Parser::parse_simple_sel return ParsingResult::SyntaxError; } } else { - dbgln("Unrecognized pseudo-class function: ':{}'()", pseudo_function.name()); + dbgln_if(CSS_PARSER_DEBUG, "Unrecognized pseudo-class function: ':{}'()", pseudo_function.name()); return ParsingResult::SyntaxError; } @@ -1681,7 +1681,7 @@ Vector Parser::consume_a_list_of_declarations(TokenStream Parser::convert_to_rule(NonnullRefPtr rule) if (url.has_value()) return CSSImportRule::create(url.value(), const_cast(*m_context.document())); else - dbgln("Unable to parse url from @import rule"); + dbgln_if(CSS_PARSER_DEBUG, "Unable to parse url from @import rule"); } else if (rule->m_name.equals_ignoring_case("supports"sv)) { @@ -1978,7 +1978,7 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) auto supports = parse_a_supports(supports_tokens); if (!supports) { if constexpr (CSS_PARSER_DEBUG) { - dbgln("CSSParser: @supports rule invalid; discarding."); + dbgln_if(CSS_PARSER_DEBUG, "CSSParser: @supports rule invalid; discarding."); supports_tokens.dump_all_tokens(); } return {}; @@ -1995,7 +1995,7 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) return CSSSupportsRule::create(supports.release_nonnull(), move(child_rules)); } else { - dbgln("Unrecognized CSS at-rule: @{}", rule->m_name); + dbgln_if(CSS_PARSER_DEBUG, "Unrecognized CSS at-rule: @{}", rule->m_name); } // FIXME: More at rules! @@ -2006,7 +2006,7 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) if (selectors.is_error()) { if (selectors.error() != ParsingResult::IncludesIgnoredVendorPrefix) { - dbgln("CSSParser: style rule selectors invalid; discarding."); + dbgln_if(CSS_PARSER_DEBUG, "CSSParser: style rule selectors invalid; discarding."); if constexpr (CSS_PARSER_DEBUG) { prelude_stream.dump_all_tokens(); } @@ -2015,13 +2015,13 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) } if (selectors.value().is_empty()) { - dbgln("CSSParser: empty selector; discarding."); + dbgln_if(CSS_PARSER_DEBUG, "CSSParser: empty selector; discarding."); return {}; } auto declaration = convert_to_declaration(*rule->m_block); if (!declaration) { - dbgln("CSSParser: style rule declaration invalid; discarding."); + dbgln_if(CSS_PARSER_DEBUG, "CSSParser: style rule declaration invalid; discarding."); return {}; } @@ -2051,7 +2051,7 @@ Optional Parser::convert_to_style_property(StyleDeclarationRule c } else if (has_ignored_vendor_prefix(property_name)) { return {}; } else if (!property_name.starts_with("-")) { - dbgln("Unrecognized CSS property '{}'", property_name); + dbgln_if(CSS_PARSER_DEBUG, "Unrecognized CSS property '{}'", property_name); return {}; } } @@ -2060,7 +2060,7 @@ Optional Parser::convert_to_style_property(StyleDeclarationRule c auto value = parse_css_value(property_id, value_token_stream); if (value.is_error()) { if (value.error() != ParsingResult::IncludesIgnoredVendorPrefix) { - dbgln("Unable to parse value for CSS property '{}'.", property_name); + dbgln_if(CSS_PARSER_DEBUG, "Unable to parse value for CSS property '{}'.", property_name); if constexpr (CSS_PARSER_DEBUG) { value_token_stream.dump_all_tokens(); } @@ -2099,7 +2099,7 @@ RefPtr Parser::parse_calculated_value(Vectorresolved_type(); if (!calc_type.has_value()) { - dbgln("calc() resolved as invalid!!!"); + dbgln_if(CSS_PARSER_DEBUG, "calc() resolved as invalid!!!"); return nullptr; } @@ -3675,7 +3675,7 @@ RefPtr Parser::parse_transform_value(Vector auto number = parse_numeric_value(value); values.append(number.release_nonnull()); } else { - dbgln("FIXME: Unsupported value type for transformation!"); + dbgln_if(CSS_PARSER_DEBUG, "FIXME: Unsupported value type for transformation!"); return nullptr; } } @@ -3893,7 +3893,7 @@ Optional Parser::parse_a_n_plus_b_patt auto syntax_error = [&]() -> Optional { if constexpr (CSS_PARSER_DEBUG) { - dbgln("Invalid An+B value:"); + dbgln_if(CSS_PARSER_DEBUG, "Invalid An+B value:"); values.dump_all_tokens(); } return {}; @@ -3904,7 +3904,7 @@ Optional Parser::parse_a_n_plus_b_patt values.skip_whitespace(); if (values.has_next_token()) { if constexpr (CSS_PARSER_DEBUG) { - dbgln("Extra tokens at end of An+B value:"); + dbgln_if(CSS_PARSER_DEBUG, "Extra tokens at end of An+B value:"); values.dump_all_tokens(); } return syntax_error();