mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-27 01:50:24 +00:00
LibGUI: Remove has_visible_list members from TextEditor
This was a kludge to paint ComboBox editors before the advent of accessory windows, isn't being used anymore, and was inadvertently letting two ComboBoxes paint as if both had focus.
This commit is contained in:
parent
906cccbf7f
commit
d2d69f3efb
Notes:
sideshowbarker
2024-07-18 21:18:14 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/d2d69f3efb1 Pull-request: https://github.com/SerenityOS/serenity/pull/5823
3 changed files with 3 additions and 17 deletions
|
@ -251,7 +251,6 @@ void ComboBox::open()
|
|||
Gfx::IntRect list_window_rect { my_screen_rect.bottom_left(), size };
|
||||
list_window_rect.intersect(Desktop::the().rect().shrunken(0, taskbar_height + menubar_height + offset));
|
||||
|
||||
m_editor->set_has_visible_list(true);
|
||||
m_editor->set_focus(true);
|
||||
if (m_selected_index.has_value()) {
|
||||
// Don't set m_updating_model to true here because we only want to
|
||||
|
@ -272,8 +271,6 @@ void ComboBox::open()
|
|||
void ComboBox::close()
|
||||
{
|
||||
m_list_window->hide();
|
||||
m_editor->set_has_visible_list(false);
|
||||
m_editor->set_focus(true);
|
||||
}
|
||||
|
||||
String ComboBox::text() const
|
||||
|
|
|
@ -400,7 +400,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
painter.add_clip_rect(event.rect());
|
||||
painter.fill_rect(event.rect(), widget_background_color);
|
||||
|
||||
if (is_displayonly() && (is_focused() || has_visible_list())) {
|
||||
if (is_displayonly() && is_focused()) {
|
||||
widget_background_color = palette().selection();
|
||||
Gfx::IntRect display_rect {
|
||||
widget_inner_rect().x() + 1,
|
||||
|
@ -502,12 +502,12 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
} else if (!document().has_spans()) {
|
||||
// Fast-path for plain text
|
||||
auto color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
|
||||
if (is_displayonly() && (is_focused() || has_visible_list()))
|
||||
if (is_displayonly() && is_focused())
|
||||
color = palette().color(is_enabled() ? Gfx::ColorRole::SelectionText : Gfx::ColorRole::DisabledText);
|
||||
painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, color);
|
||||
} else {
|
||||
auto unspanned_color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
|
||||
if (is_displayonly() && (is_focused() || has_visible_list()))
|
||||
if (is_displayonly() && is_focused())
|
||||
unspanned_color = palette().color(is_enabled() ? Gfx::ColorRole::SelectionText : Gfx::ColorRole::DisabledText);
|
||||
RefPtr<Gfx::Font> unspanned_font = this->font();
|
||||
|
||||
|
@ -1375,13 +1375,6 @@ void TextEditor::set_mode(const Mode mode)
|
|||
set_override_cursor(Gfx::StandardCursor::None);
|
||||
}
|
||||
|
||||
void TextEditor::set_has_visible_list(bool visible)
|
||||
{
|
||||
if (m_has_visible_list == visible)
|
||||
return;
|
||||
m_has_visible_list = visible;
|
||||
}
|
||||
|
||||
void TextEditor::did_update_selection()
|
||||
{
|
||||
m_cut_action->set_enabled(is_editable() && has_selection());
|
||||
|
|
|
@ -81,9 +81,6 @@ public:
|
|||
void set_visualize_trailing_whitespace(bool);
|
||||
bool visualize_trailing_whitespace() const { return m_visualize_trailing_whitespace; }
|
||||
|
||||
bool has_visible_list() const { return m_has_visible_list; }
|
||||
void set_has_visible_list(bool);
|
||||
|
||||
virtual bool is_automatic_indentation_enabled() const final { return m_automatic_indentation_enabled; }
|
||||
void set_automatic_indentation_enabled(bool enabled) { m_automatic_indentation_enabled = enabled; }
|
||||
|
||||
|
@ -320,7 +317,6 @@ private:
|
|||
bool m_has_pending_change_notification { false };
|
||||
bool m_automatic_indentation_enabled { false };
|
||||
WrappingMode m_wrapping_mode { WrappingMode::NoWrap };
|
||||
bool m_has_visible_list { false };
|
||||
bool m_visualize_trailing_whitespace { true };
|
||||
int m_line_spacing { 4 };
|
||||
size_t m_soft_tab_width { 4 };
|
||||
|
|
Loading…
Reference in a new issue