Bug 1685218 - Delegate SynthesizeNativeMouseScrollEvent from nsCocoaWindow to mPopupContentView. r=mstange

Thus we can properly dispatch mouse scroll events to popup window.

Differential Revision: https://phabricator.services.mozilla.com/D101067
This commit is contained in:
Hiroyuki Ikezoe 2021-01-08 03:05:34 +00:00
Родитель 20f8199ab3
Коммит b830ff1685
3 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -28,7 +28,6 @@ support-files =
!/browser/components/extensions/test/browser/head.js
!/browser/components/extensions/test/browser/head_browserAction.js
[browser_test_scrolling_in_extension_popup_window.js]
skip-if = (os == 'mac') # bug 1685218
support-files =
!/browser/components/extensions/test/browser/head.js
!/browser/components/extensions/test/browser/head_browserAction.js

Просмотреть файл

@ -314,6 +314,12 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint, uint32_t aNativeMessage,
uint32_t aModifierFlags,
nsIObserver* aObserver) override;
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
uint32_t aNativeMessage, double aDeltaX,
double aDeltaY, double aDeltaZ,
uint32_t aModifierFlags,
uint32_t aAdditionalFlags,
nsIObserver* aObserver) override;
virtual void LockAspectRatio(bool aShouldLock) override;
void DispatchSizeModeEvent();

Просмотреть файл

@ -2511,6 +2511,25 @@ NS_IMETHODIMP nsCocoaWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPo
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP nsCocoaWindow::SynthesizeNativeMouseScrollEvent(
LayoutDeviceIntPoint aPoint, uint32_t aNativeMessage, double aDeltaX, double aDeltaY,
double aDeltaZ, uint32_t aModifierFlags, uint32_t aAdditionalFlags, nsIObserver* aObserver) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
AutoObserverNotifier notifier(aObserver, "mousescrollevent");
if (mPopupContentView) {
// Pass nullptr as the observer so that the AutoObserverNotification in
// nsChildView::SynthesizeNativeMouseScrollEvent will be ignored.
return mPopupContentView->SynthesizeNativeMouseScrollEvent(aPoint, aNativeMessage, aDeltaX,
aDeltaY, aDeltaZ, aModifierFlags,
aAdditionalFlags, nullptr);
}
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
void nsCocoaWindow::LockAspectRatio(bool aShouldLock) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;