mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibWebView+UI: Handle DPR for select elements like other menus
The select dropdown was doing its own ad-hoc method of handling DPR. We now handle it just like other context menus. Previously, the drop down in the AppKit chrome was twice as large as it should be.
This commit is contained in:
parent
3961a4f16a
commit
9b6ae962d0
Notes:
github-actions[bot]
2025-03-22 16:29:25 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/9b6ae962d03 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4036
3 changed files with 3 additions and 4 deletions
|
@ -610,7 +610,7 @@ void WebContentClient::did_request_select_dropdown(u64 page_id, Gfx::IntPoint co
|
|||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_request_select_dropdown)
|
||||
view->on_request_select_dropdown(content_position, minimum_width, items);
|
||||
view->on_request_select_dropdown(view->to_widget_position(content_position), minimum_width / view->device_pixel_ratio(), items);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -963,8 +963,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
|||
[self.select_dropdown addItem:[NSMenuItem separatorItem]];
|
||||
}
|
||||
|
||||
auto device_pixel_ratio = m_web_view_bridge->device_pixel_ratio();
|
||||
auto* event = Ladybird::create_context_menu_mouse_event(self, Gfx::IntPoint { content_position.x() / device_pixel_ratio, content_position.y() / device_pixel_ratio });
|
||||
auto* event = Ladybird::create_context_menu_mouse_event(self, content_position);
|
||||
[NSMenu popUpContextMenu:self.select_dropdown withEvent:event forView:self];
|
||||
};
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ WebContentView::WebContentView(QWidget* window, RefPtr<WebView::WebContentClient
|
|||
|
||||
on_request_select_dropdown = [this](Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items) {
|
||||
m_select_dropdown->clear();
|
||||
m_select_dropdown->setMinimumWidth(minimum_width / device_pixel_ratio());
|
||||
m_select_dropdown->setMinimumWidth(minimum_width);
|
||||
|
||||
auto add_menu_item = [this](Web::HTML::SelectItemOption const& item_option, bool in_option_group) {
|
||||
QAction* action = new QAction(qstring_from_ak_string(in_option_group ? MUST(String::formatted(" {}", item_option.label)) : item_option.label), this);
|
||||
|
|
Loading…
Add table
Reference in a new issue