diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-29 22:17:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-30 00:57:15 +0200 |
commit | fae8fde913622192143cff59646c1c45dd60fee1 (patch) | |
tree | 6a3176af0c44479e48e5eed1e10419f38e133cd5 /Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | |
parent | 6d260b14b41459c38f9ec6394c9ae639a4cb5aa8 (diff) | |
download | serenity-fae8fde913622192143cff59646c1c45dd60fee1.zip |
LibWeb: Draw inspector overlay label with default font
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/PaintableBox.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 765cae866b..2225cbf553 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -143,6 +143,8 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const paint_inspector_rect(border_rect, Color::Green); paint_inspector_rect(content_rect, Color::Magenta); + auto& font = Gfx::FontDatabase::default_font(); + StringBuilder builder; if (layout_box().dom_node()) builder.append(layout_box().dom_node()->debug_description()); @@ -153,11 +155,11 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const auto size_text_rect = border_rect; size_text_rect.set_y(border_rect.y() + border_rect.height()); size_text_rect.set_top(size_text_rect.top()); - size_text_rect.set_width((float)context.painter().font().width(size_text) + 4); - size_text_rect.set_height(context.painter().font().pixel_size() + 4); + size_text_rect.set_width((float)font.width(size_text) + 4); + size_text_rect.set_height(font.pixel_size() + 4); context.painter().fill_rect(enclosing_int_rect(size_text_rect), context.palette().color(Gfx::ColorRole::Tooltip)); context.painter().draw_rect(enclosing_int_rect(size_text_rect), context.palette().threed_shadow1()); - context.painter().draw_text(enclosing_int_rect(size_text_rect), size_text, Gfx::TextAlignment::Center, context.palette().color(Gfx::ColorRole::TooltipText)); + context.painter().draw_text(enclosing_int_rect(size_text_rect), size_text, font, Gfx::TextAlignment::Center, context.palette().color(Gfx::ColorRole::TooltipText)); } if (phase == PaintPhase::FocusOutline && layout_box().dom_node() && layout_box().dom_node()->is_element() && verify_cast<DOM::Element>(*layout_box().dom_node()).is_focused()) { |