Bug 630346 - Use basic layers for windows with transparency r=karlt

--HG--
extra : rebase_source : c078915a7455b61e0aff76af3cea735c4342a219
This commit is contained in:
Marco Castelluccio 2012-09-24 11:22:28 +12:00
parent 7c9a86ce59
commit 6002e5ebc8
2 changed files with 44 additions and 0 deletions

View File

@ -3978,6 +3978,24 @@ nsWindow::EnsureGrabs(void)
GrabPointer(sRetryGrabTime);
}
void
nsWindow::CleanLayerManagerRecursive(void) {
if (mLayerManager) {
mLayerManager->Destroy();
mLayerManager = nullptr;
}
DestroyCompositor();
GList* children = gdk_window_peek_children(mGdkWindow);
for (GList* list = children; list; list = list->next) {
nsWindow* window = get_window_for_gdk_window(GDK_WINDOW(list->data));
if (window) {
window->CleanLayerManagerRecursive();
}
}
}
void
nsWindow::SetTransparencyMode(nsTransparencyMode aMode)
{
@ -4016,6 +4034,10 @@ nsWindow::SetTransparencyMode(nsTransparencyMode aMode)
// need to change anything yet
mIsTransparent = isTransparent;
// Need to clean our LayerManager up while still alive because
// we don't want to use layers acceleration on shaped windows
CleanLayerManagerRecursive();
}
nsTransparencyMode
@ -6138,6 +6160,20 @@ nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, int32_t aHorizontal, int32_t aVert
return NS_OK;
}
nsIWidget::LayerManager*
nsWindow::GetLayerManager(PLayersChild* aShadowManager,
LayersBackend aBackendHint,
LayerManagerPersistence aPersistence,
bool* aAllowRetaining)
{
if (!mLayerManager && eTransparencyTransparent == GetTransparencyMode()) {
mLayerManager = CreateBasicLayerManager();
}
return nsBaseWidget::GetLayerManager(aShadowManager, aBackendHint,
aPersistence, aAllowRetaining);
}
void
nsWindow::ClearCachedResources()
{

View File

@ -442,6 +442,14 @@ private:
void DispatchMissedButtonReleases(GdkEventCrossing *aGdkEvent);
// nsBaseWidget
virtual LayerManager* GetLayerManager(PLayersChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nullptr) MOZ_OVERRIDE;
void CleanLayerManagerRecursive();
/**
* |mIMModule| takes all IME related stuff.
*