mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibGUI: Return early if drag_data_type is null (#3919)
If the user tries to drag an item with a null drag data type from an AbstractView, return from the mouse event early.
This commit is contained in:
parent
5ed7ca3627
commit
9efcb5d290
Notes:
sideshowbarker
2024-07-19 17:32:40 +09:00
Author: https://github.com/AmusedNetwork 🔰 Commit: https://github.com/SerenityOS/serenity/commit/9efcb5d2904 Pull-request: https://github.com/SerenityOS/serenity/pull/3919 Reviewed-by: https://github.com/awesomekling
1 changed files with 4 additions and 1 deletions
|
@ -265,6 +265,10 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
||||||
auto hovered_index = index_at_event_position(event.position());
|
auto hovered_index = index_at_event_position(event.position());
|
||||||
set_hovered_index(hovered_index);
|
set_hovered_index(hovered_index);
|
||||||
|
|
||||||
|
auto data_type = m_model->drag_data_type();
|
||||||
|
if (data_type.is_null())
|
||||||
|
return ScrollableWidget::mousemove_event(event);
|
||||||
|
|
||||||
if (!m_might_drag)
|
if (!m_might_drag)
|
||||||
return ScrollableWidget::mousemove_event(event);
|
return ScrollableWidget::mousemove_event(event);
|
||||||
|
|
||||||
|
@ -280,7 +284,6 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
||||||
if (distance_travelled_squared <= drag_distance_threshold)
|
if (distance_travelled_squared <= drag_distance_threshold)
|
||||||
return ScrollableWidget::mousemove_event(event);
|
return ScrollableWidget::mousemove_event(event);
|
||||||
|
|
||||||
auto data_type = m_model->drag_data_type();
|
|
||||||
ASSERT(!data_type.is_null());
|
ASSERT(!data_type.is_null());
|
||||||
|
|
||||||
dbg() << "Initiate drag!";
|
dbg() << "Initiate drag!";
|
||||||
|
|
Loading…
Reference in a new issue