Bug 1075670 - Update window position in TabParent when window widget is moved. r=smaug
TabParents now register for the MozUpdateWindowPos event on the chrome TopWindowRoot. When the window is moved, the OS widget calls WindowMoved on its listener (the nsWebShellWindow), which sends a MozUpdateWindowPos event.
This commit is contained in:
@@ -71,6 +71,8 @@
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
|
||||
#include "nsPIWindowRoot.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "nsINativeMenuService.h"
|
||||
#define USE_NATIVE_MENUS
|
||||
@@ -258,6 +260,15 @@ nsWebShellWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y)
|
||||
pm->AdjustPopupsOnWindowChange(window);
|
||||
}
|
||||
|
||||
// Notify all tabs that the widget moved.
|
||||
if (mDocShell && mDocShell->GetWindow()) {
|
||||
nsCOMPtr<EventTarget> eventTarget = mDocShell->GetWindow()->GetTopWindowRoot();
|
||||
nsContentUtils::DispatchChromeEvent(mDocShell->GetDocument(),
|
||||
eventTarget,
|
||||
NS_LITERAL_STRING("MozUpdateWindowPos"),
|
||||
false, false, nullptr);
|
||||
}
|
||||
|
||||
// Persist position, but not immediately, in case this OS is firing
|
||||
// repeated move events as the user drags the window
|
||||
SetPersistenceTimer(PAD_POSITION);
|
||||
|
||||
Reference in New Issue
Block a user