Bug 1261554 (Part 2) - Mark frames which are added to the display list when painting to the window as having Visibility::IN_DISPLAYPORT. r=mstange

This commit is contained in:
Seth Fowler 2016-04-21 01:22:10 -07:00
Родитель 0847460298
Коммит 82aae6c3ed
2 изменённых файлов: 33 добавлений и 0 удалений

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

@ -4745,6 +4745,9 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
nsLayoutUtils::PaintFrame(&rc, rootFrame, nsRegion(aRect),
aBackgroundColor, flags);
// We don't call NotifyCompositorOfVisibleRegionsChange here because we're
// not painting to the window, and hence there should be no change.
return NS_OK;
}
@ -6432,8 +6435,30 @@ PresShell::Paint(nsView* aViewToPaint,
}
if (frame) {
// Remove the entries of the mInDisplayPortFrames hashtable and put them
// in oldInDisplayPortFrames.
VisibleFrames oldInDisplayPortFrames;
mInDisplayPortFrames.SwapElements(oldInDisplayPortFrames);
InitVisibleRegionsIfVisualizationEnabled(VisibilityCounter::IN_DISPLAYPORT);
// We can paint directly into the widget using its layer manager.
nsLayoutUtils::PaintFrame(nullptr, frame, aDirtyRegion, bgcolor, flags);
DecVisibleCount(oldInDisplayPortFrames, VisibilityCounter::IN_DISPLAYPORT);
if (mVisibleRegions &&
!mNotifyCompositorOfVisibleRegionsChangeEvent.IsPending()) {
// Asynchronously notify the compositor of the new visible regions,
// since this is happening during a paint and updating the visible
// regions triggers a recomposite.
RefPtr<nsRunnableMethod<PresShell>> event =
NS_NewRunnableMethod(this, &PresShell::NotifyCompositorOfVisibleRegionsChange);
if (NS_SUCCEEDED(NS_DispatchToMainThread(event))) {
mNotifyCompositorOfVisibleRegionsChangeEvent = event;
}
}
return;
}

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

@ -2704,6 +2704,14 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
!PresContext()->GetTheme()->WidgetIsContainer(ourDisp->mAppearance))
return;
// Since we're now sure that we're adding this frame to the display list
// (which means we're painting it, modulo occlusion), mark it as visible
// within the displayport.
if (aBuilder->IsPaintingToWindow() && child->TrackingVisibility()) {
nsIPresShell* shell = child->PresContext()->PresShell();
shell->MarkFrameVisibleInDisplayPort(child);
}
// Child is composited if it's transformed, partially transparent, or has
// SVG effects or a blend mode..
const nsStyleDisplay* disp = child->StyleDisplay();