зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156952 - Switch Fennec over to the "attached" widget model, so we get one nsWindow instead of two. r=snorp
This commit is contained in:
Родитель
71f8010739
Коммит
9d19536ed8
|
@ -4151,7 +4151,7 @@ nsDocumentViewer::ShouldAttachToTopLevel()
|
||||||
if (nsIWidget::UsePuppetWidgets())
|
if (nsIWidget::UsePuppetWidgets())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_ANDROID)
|
||||||
// On windows, in the parent process we also attach, but just to
|
// On windows, in the parent process we also attach, but just to
|
||||||
// chrome items
|
// chrome items
|
||||||
nsWindowType winType = mParentWidget->WindowType();
|
nsWindowType winType = mParentWidget->WindowType();
|
||||||
|
|
|
@ -178,7 +178,6 @@ nsWindow::DumpWindows(const nsTArray<nsWindow*>& wins, int indent)
|
||||||
nsWindow::nsWindow() :
|
nsWindow::nsWindow() :
|
||||||
mIsVisible(false),
|
mIsVisible(false),
|
||||||
mParent(nullptr),
|
mParent(nullptr),
|
||||||
mFocus(nullptr),
|
|
||||||
mIMEMaskSelectionUpdate(false),
|
mIMEMaskSelectionUpdate(false),
|
||||||
mIMEMaskEventsCount(1), // Mask IME events since there's no focus yet
|
mIMEMaskEventsCount(1), // Mask IME events since there's no focus yet
|
||||||
mIMERanges(new TextRangeArray()),
|
mIMERanges(new TextRangeArray()),
|
||||||
|
@ -190,9 +189,6 @@ nsWindow::nsWindow() :
|
||||||
nsWindow::~nsWindow()
|
nsWindow::~nsWindow()
|
||||||
{
|
{
|
||||||
gTopLevelWindows.RemoveElement(this);
|
gTopLevelWindows.RemoveElement(this);
|
||||||
nsWindow *top = FindTopLevel();
|
|
||||||
if (top->mFocus == this)
|
|
||||||
top->mFocus = nullptr;
|
|
||||||
ALOG("nsWindow %p destructor", (void*)this);
|
ALOG("nsWindow %p destructor", (void*)this);
|
||||||
if (mLayerManager == sLayerManager) {
|
if (mLayerManager == sLayerManager) {
|
||||||
// If this window was the one that created the global OMTC layer manager
|
// If this window was the one that created the global OMTC layer manager
|
||||||
|
@ -298,10 +294,9 @@ nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& config)
|
||||||
void
|
void
|
||||||
nsWindow::RedrawAll()
|
nsWindow::RedrawAll()
|
||||||
{
|
{
|
||||||
if (mFocus) {
|
if (mAttachedWidgetListener) {
|
||||||
mFocus->RedrawAll();
|
mAttachedWidgetListener->RequestRepaint();
|
||||||
}
|
} else if (mWidgetListener) {
|
||||||
if (mWidgetListener) {
|
|
||||||
mWidgetListener->RequestRepaint();
|
mWidgetListener->RequestRepaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,12 +562,7 @@ nsWindow::FindTopLevel()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWindow::SetFocus(bool aRaise)
|
nsWindow::SetFocus(bool aRaise)
|
||||||
{
|
{
|
||||||
if (!aRaise) {
|
|
||||||
ALOG("nsWindow::SetFocus: can't set focus without raising, ignoring aRaise = false!");
|
|
||||||
}
|
|
||||||
|
|
||||||
nsWindow *top = FindTopLevel();
|
nsWindow *top = FindTopLevel();
|
||||||
top->mFocus = this;
|
|
||||||
top->BringToFront();
|
top->BringToFront();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -671,21 +661,9 @@ nsWindow::DispatchEvent(WidgetGUIEvent* aEvent,
|
||||||
nsEventStatus
|
nsEventStatus
|
||||||
nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
|
nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
|
||||||
{
|
{
|
||||||
if (this == TopWindow() && mFocus) {
|
if (mAttachedWidgetListener) {
|
||||||
// On Fennec the window structure has two windows, a root-level window
|
return mAttachedWidgetListener->HandleEvent(aEvent, mUseAttachedEvents);
|
||||||
// and a child window. The root-level window has a nsWebShellWindow as
|
} else if (mWidgetListener) {
|
||||||
// a widget listener, and that does nothing in its HandleEvent call. The
|
|
||||||
// child window however is hooked up to a nsView, and is the window
|
|
||||||
// we actually want to send events to. The child window also always has
|
|
||||||
// focus and completely covers the root window, so technically the child
|
|
||||||
// window is "topmost" and should be receiving all events. So when
|
|
||||||
// dispatching an event to the root window, redispatch it to the child
|
|
||||||
// window instead.
|
|
||||||
return mFocus->DispatchEvent(aEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
aEvent->widget = this;
|
|
||||||
if (mWidgetListener) {
|
|
||||||
return mWidgetListener->HandleEvent(aEvent, mUseAttachedEvents);
|
return mWidgetListener->HandleEvent(aEvent, mUseAttachedEvents);
|
||||||
}
|
}
|
||||||
return nsEventStatus_eIgnore;
|
return nsEventStatus_eIgnore;
|
||||||
|
@ -1678,17 +1656,8 @@ public:
|
||||||
nsRefPtr<mozilla::TextComposition>
|
nsRefPtr<mozilla::TextComposition>
|
||||||
nsWindow::GetIMEComposition()
|
nsWindow::GetIMEComposition()
|
||||||
{
|
{
|
||||||
// See comment in DispatchEvent. This function gets called on the root
|
|
||||||
// window, but the IMEStateManager uses the IME event's widget pointer
|
|
||||||
// (which is the child window) to maintain state. Therefore when requesting
|
|
||||||
// the text composition from the IMEStateManager we need to use the child
|
|
||||||
// window.
|
|
||||||
MOZ_ASSERT(this == TopWindow());
|
MOZ_ASSERT(this == TopWindow());
|
||||||
nsWindow* win = this;
|
return mozilla::IMEStateManager::GetTextCompositionFor(this);
|
||||||
if (mFocus) {
|
|
||||||
win = mFocus;
|
|
||||||
}
|
|
||||||
return mozilla::IMEStateManager::GetTextCompositionFor(win);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2038,13 +2007,7 @@ nsWindow::UserActivity()
|
||||||
nsresult
|
nsresult
|
||||||
nsWindow::NotifyIMEInternal(const IMENotification& aIMENotification)
|
nsWindow::NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||||
{
|
{
|
||||||
// See comment in DispatchEvent. This function may get called on the child
|
MOZ_ASSERT(this == TopWindow());
|
||||||
// window, but all of our IME state is in the root window. So when this
|
|
||||||
// function is called, pass it on to the root window.
|
|
||||||
nsWindow* top = TopWindow();
|
|
||||||
if (top && top != this) {
|
|
||||||
return top->NotifyIMEInternal(aIMENotification);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (aIMENotification.mMessage) {
|
switch (aIMENotification.mMessage) {
|
||||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||||
|
|
|
@ -214,7 +214,6 @@ protected:
|
||||||
bool mIsVisible;
|
bool mIsVisible;
|
||||||
nsTArray<nsWindow*> mChildren;
|
nsTArray<nsWindow*> mChildren;
|
||||||
nsWindow* mParent;
|
nsWindow* mParent;
|
||||||
nsWindow* mFocus;
|
|
||||||
|
|
||||||
double mStartDist;
|
double mStartDist;
|
||||||
double mLastDist;
|
double mLastDist;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче