LibGUI: Paint GUI::TextEditor's optional icon before applying text clip

We were chopping the top row of pixels off of the website favicons in
Browser's location editor. :^)
This commit is contained in:
Andreas Kling 2022-02-07 12:25:25 +01:00
parent 24fd8fb16f
commit 1b9e98a17d
Notes: sideshowbarker 2024-07-17 19:40:40 +09:00

View File

@ -430,6 +430,11 @@ void TextEditor::paint_event(PaintEvent& event)
painter.translate(frame_thickness(), frame_thickness());
if (!is_multi_line() && m_icon) {
Gfx::IntRect icon_rect { icon_padding(), 1, icon_size(), icon_size() };
painter.draw_scaled_bitmap(icon_rect, *m_icon, m_icon->rect());
}
if (m_gutter_visible) {
auto gutter_rect = gutter_rect_in_inner_coordinates();
painter.fill_rect(gutter_rect, palette().gutter());
@ -717,11 +722,6 @@ void TextEditor::paint_event(PaintEvent& event)
});
}
if (!is_multi_line() && m_icon) {
Gfx::IntRect icon_rect { icon_padding(), 1, icon_size(), icon_size() };
painter.draw_scaled_bitmap(icon_rect, *m_icon, m_icon->rect());
}
if (is_enabled() && is_focused() && m_cursor_state && !is_displayonly())
painter.fill_rect(cursor_content_rect(), palette().text_cursor());
}