1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:57:35 +00:00

Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr

This commit is contained in:
Gunnar Beutner 2021-05-01 21:10:08 +02:00 committed by Andreas Kling
parent 4e6f03a860
commit 6cf59b6ae9
58 changed files with 315 additions and 469 deletions

View file

@ -58,11 +58,11 @@ void FrameBox::paint(PaintContext& context, PaintPhase phase)
context.set_viewport_rect(old_viewport_rect);
context.painter().restore();
#if HIGHLIGHT_FOCUSED_FRAME_DEBUG
if (dom_node().content_frame()->is_focused_frame()) {
context.painter().draw_rect(absolute_rect().to<int>(), Color::Cyan);
if constexpr (HIGHLIGHT_FOCUSED_FRAME_DEBUG) {
if (dom_node().content_frame()->is_focused_frame()) {
context.painter().draw_rect(absolute_rect().to<int>(), Color::Cyan);
}
}
#endif
}
}

View file

@ -101,10 +101,8 @@ static bool build_gemini_document(DOM::Document& document, const ByteBuffer& dat
auto gemini_document = Gemini::Document::parse(gemini_data, document.url());
String html_data = gemini_document->render_to_html();
#if GEMINI_DEBUG
dbgln("Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
dbgln("Converted to HTML:\n\"\"\"{}\"\"\"", html_data);
#endif
dbgln_if(GEMINI_DEBUG, "Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
dbgln_if(GEMINI_DEBUG, "Converted to HTML:\n\"\"\"{}\"\"\"", html_data);
HTML::HTMLDocumentParser parser(document, html_data, "utf-8");
parser.run(document.url());

View file

@ -75,9 +75,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap
auto content_type = headers.get("Content-Type");
if (content_type.has_value()) {
#if RESOURCE_DEBUG
dbgln("Content-Type header: '{}'", content_type.value());
#endif
dbgln_if(RESOURCE_DEBUG, "Content-Type header: '{}'", content_type.value());
m_encoding = encoding_from_content_type(content_type.value());
m_mime_type = mime_type_from_content_type(content_type.value());
} else if (url().protocol() == "data" && !url().data_mime_type().is_empty()) {
@ -85,9 +83,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
m_mime_type = url().data_mime_type();
} else {
#if RESOURCE_DEBUG
dbgln("No Content-Type header to go on! Guessing based on filename...");
#endif
dbgln_if(RESOURCE_DEBUG, "No Content-Type header to go on! Guessing based on filename...");
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
m_mime_type = Core::guess_mime_type_based_on_filename(url().path());
}

View file

@ -49,9 +49,7 @@ void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateCon
void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelection&)
{
#if SPAM_DEBUG
dbgln("handle: WebContentClient::DidChangeSelection!");
#endif
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidChangeSelection!");
m_view.notify_server_did_change_selection({});
}
@ -105,9 +103,7 @@ void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& me
void WebContentClient::handle(const Messages::WebContentClient::DidUnhoverLink&)
{
#if SPAM_DEBUG
dbgln("handle: WebContentClient::DidUnhoverLink!");
#endif
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidUnhoverLink!");
m_view.notify_server_did_unhover_link({});
}