Bug 596414. Don't subtract plugin areas from within UpdateWidgetArea, except on mac. r=tn a=b

This commit is contained in:
Robert O'Callahan 2010-09-17 11:05:51 -07:00
Родитель 1e7bae6c19
Коммит a0baca455b
1 изменённых файлов: 19 добавлений и 37 удалений

Просмотреть файл

@ -514,20 +514,6 @@ NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, PRUint32 aUpdateFlags)
return UpdateView(view, dims, aUpdateFlags);
}
static PRBool
IsWidgetDrawnByPlugin(nsIWidget* aWidget, nsIView* aView)
{
if (aView->GetWidget() == aWidget)
return PR_FALSE;
nsCOMPtr<nsIPluginWidget> pw = do_QueryInterface(aWidget);
if (pw) {
// It's a plugin widget, but one that we are responsible for painting
// (i.e., a Mac widget)
return PR_FALSE;
}
return PR_TRUE;
}
/**
* @param aWidget the widget for aWidgetView; in some cases the widget
* is being managed directly by the frame system, so aWidgetView->GetWidget()
@ -611,33 +597,29 @@ nsViewManager::UpdateWidgetArea(nsView *aWidgetView, nsIWidget* aWidget,
childWidget->IsVisible(visible);
nsWindowType type;
childWidget->GetWindowType(type);
if (view && visible && !IsWidgetDrawnByPlugin(childWidget, view) &&
type != eWindowType_popup) {
// Don't mess with views that are in completely different view
// manager trees
if (view && visible && type != eWindowType_popup) {
NS_ASSERTION(type == eWindowType_plugin,
"Only plugin or popup widgets can be children!");
nsViewManager* viewManager = view->GetViewManager();
if (viewManager->RootViewManager() == RootViewManager()) {
// get the damage region into view's coordinate system and appunits
nsRegion damage =
ConvertRegionBetweenViews(intersection, aWidgetView, view);
// Update the child and it's children
viewManager->
UpdateWidgetArea(view, childWidget, damage, aIgnoreWidgetView);
// We do not need to invalidate in plugin widgets, but we should
// exclude them from the invalidation region IF we're not on
// Mac. On Mac we need to draw under plugin widgets, because
// plugin widgets are basically invisible
#ifndef XP_MACOSX
// GetBounds should compensate for chrome on a toplevel widget
nsIntRect bounds;
childWidget->GetBounds(bounds);
// GetBounds should compensate for chrome on a toplevel widget
nsIntRect bounds;
childWidget->GetBounds(bounds);
nsTArray<nsIntRect> clipRects;
childWidget->GetWindowClipRegion(&clipRects);
for (PRUint32 i = 0; i < clipRects.Length(); ++i) {
nsRect rr = (clipRects[i] + bounds.TopLeft()).
ToAppUnits(AppUnitsPerDevPixel());
children.Or(children, rr - aWidgetView->ViewToWidgetOffset());
children.SimplifyInward(20);
}
nsTArray<nsIntRect> clipRects;
childWidget->GetWindowClipRegion(&clipRects);
for (PRUint32 i = 0; i < clipRects.Length(); ++i) {
nsRect rr = (clipRects[i] + bounds.TopLeft()).
ToAppUnits(AppUnitsPerDevPixel());
children.Or(children, rr - aWidgetView->ViewToWidgetOffset());
children.SimplifyInward(20);
}
#endif
}
}
}