fix: enable autofill popups on mac (#16308)
* feat: enable autofill popups on mac * fix: make popup positioning better * fix: don't try to show popup when widget is closing or not visible * fix: unify conditions * refactor: use PopupViewCommon from chrome directly * lint: mark constructor explicit * fix: use a patch instead of dummy functions to make things compile on Windows * chore: address review suggestions * Update atom/browser/ui/cocoa/views_delegate_mac.mm Co-Authored-By: brenca <benecene@gmail.com>
This commit is contained in:
parent
36ce3e9546
commit
ccc60a1f33
11 changed files with 97 additions and 142 deletions
|
@ -56,19 +56,12 @@ AutofillPopupView::~AutofillPopupView() {
|
|||
}
|
||||
|
||||
void AutofillPopupView::Show() {
|
||||
if (!popup_)
|
||||
if (!popup_ || !parent_widget_->IsVisible() || parent_widget_->IsClosed())
|
||||
return;
|
||||
|
||||
const bool initialize_widget = !GetWidget();
|
||||
if (initialize_widget) {
|
||||
parent_widget_->AddObserver(this);
|
||||
views::FocusManager* focus_manager = parent_widget_->GetFocusManager();
|
||||
focus_manager->RegisterAccelerator(
|
||||
ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE),
|
||||
ui::AcceleratorManager::kNormalPriority, this);
|
||||
focus_manager->RegisterAccelerator(
|
||||
ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE),
|
||||
ui::AcceleratorManager::kNormalPriority, this);
|
||||
|
||||
// The widget is destroyed by the corresponding NativeWidget, so we use
|
||||
// a weak pointer to hold the reference and don't have to worry about
|
||||
|
@ -487,7 +480,6 @@ void AutofillPopupView::ClearSelection() {
|
|||
}
|
||||
|
||||
void AutofillPopupView::RemoveObserver() {
|
||||
parent_widget_->GetFocusManager()->UnregisterAccelerators(this);
|
||||
parent_widget_->RemoveObserver(this);
|
||||
views::WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue