Bug 762948: Workaround for invalidation problem with flash. r=roc

This commit is contained in:
Bas Schouten 2012-07-23 15:57:38 +02:00
parent 6761975fd3
commit 96941914c7

View File

@ -6807,6 +6807,54 @@ nsWindow::SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray, PRUint32 aModifie
}
}
static BOOL WINAPI EnumFirstChild(HWND hwnd, LPARAM lParam)
{
*((HWND*)lParam) = hwnd;
return FALSE;
}
static void InvalidatePluginAsWorkaround(nsWindow *aWindow, const nsIntRect &aRect)
{
aWindow->Invalidate(aRect);
// XXX - Even more evil workaround!! See bug 762948, flash's bottom
// level sandboxed window doesn't seem to get our invalidate. We send
// an invalidate to it manually. This is totally specialized for this
// bug, for other child window structures this will just be a more or
// less bogus invalidate but since that should not have any bad
// side-effects this will have to do for now.
HWND current = (HWND)aWindow->GetNativeData(NS_NATIVE_WINDOW);
RECT windowRect;
RECT parentRect;
::GetWindowRect(current, &parentRect);
HWND next = current;
do {
current = next;
::EnumChildWindows(current, &EnumFirstChild, (LPARAM)&next);
::GetWindowRect(next, &windowRect);
// This is relative to the screen, adjust it to be relative to the
// window we're reconfiguring.
windowRect.left -= parentRect.left;
windowRect.top -= parentRect.top;
} while (next != current && windowRect.top == 0 && windowRect.left == 0);
if (windowRect.top == 0 && windowRect.left == 0) {
RECT rect;
rect.left = aRect.x;
rect.top = aRect.y;
rect.right = aRect.XMost();
rect.bottom = aRect.YMost();
::InvalidateRect(next, &rect, FALSE);
}
}
nsresult
nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
{
@ -6840,7 +6888,9 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
r.Sub(bounds, configuration.mBounds);
r.MoveBy(-bounds.x,
-bounds.y);
w->Invalidate(r.GetBounds());
nsIntRect toInvalidate = r.GetBounds();
InvalidatePluginAsWorkaround(w, toInvalidate);
}
}
rv = w->SetWindowClipRegion(configuration.mClipRegion, false);