From 95cbc1282ffd60d91010615f45b0eed32725930c Mon Sep 17 00:00:00 2001 From: Fedor Date: Sat, 19 Apr 2025 19:17:00 +0300 Subject: [PATCH] 68.14.8 - widget --- widget/BasicEvents.h | 6 ++ widget/PuppetWidget.cpp | 99 ++++++----------- widget/PuppetWidget.h | 13 +-- widget/WidgetEventImpl.cpp | 2 +- widget/android/nsWindow.cpp | 10 +- .../{444260-1.xul => 444260-1.xhtml} | 0 widget/cocoa/crashtests/crashtests.list | 2 +- widget/cocoa/nsAppShell.mm | 8 ++ widget/cocoa/nsChildView.h | 2 +- widget/cocoa/nsChildView.mm | 20 ++-- widget/cocoa/nsCocoaUtils.mm | 6 +- widget/cocoa/nsCocoaWindow.h | 1 + widget/cocoa/nsCocoaWindow.mm | 20 ++-- widget/cocoa/nsMenuX.mm | 1 - widget/gtk/nsWindow.cpp | 23 ++-- widget/gtk/nsWindow.h | 1 + widget/nsBaseDragService.cpp | 4 +- widget/nsBaseWidget.cpp | 16 +-- widget/nsIWidget.h | 13 +++ widget/nsIWidgetListener.cpp | 4 +- widget/nsIWidgetListener.h | 6 +- .../browser/browser_test_clipboardcache.js | 2 +- ...6713_window.xul => bug586713_window.xhtml} | 0 widget/tests/chrome.ini | 102 +++++++++--------- ...win.xul => chrome_context_menus_win.xhtml} | 0 .../{empty_window.xul => empty_window.xhtml} | 0 widget/tests/moz.build | 4 +- ...s_window.xul => native_menus_window.xhtml} | 0 ...ndow.xul => native_mouse_mac_window.xhtml} | 0 ...ul => standalone_native_menu_window.xhtml} | 1 + ..._changes.xul => system_font_changes.xhtml} | 0 ...ar_previews.xul => taskbar_previews.xhtml} | 0 ...t_bug1123480.xul => test_bug1123480.xhtml} | 0 ...est_bug343416.xul => test_bug343416.xhtml} | 1 + ...est_bug428405.xul => test_bug428405.xhtml} | 0 ...est_bug429954.xul => test_bug429954.xhtml} | 2 +- ...est_bug444800.xul => test_bug444800.xhtml} | 0 ...est_bug466599.xul => test_bug466599.xhtml} | 0 ...est_bug478536.xul => test_bug478536.xhtml} | 2 +- ...est_bug485118.xul => test_bug485118.xhtml} | 0 ...est_bug517396.xul => test_bug517396.xhtml} | 0 ...est_bug522217.xul => test_bug522217.xhtml} | 2 +- ...est_bug538242.xul => test_bug538242.xhtml} | 2 +- ...est_bug586713.xul => test_bug586713.xhtml} | 2 +- ...est_bug593307.xul => test_bug593307.xhtml} | 2 +- ...est_bug596600.xul => test_bug596600.xhtml} | 4 +- ...est_bug673301.xul => test_bug673301.xhtml} | 0 ...est_bug760802.xul => test_bug760802.xhtml} | 0 ...ul => test_chrome_context_menus_win.xhtml} | 2 +- ...est_clipboard.xul => test_clipboard.xhtml} | 0 ... test_composition_text_querycontent.xhtml} | 2 +- widget/tests/test_imestate.html | 10 +- ...est_input_events_on_deactive_window.xhtml} | 0 ...counts.xul => test_key_event_counts.xhtml} | 0 ...{test_keycodes.xul => test_keycodes.xhtml} | 6 ++ ...use_scroll.xul => test_mouse_scroll.xhtml} | 0 ...tive_menus.xul => test_native_menus.xhtml} | 2 +- ...se_mac.xul => test_native_mouse_mac.xhtml} | 2 +- ...ords.xul => test_panel_mouse_coords.xhtml} | 0 ..._colors.xul => test_platform_colors.xhtml} | 0 ...size.xul => test_position_on_resize.xhtml} | 0 ..._events.xul => test_sizemode_events.xhtml} | 2 +- ....xul => test_standalone_native_menu.xhtml} | 2 +- ...ges.xul => test_system_font_changes.xhtml} | 2 +- ...s_bar.xul => test_system_status_bar.xhtml} | 0 ...ogress.xul => test_taskbar_progress.xhtml} | 0 ...w.xul => test_transferable_overflow.xhtml} | 2 +- ...action.xul => test_wheeltransaction.xhtml} | 2 +- ...w_bug429954.xul => window_bug429954.xhtml} | 0 ...w_bug478536.xul => window_bug478536.xhtml} | 0 ...w_bug522217.xul => window_bug522217.xhtml} | 0 ...w_bug538242.xul => window_bug538242.xhtml} | 0 ...ul => window_bug593307_centerscreen.xhtml} | 0 ...n.xul => window_bug593307_offscreen.xhtml} | 2 +- ...indow_composition_text_querycontent.xhtml} | 0 ...windows.xul => window_state_windows.xhtml} | 0 ...tion.xul => window_wheeltransaction.xhtml} | 0 widget/windows/WidgetTraceEvent.cpp | 4 +- widget/windows/nsPrintDialogWin.cpp | 2 +- widget/windows/nsWindow.cpp | 46 +++++++- widget/windows/nsWindow.h | 2 + 81 files changed, 264 insertions(+), 209 deletions(-) rename widget/cocoa/crashtests/{444260-1.xul => 444260-1.xhtml} (100%) rename widget/tests/{bug586713_window.xul => bug586713_window.xhtml} (100%) rename widget/tests/{chrome_context_menus_win.xul => chrome_context_menus_win.xhtml} (100%) rename widget/tests/{empty_window.xul => empty_window.xhtml} (100%) rename widget/tests/{native_menus_window.xul => native_menus_window.xhtml} (100%) rename widget/tests/{native_mouse_mac_window.xul => native_mouse_mac_window.xhtml} (100%) rename widget/tests/{standalone_native_menu_window.xul => standalone_native_menu_window.xhtml} (99%) rename widget/tests/{system_font_changes.xul => system_font_changes.xhtml} (100%) rename widget/tests/{taskbar_previews.xul => taskbar_previews.xhtml} (100%) rename widget/tests/{test_bug1123480.xul => test_bug1123480.xhtml} (100%) rename widget/tests/{test_bug343416.xul => test_bug343416.xhtml} (99%) rename widget/tests/{test_bug428405.xul => test_bug428405.xhtml} (100%) rename widget/tests/{test_bug429954.xul => test_bug429954.xhtml} (95%) rename widget/tests/{test_bug444800.xul => test_bug444800.xhtml} (100%) rename widget/tests/{test_bug466599.xul => test_bug466599.xhtml} (100%) rename widget/tests/{test_bug478536.xul => test_bug478536.xhtml} (94%) rename widget/tests/{test_bug485118.xul => test_bug485118.xhtml} (100%) rename widget/tests/{test_bug517396.xul => test_bug517396.xhtml} (100%) rename widget/tests/{test_bug522217.xul => test_bug522217.xhtml} (94%) rename widget/tests/{test_bug538242.xul => test_bug538242.xhtml} (96%) rename widget/tests/{test_bug586713.xul => test_bug586713.xhtml} (92%) rename widget/tests/{test_bug593307.xul => test_bug593307.xhtml} (98%) rename widget/tests/{test_bug596600.xul => test_bug596600.xhtml} (96%) rename widget/tests/{test_bug673301.xul => test_bug673301.xhtml} (100%) rename widget/tests/{test_bug760802.xul => test_bug760802.xhtml} (100%) rename widget/tests/{test_chrome_context_menus_win.xul => test_chrome_context_menus_win.xhtml} (88%) rename widget/tests/{test_clipboard.xul => test_clipboard.xhtml} (100%) rename widget/tests/{test_composition_text_querycontent.xul => test_composition_text_querycontent.xhtml} (94%) rename widget/tests/{test_input_events_on_deactive_window.xul => test_input_events_on_deactive_window.xhtml} (100%) rename widget/tests/{test_key_event_counts.xul => test_key_event_counts.xhtml} (100%) rename widget/tests/{test_keycodes.xul => test_keycodes.xhtml} (99%) rename widget/tests/{test_mouse_scroll.xul => test_mouse_scroll.xhtml} (100%) rename widget/tests/{test_native_menus.xul => test_native_menus.xhtml} (92%) rename widget/tests/{test_native_mouse_mac.xul => test_native_mouse_mac.xhtml} (91%) rename widget/tests/{test_panel_mouse_coords.xul => test_panel_mouse_coords.xhtml} (100%) rename widget/tests/{test_platform_colors.xul => test_platform_colors.xhtml} (100%) rename widget/tests/{test_position_on_resize.xul => test_position_on_resize.xhtml} (100%) rename widget/tests/{test_sizemode_events.xul => test_sizemode_events.xhtml} (96%) rename widget/tests/{test_standalone_native_menu.xul => test_standalone_native_menu.xhtml} (89%) rename widget/tests/{test_system_font_changes.xul => test_system_font_changes.xhtml} (90%) rename widget/tests/{test_system_status_bar.xul => test_system_status_bar.xhtml} (100%) rename widget/tests/{test_taskbar_progress.xul => test_taskbar_progress.xhtml} (100%) rename widget/tests/{test_transferable_overflow.xul => test_transferable_overflow.xhtml} (99%) rename widget/tests/{test_wheeltransaction.xul => test_wheeltransaction.xhtml} (92%) rename widget/tests/{window_bug429954.xul => window_bug429954.xhtml} (100%) rename widget/tests/{window_bug478536.xul => window_bug478536.xhtml} (100%) rename widget/tests/{window_bug522217.xul => window_bug522217.xhtml} (100%) rename widget/tests/{window_bug538242.xul => window_bug538242.xhtml} (100%) rename widget/tests/{window_bug593307_centerscreen.xul => window_bug593307_centerscreen.xhtml} (100%) rename widget/tests/{window_bug593307_offscreen.xul => window_bug593307_offscreen.xhtml} (92%) rename widget/tests/{window_composition_text_querycontent.xul => window_composition_text_querycontent.xhtml} (100%) rename widget/tests/{window_state_windows.xul => window_state_windows.xhtml} (100%) rename widget/tests/{window_wheeltransaction.xul => window_wheeltransaction.xhtml} (100%) diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index 9be0319030..29e8eeb154 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -897,6 +897,12 @@ class WidgetEvent : public WidgetEventTime { // All wheel events are composed mFlags.mComposed = mMessage == eWheel; break; + case eMouseScrollEventClass: + // Legacy mouse scroll events are composed too, for consistency with + // wheel. + mFlags.mComposed = mMessage == eLegacyMouseLineOrPageScroll || + mMessage == eLegacyMousePixelScroll; + break; default: mFlags.mComposed = false; break; diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 87b0916668..3c183511d0 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -6,6 +6,7 @@ #include "ClientLayerManager.h" #include "gfxPlatform.h" +#include "nsRefreshDriver.h" #include "mozilla/dom/BrowserChild.h" #include "mozilla/dom/TabGroup.h" #include "mozilla/gfx/gfxVars.h" @@ -160,7 +161,6 @@ void PuppetWidget::Destroy() { Base::OnDestroy(); Base::Destroy(); - mPaintTask.Revoke(); if (mMemoryPressureObserver) { mMemoryPressureObserver->Unregister(); mMemoryPressureObserver = nullptr; @@ -267,13 +267,10 @@ void PuppetWidget::Invalidate(const LayoutDeviceIntRect& aRect) { return; } - mDirtyRegion.Or(mDirtyRegion, aRect); - - if (mBrowserChild && !mDirtyRegion.IsEmpty() && !mPaintTask.IsPending()) { - mPaintTask = new PaintTask(this); - nsCOMPtr event(mPaintTask.get()); + if (mBrowserChild && !aRect.IsEmpty() && !mWidgetPaintTask.IsPending()) { + mWidgetPaintTask = new WidgetPaintTask(this); + nsCOMPtr event(mWidgetPaintTask.get()); mBrowserChild->TabGroup()->Dispatch(TaskCategory::Other, event.forget()); - return; } } @@ -705,6 +702,18 @@ bool PuppetWidget::HaveValidInputContextCache() const { IMEStateManager::GetWidgetForActiveInputContext() == this); } +nsRefreshDriver* PuppetWidget::GetTopLevelRefreshDriver() const { + if (!mBrowserChild) { + return nullptr; + } + + if (PresShell* presShell = mBrowserChild->GetTopLevelPresShell()) { + return presShell->GetRefreshDriver(); + } + + return nullptr; +} + void PuppetWidget::SetInputContext(const InputContext& aContext, const InputContextAction& aAction) { mInputContext = aContext; @@ -974,64 +983,6 @@ void PuppetWidget::ClearCachedCursor() { mCustomCursor = nullptr; } -nsresult PuppetWidget::Paint() { - MOZ_ASSERT(!mDirtyRegion.IsEmpty(), "paint event logic messed up"); - - if (!GetCurrentWidgetListener()) return NS_OK; - - LayoutDeviceIntRegion region = mDirtyRegion; - - // reset repaint tracking - mDirtyRegion.SetEmpty(); - mPaintTask.Revoke(); - - RefPtr strongThis(this); - - GetCurrentWidgetListener()->WillPaintWindow(this); - - if (GetCurrentWidgetListener()) { -#ifdef DEBUG - debug_DumpPaintEvent(stderr, this, region.ToUnknownRegion(), "PuppetWidget", - 0); -#endif - - if (mLayerManager->GetBackendType() == - mozilla::layers::LayersBackend::LAYERS_CLIENT || - mLayerManager->GetBackendType() == - mozilla::layers::LayersBackend::LAYERS_WR || - (mozilla::layers::LayersBackend::LAYERS_BASIC == - mLayerManager->GetBackendType() && - mBrowserChild && mBrowserChild->IsLayersConnected().isSome())) { - // Do nothing, the compositor will handle drawing - if (mBrowserChild) { - mBrowserChild->NotifyPainted(); - } - } else if (mozilla::layers::LayersBackend::LAYERS_BASIC == - mLayerManager->GetBackendType()) { - RefPtr ctx = gfxContext::CreateOrNull(mDrawTarget); - if (!ctx) { - gfxDevCrash(LogReason::InvalidContext) - << "PuppetWidget context problem " << gfx::hexa(mDrawTarget); - return NS_ERROR_FAILURE; - } - ctx->Rectangle(gfxRect(0, 0, 0, 0)); - ctx->Clip(); - AutoLayerManagerSetup setupLayerManager(this, ctx, - BufferMode::BUFFER_NONE); - GetCurrentWidgetListener()->PaintWindow(this, region); - if (mBrowserChild) { - mBrowserChild->NotifyPainted(); - } - } - } - - if (GetCurrentWidgetListener()) { - GetCurrentWidgetListener()->DidPaintWindow(); - } - - return NS_OK; -} - void PuppetWidget::SetChild(PuppetWidget* aChild) { MOZ_ASSERT(this != aChild, "can't parent a widget to itself"); MOZ_ASSERT(!aChild->mChild, @@ -1041,15 +992,29 @@ void PuppetWidget::SetChild(PuppetWidget* aChild) { } NS_IMETHODIMP -PuppetWidget::PaintTask::Run() { +PuppetWidget::WidgetPaintTask::Run() { if (mWidget) { mWidget->Paint(); } return NS_OK; } +void PuppetWidget::Paint() { + if (!GetCurrentWidgetListener()) return; + + mWidgetPaintTask.Revoke(); + + RefPtr strongThis(this); + + GetCurrentWidgetListener()->WillPaintWindow(this); + + if (GetCurrentWidgetListener()) { + GetCurrentWidgetListener()->DidPaintWindow(); + } +} + void PuppetWidget::PaintNowIfNeeded() { - if (IsVisible() && mPaintTask.IsPending()) { + if (IsVisible() && mWidgetPaintTask.IsPending()) { Paint(); } } diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index 8d1ebe558c..fe3b630efa 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -320,7 +320,7 @@ class PuppetWidget : public nsBaseWidget, virtual void OnMemoryPressure(layers::MemoryPressureReason aWhy) override; private: - nsresult Paint(); + void Paint(); void SetChild(PuppetWidget* aChild); @@ -346,17 +346,19 @@ class PuppetWidget : public nsBaseWidget, // IMEStateManager, the cache is valid. bool HaveValidInputContextCache() const; - class PaintTask : public Runnable { + class WidgetPaintTask : public Runnable { public: NS_DECL_NSIRUNNABLE - explicit PaintTask(PuppetWidget* widget) - : Runnable("PuppetWidget::PaintTask"), mWidget(widget) {} + explicit WidgetPaintTask(PuppetWidget* widget) + : Runnable("PuppetWidget::WidgetPaintTask"), mWidget(widget) {} void Revoke() { mWidget = nullptr; } private: PuppetWidget* mWidget; }; + nsRefreshDriver* GetTopLevelRefreshDriver() const; + // BrowserChild normally holds a strong reference to this PuppetWidget // or its root ancestor, but each PuppetWidget also needs a // reference back to BrowserChild (e.g. to delegate nsIWidget IME calls @@ -367,8 +369,7 @@ class PuppetWidget : public nsBaseWidget, // The "widget" to which we delegate events if we don't have an // event handler. RefPtr mChild; - LayoutDeviceIntRegion mDirtyRegion; - nsRevocableEventPtr mPaintTask; + nsRevocableEventPtr mWidgetPaintTask; RefPtr mMemoryPressureObserver; // XXX/cjones: keeping this around until we teach LayerManager to do // retained-content-only transactions diff --git a/widget/WidgetEventImpl.cpp b/widget/WidgetEventImpl.cpp index d909b632bd..575062b643 100644 --- a/widget/WidgetEventImpl.cpp +++ b/widget/WidgetEventImpl.cpp @@ -208,7 +208,7 @@ Command GetInternalCommand(const char* aCommandName, if (NS_FAILED(rv)) { return Command::FormatJustifyNone; } - cValue = NS_ConvertUTF16toUTF8(value); + CopyUTF16toUTF8(value, cValue); } if (cValue.LowerCaseEqualsASCII("left")) { return Command::FormatJustifyLeft; diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 4fffe727b5..bb3535c6d5 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -41,7 +41,7 @@ using mozilla::dom::ContentParent; #include "nsIWidgetListener.h" #include "nsIWindowWatcher.h" -#include "nsIXULWindow.h" +#include "nsIAppWindow.h" #include "nsAppShell.h" #include "nsFocusManager.h" @@ -1234,11 +1234,11 @@ void nsWindow::GeckoViewSupport::Open( aInitData); if (window->mWidgetListener) { - nsCOMPtr xulWindow(window->mWidgetListener->GetXULWindow()); - if (xulWindow) { - // Our window is not intrinsically sized, so tell nsXULWindow to + nsCOMPtr appWindow(window->mWidgetListener->GetAppWindow()); + if (appWindow) { + // Our window is not intrinsically sized, so tell AppWindow to // not set a size for us. - xulWindow->SetIntrinsicallySized(false); + appWindow->SetIntrinsicallySized(false); } } } diff --git a/widget/cocoa/crashtests/444260-1.xul b/widget/cocoa/crashtests/444260-1.xhtml similarity index 100% rename from widget/cocoa/crashtests/444260-1.xul rename to widget/cocoa/crashtests/444260-1.xhtml diff --git a/widget/cocoa/crashtests/crashtests.list b/widget/cocoa/crashtests/crashtests.list index b65fe01394..0559273a43 100644 --- a/widget/cocoa/crashtests/crashtests.list +++ b/widget/cocoa/crashtests/crashtests.list @@ -3,7 +3,7 @@ load 397209-1.html load 403296-1.xhtml load 419737-1.html load 435223-1.html -load 444260-1.xul +load chrome://reftest/content/crashtests/widget/cocoa/crashtests/444260-1.xhtml load 444864-1.html load 449111-1.html load 460349-1.xhtml diff --git a/widget/cocoa/nsAppShell.mm b/widget/cocoa/nsAppShell.mm index fb9ab6cbae..e142ff7cb6 100644 --- a/widget/cocoa/nsAppShell.mm +++ b/widget/cocoa/nsAppShell.mm @@ -42,6 +42,9 @@ #include "nsIDOMWakeLockListener.h" #include "nsIPowerManagerService.h" +#include "nsIObserverService.h" +#include "mozilla/Services.h" + using namespace mozilla; using namespace mozilla::widget; @@ -877,6 +880,11 @@ nsAppShell::AfterProcessNextEvent(nsIThreadInternal* aThread, bool aEventWasProc [currentEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask; } + nsCOMPtr observerService = services::GetObserverService(); + if (observerService) { + observerService->NotifyObservers(nullptr, NS_WIDGET_MAC_APP_ACTIVATE_OBSERVER_TOPIC, nullptr); + } + NS_OBJC_END_TRY_ABORT_BLOCK; } diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 58bee03a7d..3be3538708 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -518,7 +518,7 @@ class nsChildView final : public nsBaseWidget { NSView* GetEditorView(); - nsCocoaWindow* GetXULWindowWidget() const; + nsCocoaWindow* GetAppWindowWidget() const; virtual void ReparentNativeWidget(nsIWidget* aNewParent) override; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 7c68c586aa..3a6ef00c29 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -494,7 +494,7 @@ void nsChildView::TearDownView() { NS_OBJC_END_TRY_ABORT_BLOCK; } -nsCocoaWindow* nsChildView::GetXULWindowWidget() const { +nsCocoaWindow* nsChildView::GetAppWindowWidget() const { id windowDelegate = [[mView window] delegate]; if (windowDelegate && [windowDelegate isKindOfClass:[WindowDelegate class]]) { return [(WindowDelegate*)windowDelegate geckoWidget]; @@ -596,7 +596,7 @@ void* nsChildView::GetNativeData(uint32_t aDataType) { nsTransparencyMode nsChildView::GetTransparencyMode() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - nsCocoaWindow* windowWidget = GetXULWindowWidget(); + nsCocoaWindow* windowWidget = GetAppWindowWidget(); return windowWidget ? windowWidget->GetTransparencyMode() : eTransparencyOpaque; NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(eTransparencyOpaque); @@ -607,7 +607,7 @@ nsTransparencyMode nsChildView::GetTransparencyMode() { void nsChildView::SetTransparencyMode(nsTransparencyMode aMode) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - nsCocoaWindow* windowWidget = GetXULWindowWidget(); + nsCocoaWindow* windowWidget = GetAppWindowWidget(); if (windowWidget) { windowWidget->SetTransparencyMode(aMode); } @@ -624,7 +624,7 @@ bool nsChildView::IsVisible() const { return mVisible; } - if (!GetXULWindowWidget()->IsVisible()) { + if (!GetAppWindowWidget()->IsVisible()) { return false; } @@ -831,7 +831,7 @@ void nsChildView::BackingScaleFactorChanged() { mNativeLayerRoot->SetBackingScale(mBackingScaleFactor); } - if (mWidgetListener && !mWidgetListener->GetXULWindow()) { + if (mWidgetListener && !mWidgetListener->GetAppWindow()) { if (PresShell* presShell = mWidgetListener->GetPresShell()) { presShell->BackingScaleFactorChanged(); } @@ -1165,7 +1165,7 @@ static NSMenuItem* NativeMenuItemWithLocation(NSMenu* menubar, NSString* locatio bool nsChildView::SendEventToNativeMenuSystem(NSEvent* aEvent) { bool handled = false; - nsCocoaWindow* widget = GetXULWindowWidget(); + nsCocoaWindow* widget = GetAppWindowWidget(); if (widget) { nsMenuBarX* mb = widget->GetMenuBar(); if (mb) { @@ -1230,7 +1230,7 @@ nsresult nsChildView::ActivateNativeMenuItemAt(const nsAString& indexString) { nsresult nsChildView::ForceUpdateNativeMenuAt(const nsAString& indexString) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - nsCocoaWindow* widget = GetXULWindowWidget(); + nsCocoaWindow* widget = GetAppWindowWidget(); if (widget) { nsMenuBarX* mb = widget->GetMenuBar(); if (mb) { @@ -1913,7 +1913,7 @@ void nsChildView::PrepareWindowEffects() { mIsCoveringTitlebar = [mView isCoveringTitlebar]; NSInteger styleMask = [[mView window] styleMask]; bool wasFullscreen = mIsFullscreen; - nsCocoaWindow* windowWidget = GetXULWindowWidget(); + nsCocoaWindow* windowWidget = GetAppWindowWidget(); mIsFullscreen = (styleMask & NSFullScreenWindowMask) || (windowWidget && windowWidget->InFullScreenMode()); @@ -3417,7 +3417,7 @@ NSEvent* gLastDragMouseDownEvent = nil; } - (void)viewWillStartLiveResize { - nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetXULWindowWidget() : nullptr; + nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetAppWindowWidget() : nullptr; if (windowWidget) { windowWidget->NotifyLiveResizeStarted(); } @@ -3430,7 +3430,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // is null here, that might be problematic because we might get stuck with // a content process that has the displayport suppressed. If that scenario // arises (I'm not sure that it does) we will need to handle it gracefully. - nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetXULWindowWidget() : nullptr; + nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetAppWindowWidget() : nullptr; if (windowWidget) { windowWidget->NotifyLiveResizeStopped(); } diff --git a/widget/cocoa/nsCocoaUtils.mm b/widget/cocoa/nsCocoaUtils.mm index e4ea87d988..53cad6793f 100644 --- a/widget/cocoa/nsCocoaUtils.mm +++ b/widget/cocoa/nsCocoaUtils.mm @@ -20,7 +20,7 @@ #include "nsIAppShellService.h" #include "nsIOSPermissionRequest.h" #include "nsIRunnable.h" -#include "nsIXULWindow.h" +#include "nsIAppWindow.h" #include "nsIBaseWindow.h" #include "nsMenuUtilsX.h" #include "nsToolkit.h" @@ -271,7 +271,7 @@ nsIWidget* nsCocoaUtils::GetHiddenWindowWidget() { return nullptr; } - nsCOMPtr hiddenWindow; + nsCOMPtr hiddenWindow; appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow)); if (!hiddenWindow) { // Don't warn, this happens during shutdown, bug 358607. @@ -281,7 +281,7 @@ nsIWidget* nsCocoaUtils::GetHiddenWindowWidget() { nsCOMPtr baseHiddenWindow; baseHiddenWindow = do_GetInterface(hiddenWindow); if (!baseHiddenWindow) { - NS_WARNING("Couldn't get nsIBaseWindow from hidden window (nsIXULWindow)"); + NS_WARNING("Couldn't get nsIBaseWindow from hidden window (nsIAppWindow)"); return nullptr; } diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h index 51559d22d5..456a1cca22 100644 --- a/widget/cocoa/nsCocoaWindow.h +++ b/widget/cocoa/nsCocoaWindow.h @@ -294,6 +294,7 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa { virtual void SetWindowShadowStyle(mozilla::StyleWindowShadow aStyle) override; virtual void SetWindowOpacity(float aOpacity) override; virtual void SetWindowTransform(const mozilla::gfx::Matrix& aTransform) override; + virtual void SetWindowMouseTransparent(bool aIsTransparent) override; virtual void SetShowsToolbarButton(bool aShow) override; virtual void SetShowsFullScreenButton(bool aShow) override; virtual void SetWindowAnimationType(WindowAnimationType aType) override; diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm index 45a650a76b..71a805fcb1 100644 --- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -17,7 +17,7 @@ #include "nsIAppShellService.h" #include "nsIBaseWindow.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsIXULWindow.h" +#include "nsIAppWindow.h" #include "nsToolkit.h" #include "nsPIDOMWindow.h" #include "nsThreadUtils.h" @@ -306,9 +306,8 @@ nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, NS_ENSURE_SUCCESS(rv, rv); if (mWindowType == eWindowType_popup) { - if (aInitData->mMouseTransparent) { - [mWindow setIgnoresMouseEvents:YES]; - } + SetWindowMouseTransparent(aInitData->mMouseTransparent); + // now we can convert newBounds to device pixels for the window we created, // as the child view expects a rect expressed in the dev pix of its parent LayoutDeviceIntRect devRect = RoundedToInt(newBounds * GetDesktopToDeviceScale()); @@ -653,7 +652,7 @@ void nsCocoaWindow::SetModal(bool aState) { // appears over behave as they should. We can't rely on native methods to // do this, for the following reason: The OS runs modal non-sheet windows // in an event loop (using [NSApplication runModalForWindow:] or similar - // methods) that's incompatible with the modal event loop in nsXULWindow:: + // methods) that's incompatible with the modal event loop in AppWindow:: // ShowModal() (each of these event loops is "exclusive", and can't run at // the same time as other (similar) event loops). if (mWindowType != eWindowType_sheet) { @@ -1617,7 +1616,7 @@ void nsCocoaWindow::BackingScaleFactorChanged() { mBackingScaleFactor = newScale; - if (!mWidgetListener || mWidgetListener->GetXULWindow()) { + if (!mWidgetListener || mWidgetListener->GetAppWindow()) { return; } @@ -2063,6 +2062,15 @@ void nsCocoaWindow::SetWindowTransform(const gfx::Matrix& aTransform) { NS_OBJC_END_TRY_ABORT_BLOCK; } +void nsCocoaWindow::SetWindowMouseTransparent(bool aIsTransparent) { + MOZ_ASSERT(mWindowType == eWindowType_popup, "This should only be called on popup windows."); + if (aIsTransparent) { + [mWindow setIgnoresMouseEvents:YES]; + } else { + [mWindow setIgnoresMouseEvents:NO]; + } +} + void nsCocoaWindow::SetShowsToolbarButton(bool aShow) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; diff --git a/widget/cocoa/nsMenuX.mm b/widget/cocoa/nsMenuX.mm index 140f9bc38b..a9b2817640 100644 --- a/widget/cocoa/nsMenuX.mm +++ b/widget/cocoa/nsMenuX.mm @@ -28,7 +28,6 @@ #include "nsIContent.h" #include "nsIDocumentObserver.h" #include "nsIRollupListener.h" -#include "nsBindingManager.h" #include "nsXULPopupManager.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/EventDispatcher.h" diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 67a5525a59..40a00ff4ed 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -3732,13 +3732,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, } // If the popup ignores mouse events, set an empty input shape. - if (aInitData->mMouseTransparent) { - cairo_rectangle_int_t rect = {0, 0, 0, 0}; - cairo_region_t* region = cairo_region_create_rectangle(&rect); - - gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0); - cairo_region_destroy(region); - } + SetWindowMouseTransparent(aInitData->mMouseTransparent); } } break; @@ -4328,6 +4322,21 @@ nsTransparencyMode nsWindow::GetTransparencyMode() { return mIsTransparent ? eTransparencyTransparent : eTransparencyOpaque; } +void nsWindow::SetWindowMouseTransparent(bool aIsTransparent) { + if (!mGdkWindow) { + return; + } + + cairo_rectangle_int_t emptyRect = {0, 0, 0, 0}; + cairo_region_t* region = + aIsTransparent ? cairo_region_create_rectangle(&emptyRect) : nullptr; + + gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0); + if (region) { + cairo_region_destroy(region); + } +} + // For setting the draggable titlebar region from CSS // with -moz-window-dragging: drag. void nsWindow::UpdateWindowDraggingRegion( diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 38a8a81b2a..bff7e39f5c 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -300,6 +300,7 @@ class nsWindow final : public nsBaseWidget { virtual void SetTransparencyMode(nsTransparencyMode aMode) override; virtual nsTransparencyMode GetTransparencyMode() override; + virtual void SetWindowMouseTransparent(bool aIsTransparent) override; virtual void UpdateOpaqueRegion( const LayoutDeviceIntRegion& aOpaqueRegion) override; virtual nsresult ConfigureChildren( diff --git a/widget/nsBaseDragService.cpp b/widget/nsBaseDragService.cpp index 2471a659ae..23defbbb36 100644 --- a/widget/nsBaseDragService.cpp +++ b/widget/nsBaseDragService.cpp @@ -12,6 +12,7 @@ #include "nsCOMPtr.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIFrame.h" +#include "nsINodeList.h" //MY68 #include "nsFrameLoaderOwner.h" #include "nsIContent.h" #include "nsViewManager.h" @@ -265,8 +266,7 @@ nsBaseDragService::InvokeDragSession( // // The best way to avoid this is to catch the dragstart event on the item // being dragged, and then to call preventDefault() and stopPropagating() on - // it. Alternatively, use EventUtils.synthesizeDragStart, which will do this - // for you. + // it. if (XRE_IsParentProcess()) { MOZ_ASSERT( !xpc::IsInAutomation(), diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index f8ae60458f..f049f44417 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -29,7 +29,7 @@ #include "BasicLayers.h" #include "ClientLayerManager.h" #include "mozilla/layers/Compositor.h" -#include "nsIXULWindow.h" +#include "nsIAppWindow.h" #include "nsIBaseWindow.h" #include "nsXULPopupManager.h" #include "nsIWidgetListener.h" @@ -1645,10 +1645,10 @@ nsIRollupListener* nsBaseWidget::GetActiveRollupListener() { void nsBaseWidget::NotifyWindowDestroyed() { if (!mWidgetListener) return; - nsCOMPtr window = mWidgetListener->GetXULWindow(); - nsCOMPtr xulWindow(do_QueryInterface(window)); - if (xulWindow) { - xulWindow->Destroy(); + nsCOMPtr window = mWidgetListener->GetAppWindow(); + nsCOMPtr appWindow(do_QueryInterface(window)); + if (appWindow) { + appWindow->Destroy(); } } @@ -2029,11 +2029,11 @@ void nsBaseWidget::NotifyLiveResizeStarted() { if (!mWidgetListener) { return; } - nsCOMPtr xulWindow = mWidgetListener->GetXULWindow(); - if (!xulWindow) { + nsCOMPtr appWindow = mWidgetListener->GetAppWindow(); + if (!appWindow) { return; } - mLiveResizeListeners = xulWindow->GetLiveResizeListeners(); + mLiveResizeListeners = appWindow->GetLiveResizeListeners(); for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) { mLiveResizeListeners[i]->LiveResizeStarted(); } diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 697b6a168b..412e0c72f0 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -262,6 +262,12 @@ enum nsTopLevelWidgetZPlacement { // for PlaceBehind() */ #define NS_WIDGET_RESUME_PROCESS_OBSERVER_TOPIC "resume_process_notification" +/** + * When an app(-shell) is activated by the OS, this topic is notified. + * Currently, this only happens on Mac OSX. + */ +#define NS_WIDGET_MAC_APP_ACTIVATE_OBSERVER_TOPIC "mac_app_activate" + namespace mozilla { namespace widget { @@ -1114,6 +1120,13 @@ class nsIWidget : public nsISupports { */ virtual void SetWindowTransform(const mozilla::gfx::Matrix& aTransform) {} + /** + * Set whether the window should ignore mouse events or not. + * + * This is only used on popup windows. + */ + virtual void SetWindowMouseTransparent(bool aIsTransparent) {} + /* * On Mac OS X, this method shows or hides the pill button in the titlebar * that's used to collapse the toolbar. diff --git a/widget/nsIWidgetListener.cpp b/widget/nsIWidgetListener.cpp index bb58c0ba3a..cc400161e0 100644 --- a/widget/nsIWidgetListener.cpp +++ b/widget/nsIWidgetListener.cpp @@ -7,14 +7,14 @@ #include "nsRegion.h" #include "nsView.h" #include "nsIWidget.h" -#include "nsIXULWindow.h" +#include "nsIAppWindow.h" #include "mozilla/BasicEvents.h" #include "mozilla/PresShell.h" using namespace mozilla; -nsIXULWindow* nsIWidgetListener::GetXULWindow() { return nullptr; } +nsIAppWindow* nsIWidgetListener::GetAppWindow() { return nullptr; } nsView* nsIWidgetListener::GetView() { return nullptr; } diff --git a/widget/nsIWidgetListener.h b/widget/nsIWidgetListener.h index d7aa615cd1..ddea62d9b6 100644 --- a/widget/nsIWidgetListener.h +++ b/widget/nsIWidgetListener.h @@ -16,7 +16,7 @@ class nsView; class nsIWidget; -class nsIXULWindow; +class nsIAppWindow; namespace mozilla { class PresShell; @@ -45,11 +45,11 @@ enum nsWindowZ { class nsIWidgetListener { public: /** - * If this listener is for an nsIXULWindow, return it. If this is null, then + * If this listener is for an nsIAppWindow, return it. If this is null, then * this is likely a listener for a view, which can be determined using * GetView. If both methods return null, this will be an nsWebBrowser. */ - virtual nsIXULWindow* GetXULWindow(); + virtual nsIAppWindow* GetAppWindow(); /** * If this listener is for an nsView, return it. diff --git a/widget/tests/browser/browser_test_clipboardcache.js b/widget/tests/browser/browser_test_clipboardcache.js index c9ef752f3f..12c85d2d2e 100644 --- a/widget/tests/browser/browser_test_clipboardcache.js +++ b/widget/tests/browser/browser_test_clipboardcache.js @@ -4,7 +4,7 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); -// Note: widget/tests/test_bug1123480.xul checks whether nsTransferable behaves +// Note: widget/tests/test_bug1123480.xhtml checks whether nsTransferable behaves // as expected with regards to private browsing mode and the clipboard cache, // i.e. that the clipboard is not cached to the disk when private browsing mode // is enabled. diff --git a/widget/tests/bug586713_window.xul b/widget/tests/bug586713_window.xhtml similarity index 100% rename from widget/tests/bug586713_window.xul rename to widget/tests/bug586713_window.xhtml diff --git a/widget/tests/chrome.ini b/widget/tests/chrome.ini index 47c724abad..34a93acb3a 100644 --- a/widget/tests/chrome.ini +++ b/widget/tests/chrome.ini @@ -1,85 +1,85 @@ [DEFAULT] skip-if = os == 'android' support-files = - empty_window.xul + empty_window.xhtml utils.js -[test_bug343416.xul] +[test_bug343416.xhtml] skip-if = debug -[test_bug429954.xul] -support-files = window_bug429954.xul -[test_bug444800.xul] +[test_bug429954.xhtml] +support-files = window_bug429954.xhtml +[test_bug444800.xhtml] tags = clipboard -[test_bug478536.xul] +[test_bug478536.xhtml] skip-if = true # Bug 561929 -support-files = window_bug478536.xul -[test_bug517396.xul] +support-files = window_bug478536.xhtml +[test_bug517396.xhtml] skip-if = (verify && (os == 'win')) -[test_bug538242.xul] -support-files = window_bug538242.xul +[test_bug538242.xhtml] +support-files = window_bug538242.xhtml [test_bug565392.html] tags = clipboard skip-if = toolkit != "windows" -[test_bug593307.xul] -support-files = window_bug593307_offscreen.xul window_bug593307_centerscreen.xul +[test_bug593307.xhtml] +support-files = window_bug593307_offscreen.xhtml window_bug593307_centerscreen.xhtml [test_bug1151186.html] skip-if = os == 'linux' && debug #Bug 1176038 -[test_keycodes.xul] -[test_wheeltransaction.xul] -support-files = window_wheeltransaction.xul +[test_keycodes.xhtml] +[test_wheeltransaction.xhtml] +support-files = window_wheeltransaction.xhtml [test_imestate.html] support-files = window_imestate_iframes.html [test_plugin_scroll_consistency.html] -[test_composition_text_querycontent.xul] -support-files = window_composition_text_querycontent.xul -[test_input_events_on_deactive_window.xul] +[test_composition_text_querycontent.xhtml] +support-files = window_composition_text_querycontent.xhtml +[test_input_events_on_deactive_window.xhtml] support-files = file_input_events_on_deactive_window.html -[test_position_on_resize.xul] +[test_position_on_resize.xhtml] skip-if = (verify && (os == 'win')) -[test_sizemode_events.xul] -[test_taskbar_progress.xul] +[test_sizemode_events.xhtml] +[test_taskbar_progress.xhtml] skip-if = toolkit != "cocoa" && toolkit != "windows" || (os == "win" && os_version == "10.0" && !ccov) # Bug 1456811 -[test_bug760802.xul] -[test_clipboard.xul] +[test_bug760802.xhtml] +[test_clipboard.xhtml] tags = clipboard -[test_panel_mouse_coords.xul] +[test_panel_mouse_coords.xhtml] skip-if = toolkit == "windows" # bug 1009955 # Cocoa -[test_native_menus.xul] +[test_native_menus.xhtml] skip-if = toolkit != "cocoa" -support-files = native_menus_window.xul -[test_native_mouse_mac.xul] +support-files = native_menus_window.xhtml +[test_native_mouse_mac.xhtml] skip-if = toolkit != "cocoa" || os_version == '10.14' # macosx1014: bug 1137575 -support-files = native_mouse_mac_window.xul +support-files = native_mouse_mac_window.xhtml [test_bug413277.html] skip-if = toolkit != "cocoa" -[test_bug428405.xul] +[test_bug428405.xhtml] skip-if = toolkit != "cocoa" -[test_bug466599.xul] +[test_bug466599.xhtml] tags = clipboard skip-if = toolkit != "cocoa" -[test_bug485118.xul] +[test_bug485118.xhtml] skip-if = toolkit != "cocoa" -[test_bug522217.xul] +[test_bug522217.xhtml] tags = fullscreen skip-if = toolkit != "cocoa" -support-files = window_bug522217.xul -[test_platform_colors.xul] +support-files = window_bug522217.xhtml +[test_platform_colors.xhtml] #skip-if = toolkit != "cocoa" skip-if = true # Bug 1207190 -[test_standalone_native_menu.xul] +[test_standalone_native_menu.xhtml] skip-if = toolkit != "cocoa" -support-files = standalone_native_menu_window.xul -[test_bug586713.xul] +support-files = standalone_native_menu_window.xhtml +[test_bug586713.xhtml] skip-if = toolkit != "cocoa" -support-files = bug586713_window.xul -[test_key_event_counts.xul] +support-files = bug586713_window.xhtml +[test_key_event_counts.xhtml] skip-if = toolkit != "cocoa" -[test_bug596600.xul] +[test_bug596600.xhtml] support-files = file_bug596600.html skip-if = toolkit != "cocoa" -[test_bug673301.xul] +[test_bug673301.xhtml] tags = clipboard skip-if = toolkit != "cocoa" [test_secure_input.html] @@ -87,29 +87,29 @@ support-files = file_secure_input.html skip-if = toolkit != "cocoa" [test_native_key_bindings_mac.html] skip-if = toolkit != "cocoa" || verify -[test_system_status_bar.xul] +[test_system_status_bar.xhtml] skip-if = toolkit != "cocoa" -[test_system_font_changes.xul] -support-files = system_font_changes.xul +[test_system_font_changes.xhtml] +support-files = system_font_changes.xhtml run-if = toolkit == 'gtk3' # Currently the test works on only gtk3 # Windows -# taskbar_previews.xul -# window_state_windows.xul -[test_chrome_context_menus_win.xul] +# taskbar_previews.xhtml +# window_state_windows.xhtml +[test_chrome_context_menus_win.xhtml] skip-if = toolkit != "windows" -support-files = chrome_context_menus_win.xul +support-files = chrome_context_menus_win.xhtml [test_plugin_input_event.html] skip-if = toolkit != "windows" -[test_mouse_scroll.xul] +[test_mouse_scroll.xhtml] skip-if = toolkit != "windows" support-files = window_mouse_scroll_win.html # Privacy relevant -[test_bug1123480.xul] +[test_bug1123480.xhtml] tags = clipboard -[test_transferable_overflow.xul] +[test_transferable_overflow.xhtml] skip-if = (verify && (os == 'mac' || os == 'linux')) tags = clipboard diff --git a/widget/tests/chrome_context_menus_win.xul b/widget/tests/chrome_context_menus_win.xhtml similarity index 100% rename from widget/tests/chrome_context_menus_win.xul rename to widget/tests/chrome_context_menus_win.xhtml diff --git a/widget/tests/empty_window.xul b/widget/tests/empty_window.xhtml similarity index 100% rename from widget/tests/empty_window.xul rename to widget/tests/empty_window.xhtml diff --git a/widget/tests/moz.build b/widget/tests/moz.build index 7450501b48..82feaca39c 100644 --- a/widget/tests/moz.build +++ b/widget/tests/moz.build @@ -62,7 +62,7 @@ with Files("*673301*"): with Files("test_assign_event_data.html"): BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") -with Files("test_input_events_on_deactive_window.xul"): +with Files("test_input_events_on_deactive_window.xhtml"): BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") with Files("*chrome_context_menus_win*"): @@ -98,7 +98,7 @@ with Files("*plugin*"): with Files("*position_on_resize*"): BUG_COMPONENT = ("Core", "Widget: Gtk") -with Files("test_sizemode_events.xul"): +with Files("test_sizemode_events.xhtml"): BUG_COMPONENT = ("Core", "Widget: Cocoa") with Files("*system_status_bar*"): diff --git a/widget/tests/native_menus_window.xul b/widget/tests/native_menus_window.xhtml similarity index 100% rename from widget/tests/native_menus_window.xul rename to widget/tests/native_menus_window.xhtml diff --git a/widget/tests/native_mouse_mac_window.xul b/widget/tests/native_mouse_mac_window.xhtml similarity index 100% rename from widget/tests/native_mouse_mac_window.xul rename to widget/tests/native_mouse_mac_window.xhtml diff --git a/widget/tests/standalone_native_menu_window.xul b/widget/tests/standalone_native_menu_window.xhtml similarity index 99% rename from widget/tests/standalone_native_menu_window.xul rename to widget/tests/standalone_native_menu_window.xhtml index ee3cf455cf..3580c74110 100644 --- a/widget/tests/standalone_native_menu_window.xul +++ b/widget/tests/standalone_native_menu_window.xhtml @@ -126,6 +126,7 @@ let menuitem = document.createElementNS(XUL_NS, "menuitem"); menuitem.setAttribute("label", "detached menu item"); + /* eslint-disable-next-line no-shadow */ menuitem.addEventListener("command", function (e) { itemActivated = true; }) diff --git a/widget/tests/system_font_changes.xul b/widget/tests/system_font_changes.xhtml similarity index 100% rename from widget/tests/system_font_changes.xul rename to widget/tests/system_font_changes.xhtml diff --git a/widget/tests/taskbar_previews.xul b/widget/tests/taskbar_previews.xhtml similarity index 100% rename from widget/tests/taskbar_previews.xul rename to widget/tests/taskbar_previews.xhtml diff --git a/widget/tests/test_bug1123480.xul b/widget/tests/test_bug1123480.xhtml similarity index 100% rename from widget/tests/test_bug1123480.xul rename to widget/tests/test_bug1123480.xhtml diff --git a/widget/tests/test_bug343416.xul b/widget/tests/test_bug343416.xhtml similarity index 99% rename from widget/tests/test_bug343416.xul rename to widget/tests/test_bug343416.xhtml index 559e5e86ad..9add0ca695 100644 --- a/widget/tests/test_bug343416.xul +++ b/widget/tests/test_bug343416.xhtml @@ -146,6 +146,7 @@ ok(removedObserver, "The nsIIdleService should allow us to remove the observer j function testIdleTime() { + /* eslint-disable-next-line no-shadow */ var gotIdleTime = false try { diff --git a/widget/tests/test_bug428405.xul b/widget/tests/test_bug428405.xhtml similarity index 100% rename from widget/tests/test_bug428405.xul rename to widget/tests/test_bug428405.xhtml diff --git a/widget/tests/test_bug429954.xul b/widget/tests/test_bug429954.xhtml similarity index 95% rename from widget/tests/test_bug429954.xul rename to widget/tests/test_bug429954.xhtml index 4847c884fc..8abd59fb78 100644 --- a/widget/tests/test_bug429954.xul +++ b/widget/tests/test_bug429954.xhtml @@ -32,7 +32,7 @@ SimpleTest.waitForFocus(function () { var maxWidth = win.outerWidth, maxHeight = win.outerHeight; win.restore(); - window.open("window_bug429954.xul", "_blank", + window.open("window_bug429954.xhtml", "_blank", "chrome,resizable,width=" + maxWidth + ",height=" + maxHeight + "screenX=" + maxX + "screenY=" + maxY); }); diff --git a/widget/tests/test_bug444800.xul b/widget/tests/test_bug444800.xhtml similarity index 100% rename from widget/tests/test_bug444800.xul rename to widget/tests/test_bug444800.xhtml diff --git a/widget/tests/test_bug466599.xul b/widget/tests/test_bug466599.xhtml similarity index 100% rename from widget/tests/test_bug466599.xul rename to widget/tests/test_bug466599.xhtml diff --git a/widget/tests/test_bug478536.xul b/widget/tests/test_bug478536.xhtml similarity index 94% rename from widget/tests/test_bug478536.xul rename to widget/tests/test_bug478536.xhtml index fb57781faf..ce4a6eca47 100644 --- a/widget/tests/test_bug478536.xul +++ b/widget/tests/test_bug478536.xhtml @@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=478536 diff --git a/widget/tests/test_bug485118.xul b/widget/tests/test_bug485118.xhtml similarity index 100% rename from widget/tests/test_bug485118.xul rename to widget/tests/test_bug485118.xhtml diff --git a/widget/tests/test_bug517396.xul b/widget/tests/test_bug517396.xhtml similarity index 100% rename from widget/tests/test_bug517396.xul rename to widget/tests/test_bug517396.xhtml diff --git a/widget/tests/test_bug522217.xul b/widget/tests/test_bug522217.xhtml similarity index 94% rename from widget/tests/test_bug522217.xul rename to widget/tests/test_bug522217.xhtml index 5a63e92459..eb8151e910 100644 --- a/widget/tests/test_bug522217.xul +++ b/widget/tests/test_bug522217.xhtml @@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=522217 SimpleTest.waitForExplicitFinish(); SimpleTest.waitForFocus(function () { - window.open("window_bug522217.xul", "_blank", + window.open("window_bug522217.xhtml", "_blank", "chrome,resizable,width=400,height=300"); }); diff --git a/widget/tests/test_bug538242.xul b/widget/tests/test_bug538242.xhtml similarity index 96% rename from widget/tests/test_bug538242.xul rename to widget/tests/test_bug538242.xhtml index dee804288a..f4aca4ca37 100644 --- a/widget/tests/test_bug538242.xul +++ b/widget/tests/test_bug538242.xhtml @@ -34,7 +34,7 @@ SimpleTest.waitForFocus(function () { return; } - var win = window.open("window_bug538242.xul", "_blank", + var win = window.open("window_bug538242.xhtml", "_blank", "chrome=1,width=400,height=300,left=100,top=100"); SimpleTest.waitForFocus(function () { is(win.screenX, 100, "window should open at 100, 100"); diff --git a/widget/tests/test_bug586713.xul b/widget/tests/test_bug586713.xhtml similarity index 92% rename from widget/tests/test_bug586713.xul rename to widget/tests/test_bug586713.xhtml index b05a4167e9..505411e5a4 100644 --- a/widget/tests/test_bug586713.xul +++ b/widget/tests/test_bug586713.xhtml @@ -20,7 +20,7 @@ diff --git a/widget/tests/test_bug593307.xul b/widget/tests/test_bug593307.xhtml similarity index 98% rename from widget/tests/test_bug593307.xul rename to widget/tests/test_bug593307.xhtml index 63bcd6f829..61b2f52f83 100644 --- a/widget/tests/test_bug593307.xul +++ b/widget/tests/test_bug593307.xhtml @@ -30,7 +30,7 @@ function finish() { var mainWindow = window.docShell.rootTreeItem.domWindow; -var offscreenWindow = mainWindow.openDialog("window_bug593307_offscreen.xul", "", +var offscreenWindow = mainWindow.openDialog("window_bug593307_offscreen.xhtml", "", "dialog=no,chrome,width=200,height=200,screenX=-3000,screenY=-3000", SimpleTest, finish); diff --git a/widget/tests/test_bug596600.xul b/widget/tests/test_bug596600.xhtml similarity index 96% rename from widget/tests/test_bug596600.xul rename to widget/tests/test_bug596600.xhtml index e91bed377d..1e4a42dd4b 100644 --- a/widget/tests/test_bug596600.xul +++ b/widget/tests/test_bug596600.xhtml @@ -32,9 +32,9 @@ function moveMouseTo(x, y, andThen) { } function openWindows() { - gLeftWindow = open('empty_window.xul', '_blank', 'chrome,screenX=50,screenY=50,width=200,height=200'); + gLeftWindow = open('empty_window.xhtml', '_blank', 'chrome,screenX=50,screenY=50,width=200,height=200'); SimpleTest.waitForFocus(function () { - gRightWindow = open('empty_window.xul', '', 'chrome,screenX=300,screenY=50,width=200,height=200'); + gRightWindow = open('empty_window.xhtml', '', 'chrome,screenX=300,screenY=50,width=200,height=200'); SimpleTest.waitForFocus(attachBrowserToLeftWindow, gRightWindow); }, gLeftWindow); } diff --git a/widget/tests/test_bug673301.xul b/widget/tests/test_bug673301.xhtml similarity index 100% rename from widget/tests/test_bug673301.xul rename to widget/tests/test_bug673301.xhtml diff --git a/widget/tests/test_bug760802.xul b/widget/tests/test_bug760802.xhtml similarity index 100% rename from widget/tests/test_bug760802.xul rename to widget/tests/test_bug760802.xhtml diff --git a/widget/tests/test_chrome_context_menus_win.xul b/widget/tests/test_chrome_context_menus_win.xhtml similarity index 88% rename from widget/tests/test_chrome_context_menus_win.xul rename to widget/tests/test_chrome_context_menus_win.xhtml index 8b855484f4..f06a483758 100644 --- a/widget/tests/test_chrome_context_menus_win.xul +++ b/widget/tests/test_chrome_context_menus_win.xhtml @@ -13,7 +13,7 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); SimpleTest.waitForExplicitFinish(); - var w = window.open('chrome_context_menus_win.xul', '_blank', 'chrome,resizable=yes,width=600,height=600'); + var w = window.open('chrome_context_menus_win.xhtml', '_blank', 'chrome,resizable=yes,width=600,height=600'); function done() { diff --git a/widget/tests/test_clipboard.xul b/widget/tests/test_clipboard.xhtml similarity index 100% rename from widget/tests/test_clipboard.xul rename to widget/tests/test_clipboard.xhtml diff --git a/widget/tests/test_composition_text_querycontent.xul b/widget/tests/test_composition_text_querycontent.xhtml similarity index 94% rename from widget/tests/test_composition_text_querycontent.xul rename to widget/tests/test_composition_text_querycontent.xhtml index 406c7822b5..d4cac075da 100644 --- a/widget/tests/test_composition_text_querycontent.xul +++ b/widget/tests/test_composition_text_querycontent.xhtml @@ -25,7 +25,7 @@ // Strangely, this doesn't occur with RDP on Windows. SimpleTest.expectAssertions(0, 3); SimpleTest.waitForExplicitFinish(); -window.open("window_composition_text_querycontent.xul", "_blank", +window.open("window_composition_text_querycontent.xhtml", "_blank", "chrome,width=600,height=600"); ]]> diff --git a/widget/tests/test_imestate.html b/widget/tests/test_imestate.html index e704f9dcd4..4a6c750b90 100644 --- a/widget/tests/test_imestate.html +++ b/widget/tests/test_imestate.html @@ -195,11 +195,9 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) { onIMEFocusBlurHandler = null; var focusedElement = gFM.focusedElement; - if (focusedElement) { - var bindingParent = document.getBindingParent(focusedElement); - if (bindingParent) { - focusedElement = bindingParent; - } + // FIXME(emilio, bug 981248): This is needed just for + while (focusedElement && focusedElement.isNativeAnonymous) { + focusedElement = focusedElement.parentNode; } if (aTest.focusable) { is(focusedElement, element, @@ -1276,7 +1274,7 @@ function runTestPasswordFieldOnDialog() { observe(subject, topic, data) { if (topic === "domwindowopened") { ok(true, "dialog window is created"); - dialog = subject.QueryInterface(Ci.nsIDOMWindow); + dialog = subject; dialog.addEventListener("load", onPasswordDialogLoad); } }, diff --git a/widget/tests/test_input_events_on_deactive_window.xul b/widget/tests/test_input_events_on_deactive_window.xhtml similarity index 100% rename from widget/tests/test_input_events_on_deactive_window.xul rename to widget/tests/test_input_events_on_deactive_window.xhtml diff --git a/widget/tests/test_key_event_counts.xul b/widget/tests/test_key_event_counts.xhtml similarity index 100% rename from widget/tests/test_key_event_counts.xul rename to widget/tests/test_key_event_counts.xhtml diff --git a/widget/tests/test_keycodes.xul b/widget/tests/test_keycodes.xhtml similarity index 99% rename from widget/tests/test_keycodes.xul rename to widget/tests/test_keycodes.xhtml index d65fb18a9b..70cd4b2025 100644 --- a/widget/tests/test_keycodes.xul +++ b/widget/tests/test_keycodes.xhtml @@ -196,6 +196,7 @@ function* runKeyEventTests() function onKeyEvent(e) { + /* eslint-disable-next-line no-shadow */ function removeFlag(e, aFlag) { if (e.type == "keydown") { @@ -210,6 +211,7 @@ function* runKeyEventTests() return false; } + /* eslint-disable-next-line no-shadow */ function isStateChangingModifierKeyEvent(e) { var flags = 0; @@ -4977,6 +4979,7 @@ function* runXULKeyTests() keyElement.setAttribute("command", "expectedCommand"); } + /* eslint-disable-next-line no-shadow */ for (var id in commandElements) { commandElements[id].activeCount = 0; } @@ -5194,6 +5197,7 @@ function* runReservedKeyTests() function finializeKeyElementTest() { + /* eslint-disable-next-line no-shadow */ for (var i = 0; i < contents.length; i++) { contents[i].removeEventListener("keydown", onKeyInDefaultEventGroup, true); contents[i].removeEventListener("keypress", onKeyInDefaultEventGroup, true); @@ -5265,10 +5269,12 @@ function* runTextInputTests() textbox.value = ""; textbox.focus(); + /* eslint-disable-next-line no-shadow */ var currentTestName = eventToString(aEvent); // Check if the text comes with keypress events rather than composition events. var keypress = 0; + /* eslint-disable-next-line no-shadow */ function onKeypress(aEvent) { keypress++; if (keypress == 1 && aExpectText == "") { diff --git a/widget/tests/test_mouse_scroll.xul b/widget/tests/test_mouse_scroll.xhtml similarity index 100% rename from widget/tests/test_mouse_scroll.xul rename to widget/tests/test_mouse_scroll.xhtml diff --git a/widget/tests/test_native_menus.xul b/widget/tests/test_native_menus.xhtml similarity index 92% rename from widget/tests/test_native_menus.xul rename to widget/tests/test_native_menus.xhtml index fe4a550ba4..56fcfe56da 100644 --- a/widget/tests/test_native_menus.xul +++ b/widget/tests/test_native_menus.xhtml @@ -20,7 +20,7 @@ diff --git a/widget/tests/test_native_mouse_mac.xul b/widget/tests/test_native_mouse_mac.xhtml similarity index 91% rename from widget/tests/test_native_mouse_mac.xul rename to widget/tests/test_native_mouse_mac.xhtml index f1975bdec6..861153028c 100644 --- a/widget/tests/test_native_mouse_mac.xul +++ b/widget/tests/test_native_mouse_mac.xhtml @@ -20,7 +20,7 @@ diff --git a/widget/tests/test_panel_mouse_coords.xul b/widget/tests/test_panel_mouse_coords.xhtml similarity index 100% rename from widget/tests/test_panel_mouse_coords.xul rename to widget/tests/test_panel_mouse_coords.xhtml diff --git a/widget/tests/test_platform_colors.xul b/widget/tests/test_platform_colors.xhtml similarity index 100% rename from widget/tests/test_platform_colors.xul rename to widget/tests/test_platform_colors.xhtml diff --git a/widget/tests/test_position_on_resize.xul b/widget/tests/test_position_on_resize.xhtml similarity index 100% rename from widget/tests/test_position_on_resize.xul rename to widget/tests/test_position_on_resize.xhtml diff --git a/widget/tests/test_sizemode_events.xul b/widget/tests/test_sizemode_events.xhtml similarity index 96% rename from widget/tests/test_sizemode_events.xul rename to widget/tests/test_sizemode_events.xhtml index 7d07c12650..8ac4222b10 100644 --- a/widget/tests/test_sizemode_events.xul +++ b/widget/tests/test_sizemode_events.xhtml @@ -56,7 +56,7 @@ function startTest() { } function openWindow() { - gWindow = open('empty_window.xul', '_blank', 'chrome,screenX=50,screenY=50,width=200,height=200,resizable'); + gWindow = open('empty_window.xhtml', '_blank', 'chrome,screenX=50,screenY=50,width=200,height=200,resizable'); SimpleTest.waitForFocus(runTest, gWindow); } diff --git a/widget/tests/test_standalone_native_menu.xul b/widget/tests/test_standalone_native_menu.xhtml similarity index 89% rename from widget/tests/test_standalone_native_menu.xul rename to widget/tests/test_standalone_native_menu.xhtml index 8a684f74f2..1d4f5c2549 100644 --- a/widget/tests/test_standalone_native_menu.xul +++ b/widget/tests/test_standalone_native_menu.xhtml @@ -20,7 +20,7 @@ diff --git a/widget/tests/test_system_font_changes.xul b/widget/tests/test_system_font_changes.xhtml similarity index 90% rename from widget/tests/test_system_font_changes.xul rename to widget/tests/test_system_font_changes.xhtml index 45667ad4b8..00944c6715 100644 --- a/widget/tests/test_system_font_changes.xul +++ b/widget/tests/test_system_font_changes.xhtml @@ -19,7 +19,7 @@ diff --git a/widget/tests/test_system_status_bar.xul b/widget/tests/test_system_status_bar.xhtml similarity index 100% rename from widget/tests/test_system_status_bar.xul rename to widget/tests/test_system_status_bar.xhtml diff --git a/widget/tests/test_taskbar_progress.xul b/widget/tests/test_taskbar_progress.xhtml similarity index 100% rename from widget/tests/test_taskbar_progress.xul rename to widget/tests/test_taskbar_progress.xhtml diff --git a/widget/tests/test_transferable_overflow.xul b/widget/tests/test_transferable_overflow.xhtml similarity index 99% rename from widget/tests/test_transferable_overflow.xul rename to widget/tests/test_transferable_overflow.xhtml index 4e6b0021f2..081e0e2dea 100644 --- a/widget/tests/test_transferable_overflow.xul +++ b/widget/tests/test_transferable_overflow.xhtml @@ -47,7 +47,7 @@ // that the deletion might not be immediate. // // To avoid intermittents, we only check the file descriptor counts on non-Windows. - // test_bug1123480.xul will do some basic testing for Windows. + // test_bug1123480.xhtml will do some basic testing for Windows. const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); return AppConstants.platform !== 'win'; } diff --git a/widget/tests/test_wheeltransaction.xul b/widget/tests/test_wheeltransaction.xhtml similarity index 92% rename from widget/tests/test_wheeltransaction.xul rename to widget/tests/test_wheeltransaction.xhtml index 6836397dbd..c199f65f78 100644 --- a/widget/tests/test_wheeltransaction.xul +++ b/widget/tests/test_wheeltransaction.xhtml @@ -19,7 +19,7 @@ diff --git a/widget/tests/window_bug429954.xul b/widget/tests/window_bug429954.xhtml similarity index 100% rename from widget/tests/window_bug429954.xul rename to widget/tests/window_bug429954.xhtml diff --git a/widget/tests/window_bug478536.xul b/widget/tests/window_bug478536.xhtml similarity index 100% rename from widget/tests/window_bug478536.xul rename to widget/tests/window_bug478536.xhtml diff --git a/widget/tests/window_bug522217.xul b/widget/tests/window_bug522217.xhtml similarity index 100% rename from widget/tests/window_bug522217.xul rename to widget/tests/window_bug522217.xhtml diff --git a/widget/tests/window_bug538242.xul b/widget/tests/window_bug538242.xhtml similarity index 100% rename from widget/tests/window_bug538242.xul rename to widget/tests/window_bug538242.xhtml diff --git a/widget/tests/window_bug593307_centerscreen.xul b/widget/tests/window_bug593307_centerscreen.xhtml similarity index 100% rename from widget/tests/window_bug593307_centerscreen.xul rename to widget/tests/window_bug593307_centerscreen.xhtml diff --git a/widget/tests/window_bug593307_offscreen.xul b/widget/tests/window_bug593307_offscreen.xhtml similarity index 92% rename from widget/tests/window_bug593307_offscreen.xul rename to widget/tests/window_bug593307_offscreen.xhtml index 0f7b5866ed..422c406812 100644 --- a/widget/tests/window_bug593307_offscreen.xul +++ b/widget/tests/window_bug593307_offscreen.xhtml @@ -19,7 +19,7 @@ var finish = window.arguments[1]; function onLoad() { - centerscreen = window.openDialog('window_bug593307_centerscreen.xul','', 'chrome,centerscreen,dependent,dialog=no'); + centerscreen = window.openDialog('window_bug593307_centerscreen.xhtml','', 'chrome,centerscreen,dependent,dialog=no'); } function finished() { diff --git a/widget/tests/window_composition_text_querycontent.xul b/widget/tests/window_composition_text_querycontent.xhtml similarity index 100% rename from widget/tests/window_composition_text_querycontent.xul rename to widget/tests/window_composition_text_querycontent.xhtml diff --git a/widget/tests/window_state_windows.xul b/widget/tests/window_state_windows.xhtml similarity index 100% rename from widget/tests/window_state_windows.xul rename to widget/tests/window_state_windows.xhtml diff --git a/widget/tests/window_wheeltransaction.xul b/widget/tests/window_wheeltransaction.xhtml similarity index 100% rename from widget/tests/window_wheeltransaction.xul rename to widget/tests/window_wheeltransaction.xhtml diff --git a/widget/windows/WidgetTraceEvent.cpp b/widget/windows/WidgetTraceEvent.cpp index 3d9e47c687..4509791d59 100644 --- a/widget/windows/WidgetTraceEvent.cpp +++ b/widget/windows/WidgetTraceEvent.cpp @@ -20,7 +20,7 @@ #include "nsIDocShell.h" #include "nsISupportsImpl.h" #include "nsIWidget.h" -#include "nsIXULWindow.h" +#include "nsIAppWindow.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "nsWindowDefs.h" @@ -42,7 +42,7 @@ class HWNDGetter : public mozilla::Runnable { // Jump through some hoops to locate the hidden window. nsCOMPtr appShell( do_GetService(NS_APPSHELLSERVICE_CONTRACTID)); - nsCOMPtr hiddenWindow; + nsCOMPtr hiddenWindow; nsresult rv = appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow)); if (NS_FAILED(rv)) { diff --git a/widget/windows/nsPrintDialogWin.cpp b/widget/windows/nsPrintDialogWin.cpp index add2fa58b0..efabd2dbbd 100644 --- a/widget/windows/nsPrintDialogWin.cpp +++ b/widget/windows/nsPrintDialogWin.cpp @@ -22,7 +22,7 @@ #include "nsQueryObject.h" static const char* kPageSetupDialogURL = - "chrome://global/content/printPageSetup.xul"; + "chrome://global/content/printPageSetup.xhtml"; using namespace mozilla; using namespace mozilla::widget; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 6edf429803..0c9c70523d 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -653,6 +653,7 @@ nsWindow::nsWindow(bool aIsChildWindow) mIdleService = nullptr; mSizeConstraintsScale = GetDefaultScale().scale; + mMaxTextureSize = -1; // Will be calculated when layer manager is created. sInstanceCount++; } @@ -1684,6 +1685,25 @@ void nsWindow::LockAspectRatio(bool aShouldLock) { } } +/************************************************************** + * + * SECTION: nsIWidget::SetWindowMouseTransparent + * + * Sets whether the window should ignore mouse events. + * + **************************************************************/ +void nsWindow::SetWindowMouseTransparent(bool aIsTransparent) { + if (!mWnd) { + return; + } + + LONG_PTR oldStyle = ::GetWindowLongPtrW(mWnd, GWL_EXSTYLE); + LONG_PTR newStyle = aIsTransparent ? (oldStyle | WS_EX_TRANSPARENT) + : (oldStyle & ~WS_EX_TRANSPARENT); + ::SetWindowLongPtrW(mWnd, GWL_EXSTYLE, newStyle); + mMouseTransparent = aIsTransparent; +} + /************************************************************** * * SECTION: nsIWidget::Move, nsIWidget::Resize, @@ -1701,14 +1721,13 @@ void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints) { c.mMinSize.height = std::max(int32_t(::GetSystemMetrics(SM_CYMINTRACK)), c.mMinSize.height); } - KnowsCompositor* knowsCompositor = GetLayerManager()->AsKnowsCompositor(); - if (knowsCompositor) { - int32_t maxSize = knowsCompositor->GetMaxTextureSize(); + + if (mMaxTextureSize > 0) { // We can't make ThebesLayers bigger than this anyway.. no point it letting // a window grow bigger as we won't be able to draw content there in // general. - c.mMaxSize.width = std::min(c.mMaxSize.width, maxSize); - c.mMaxSize.height = std::min(c.mMaxSize.height, maxSize); + c.mMaxSize.width = std::min(c.mMaxSize.width, mMaxTextureSize); + c.mMaxSize.height = std::min(c.mMaxSize.height, mMaxTextureSize); } mSizeConstraintsScale = GetDefaultScale().scale; @@ -3729,6 +3748,10 @@ bool nsWindow::HasPendingInputEvent() { LayerManager* nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager, LayersBackend aBackendHint, LayerManagerPersistence aPersistence) { + if (mLayerManager) { + return mLayerManager; + } + RECT windowRect; ::GetClientRect(mWnd, &windowRect); @@ -3769,6 +3792,19 @@ LayerManager* nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager, NS_ASSERTION(mLayerManager, "Couldn't provide a valid layer manager."); + if (mLayerManager) { + // Update the size constraints now that the layer manager has been + // created. + KnowsCompositor* knowsCompositor = mLayerManager->AsKnowsCompositor(); + if (knowsCompositor) { + SizeConstraints c = mSizeConstraints; + mMaxTextureSize = knowsCompositor->GetMaxTextureSize(); + c.mMaxSize.width = std::min(c.mMaxSize.width, mMaxTextureSize); + c.mMaxSize.height = std::min(c.mMaxSize.height, mMaxTextureSize); + nsBaseWidget::SetSizeConstraints(c); + } + } + return mLayerManager; } diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index 9b73c68464..e01f45edad 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -130,6 +130,7 @@ class nsWindow final : public nsWindowBase { virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override; virtual void LockAspectRatio(bool aShouldLock) override; virtual const SizeConstraints GetSizeConstraints() override; + virtual void SetWindowMouseTransparent(bool aIsTransparent) override; virtual void Move(double aX, double aY) override; virtual void Resize(double aWidth, double aHeight, bool aRepaint) override; virtual void Resize(double aX, double aY, double aWidth, double aHeight, @@ -688,6 +689,7 @@ class nsWindow final : public nsWindowBase { static void InitMouseWheelScrollData(); double mSizeConstraintsScale; // scale in effect when setting constraints + int32_t mMaxTextureSize; // Pointer events processing and management WinPointerEvents mPointerEvents;