Bug 564991. Part 10: When NS_DOCUMENT_STATE_WINDOW_INACTIVE changes, flush the contents of all ThebesLayers. We need to do this because this change can change the rendering of themed content, and explicitly tracking and invalidating all such content would be way too expensive to justify. r=mats

This commit is contained in:
Robert O'Callahan 2010-07-16 09:07:51 +12:00
parent cc872e7c9e
commit 2c8b5b5a93

View File

@ -228,6 +228,7 @@ static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
/* for NS_MEMORY_REPORTER_IMPLEMENT */
#include "nsIMemoryReporter.h"
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::dom;
@ -4908,6 +4909,24 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
eRestyle_Subtree, NS_STYLE_HINT_NONE);
VERIFY_STYLE_TREE;
}
if (aStateMask & NS_DOCUMENT_STATE_WINDOW_INACTIVE) {
nsIFrame* root = FrameManager()->GetRootFrame();
if (root) {
// It's a display root. So, invalidate the layer contents of
// everything we can find. We need to do this because the contents
// of controls etc can depend on whether the window is active,
// and when a window becomes (in)active it just gets repainted
// and we don't specifically invalidate each affected control.
nsIWidget* widget = root->GetNearestWidget();
if (widget) {
LayerManager* layerManager = widget->GetLayerManager();
if (layerManager) {
FrameLayerBuilder::InvalidateAllThebesLayerContents(layerManager);
}
}
}
}
}
void