mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 937713 - Replace gWindowToRedraw with a simpler mechanism, r=roc
This commit is contained in:
parent
9ea14294a1
commit
065b5fff51
@ -4,7 +4,7 @@ load 226744-1.xhtml
|
||||
load 232095-1.xul
|
||||
load 277523-1.xhtml
|
||||
load 277950-1.xhtml
|
||||
skip-if(Android||browserIsRemote) load 336744-1.html # no remote support for xul popups, bug 617653
|
||||
skip-if(Android||B2G||browserIsRemote) load 336744-1.html # no remote support for xul popups, bug 617653
|
||||
asserts(0-1) load 336960-1.html # maybe bug 429586
|
||||
load 342954-1.xhtml
|
||||
load 342954-2.xhtml
|
||||
|
@ -69,7 +69,6 @@ static nsIntRect sVirtualBounds;
|
||||
|
||||
static nsRefPtr<GLContext> sGLContext;
|
||||
static nsTArray<nsWindow *> sTopWindows;
|
||||
static nsWindow *gWindowToRedraw = nullptr;
|
||||
static nsWindow *gFocusedWindow = nullptr;
|
||||
static bool sFramebufferOpen;
|
||||
static bool sUsingOMTC;
|
||||
@ -186,20 +185,24 @@ nsWindow::DoDraw(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gWindowToRedraw) {
|
||||
if (sTopWindows.IsEmpty()) {
|
||||
LOG(" no window to draw, bailing");
|
||||
return;
|
||||
}
|
||||
|
||||
nsIntRegion region = gWindowToRedraw->mDirtyRegion;
|
||||
gWindowToRedraw->mDirtyRegion.SetEmpty();
|
||||
nsWindow *targetWindow = (nsWindow *)sTopWindows[0];
|
||||
while (targetWindow->GetLastChild())
|
||||
targetWindow = (nsWindow *)targetWindow->GetLastChild();
|
||||
|
||||
nsIWidgetListener* listener = gWindowToRedraw->GetWidgetListener();
|
||||
nsIntRegion region = sTopWindows[0]->mDirtyRegion;
|
||||
sTopWindows[0]->mDirtyRegion.SetEmpty();
|
||||
|
||||
nsIWidgetListener* listener = targetWindow->GetWidgetListener();
|
||||
if (listener) {
|
||||
listener->WillPaintWindow(gWindowToRedraw);
|
||||
listener->WillPaintWindow(targetWindow);
|
||||
}
|
||||
|
||||
LayerManager* lm = gWindowToRedraw->GetLayerManager();
|
||||
LayerManager* lm = targetWindow->GetLayerManager();
|
||||
if (mozilla::layers::LayersBackend::LAYERS_CLIENT == lm->GetBackendType()) {
|
||||
// No need to do anything, the compositor will handle drawing
|
||||
} else if (mozilla::layers::LayersBackend::LAYERS_BASIC == lm->GetBackendType()) {
|
||||
@ -218,12 +221,12 @@ nsWindow::DoDraw(void)
|
||||
|
||||
// No double-buffering needed.
|
||||
AutoLayerManagerSetup setupLayerManager(
|
||||
gWindowToRedraw, ctx, mozilla::layers::BufferMode::BUFFER_NONE,
|
||||
targetWindow, ctx, mozilla::layers::BufferMode::BUFFER_NONE,
|
||||
ScreenRotation(EffectiveScreenRotation()));
|
||||
|
||||
listener = gWindowToRedraw->GetWidgetListener();
|
||||
listener = targetWindow->GetWidgetListener();
|
||||
if (listener) {
|
||||
listener->PaintWindow(gWindowToRedraw, region);
|
||||
listener->PaintWindow(targetWindow, region);
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +238,7 @@ nsWindow::DoDraw(void)
|
||||
NS_RUNTIMEABORT("Unexpected layer manager type");
|
||||
}
|
||||
|
||||
listener = gWindowToRedraw->GetWidgetListener();
|
||||
listener = targetWindow->GetWidgetListener();
|
||||
if (listener) {
|
||||
listener->DidPaintWindow();
|
||||
}
|
||||
@ -282,11 +285,10 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
|
||||
mBounds = aRect;
|
||||
|
||||
nsWindow *parent = (nsWindow *)aNativeParent;
|
||||
mParent = parent;
|
||||
mParent = (nsWindow *)aParent;
|
||||
mVisible = false;
|
||||
|
||||
if (!aNativeParent) {
|
||||
if (!aParent) {
|
||||
mBounds = sVirtualBounds;
|
||||
}
|
||||
|
||||
@ -304,8 +306,6 @@ nsWindow::Destroy(void)
|
||||
{
|
||||
mOnDestroyCalled = true;
|
||||
sTopWindows.RemoveElement(this);
|
||||
if (this == gWindowToRedraw)
|
||||
gWindowToRedraw = nullptr;
|
||||
if (this == gFocusedWindow)
|
||||
gFocusedWindow = nullptr;
|
||||
nsBaseWidget::OnDestroy();
|
||||
@ -382,8 +382,8 @@ nsWindow::Resize(double aX,
|
||||
if (mWidgetListener)
|
||||
mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
|
||||
|
||||
if (aRepaint && gWindowToRedraw)
|
||||
gWindowToRedraw->Invalidate(sVirtualBounds);
|
||||
if (aRepaint)
|
||||
Invalidate(sVirtualBounds);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -419,14 +419,13 @@ nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>&)
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Invalidate(const nsIntRect &aRect)
|
||||
{
|
||||
nsWindow *parent = mParent;
|
||||
while (parent && parent != sTopWindows[0])
|
||||
parent = parent->mParent;
|
||||
if (parent != sTopWindows[0])
|
||||
nsWindow *top = mParent;
|
||||
while (top && top->mParent)
|
||||
top = top->mParent;
|
||||
if (top != sTopWindows[0] && this != sTopWindows[0])
|
||||
return NS_OK;
|
||||
|
||||
mDirtyRegion.Or(mDirtyRegion, aRect);
|
||||
gWindowToRedraw = this;
|
||||
gDrawRequest = true;
|
||||
mozilla::NotifyEvent();
|
||||
return NS_OK;
|
||||
@ -454,8 +453,6 @@ nsWindow::GetNativeData(uint32_t aDataType)
|
||||
switch (aDataType) {
|
||||
case NS_NATIVE_WINDOW:
|
||||
return GetGonkDisplay()->GetNativeWindow();
|
||||
case NS_NATIVE_WIDGET:
|
||||
return this;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -768,12 +765,12 @@ nsScreenGonk::SetRotation(uint32_t aRotation)
|
||||
sVirtualBounds = gScreenBounds;
|
||||
}
|
||||
|
||||
nsAppShell::NotifyScreenRotation();
|
||||
|
||||
for (unsigned int i = 0; i < sTopWindows.Length(); i++)
|
||||
sTopWindows[i]->Resize(sVirtualBounds.width,
|
||||
sVirtualBounds.height,
|
||||
!i);
|
||||
|
||||
nsAppShell::NotifyScreenRotation();
|
||||
true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user