chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.34k stars 467 forks source link

linux: ViewsButtonTest.MenuButton failures due to context menu placement #3330

Open magreenblatt opened 2 years ago

magreenblatt commented 2 years ago

Original report by me.


Views is used on Windows/Linux (windowed mode) to create the browser. We should also use Views to create the context menu and remove the platform-specific implementation on Windows. This will also provide default Views menus for OSR clients.

magreenblatt commented 2 years ago

The menu is a special Widget type created via this call stack (Windows M102):

>   views.dll!views::Widget::Init(views::Widget::InitParams params) Line 322    C++
    views.dll!views::MenuHost::InitMenuHost(const views::MenuHost::InitParams & init_params) Line 167   C++
    views.dll!views::SubmenuView::ShowAt(const views::MenuHost::InitParams & init_params) Line 407  C++
    views.dll!views::MenuController::OpenMenuImpl(views::MenuItemView * item, bool show) Line 2199  C++
    views.dll!views::MenuController::OpenMenu(views::MenuItemView * item) Line 2127 C++
    views.dll!views::MenuController::CommitPendingSelection() Line 2088 C++
    views.dll!views::MenuController::SetSelection(views::MenuItemView * menu_item, int selection_types) Line 1407   C++
    views.dll!views::MenuController::Run(views::Widget * parent, views::MenuButtonController * button_controller, views::MenuItemView * root, const gfx::Rect & bounds, views::MenuAnchorPosition position, bool context_menu, bool is_nested_drag, aura::Window * native_view_for_gestures) Line 540   C++
    views.dll!views::internal::MenuRunnerImpl::RunMenuAt(views::Widget * parent, views::MenuButtonController * button_controller, const gfx::Rect & bounds, views::MenuAnchorPosition anchor, int run_types, aura::Window * native_view_for_gestures) Line 184  C++
    views.dll!views::internal::MenuRunnerImplAdapter::RunMenuAt(views::Widget * parent, views::MenuButtonController * button_controller, const gfx::Rect & bounds, views::MenuAnchorPosition anchor, int types, aura::Window * native_view_for_gestures) Line 40    C++
    views.dll!views::MenuRunner::RunMenuAt(views::Widget * parent, views::MenuButtonController * button_controller, const gfx::Rect & bounds, views::MenuAnchorPosition anchor, ui::MenuSourceType source_type, aura::Window * native_view_for_gestures) Line 82    C++
    libcef.dll!CefMenuRunnerViewsNative::RunContextMenu(AlloyBrowserHostImpl * browser, CefMenuModelImpl * model, const content::ContextMenuParams & params) Line 34    C++
    libcef.dll!CefMenuManager::CreateContextMenu(const content::ContextMenuParams & params) Line 199    C++

magreenblatt commented 2 years ago

Context menu behavior on Linux is still a bit broken in cefclient.

  1. OSR context menu doesn’t display (see issue #2640)
  2. Linux theme is applied to the menu with “default” mode, but not with --multi-threaded-message-loop or --use-views
  3. Menu position is off with “default” mode but correct with the others.

magreenblatt commented 2 years ago

alloy: Use Views context menus on Windows/Linux (fixes issue #3330)

→ <<cset 7a372a642b77 (bb)>>

magreenblatt commented 1 year ago

The following tests are flaky (mostly failing) on Linux at M112 due to the context menu appearing in the wrong location (offset right/down). Clicking on the button a 2nd time (manually) causes the menu to appear in the expected location.

[  FAILED  ] ViewsButtonTest.MenuButtonClickFramedWithTextWithImageFramelessWindow
[  FAILED  ] ViewsButtonTest.MenuButtonClickFramedWithTextNoImageFramelessWindow
[  FAILED  ] ViewsButtonTest.MenuButtonClickFramedNoTextWithImageFramelessWindow
[  FAILED  ] ViewsButtonTest.MenuButtonClickFramelessWithTextWithImageFramelessWindow
[  FAILED  ] ViewsButtonTest.MenuButtonClickFramelessWithTextNoImageFramelessWindow
[  FAILED  ] ViewsButtonTest.MenuButtonClickFramelessNoTextWithImageFramelessWindow
[  FAILED  ] ViewsButtonTest.MenuButtonClickFramelessNoTextNoImageFramelessWindow

magreenblatt commented 1 year ago

Reopening due to issues on Linux.

magreenblatt commented 2 years ago
magreenblatt commented 2 years ago
magreenblatt commented 1 year ago