mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 598854. We no longer have cases where the view to paint is not a displayroot, so remove the code that handles that. r=tnikkel
This commit is contained in:
parent
7a87d202c9
commit
507be0258e
@ -843,8 +843,7 @@ public:
|
||||
|
||||
//nsIViewObserver interface
|
||||
|
||||
NS_IMETHOD Paint(nsIView* aDisplayRoot,
|
||||
nsIView* aViewToPaint,
|
||||
NS_IMETHOD Paint(nsIView* aViewToPaint,
|
||||
nsIWidget* aWidget,
|
||||
const nsRegion& aDirtyRegion,
|
||||
const nsIntRegion& aIntDirtyRegion,
|
||||
@ -5877,9 +5876,6 @@ nscolor PresShell::ComputeBackstopColor(nsIView* aDisplayRoot)
|
||||
}
|
||||
|
||||
struct PaintParams {
|
||||
nsIFrame* mFrame;
|
||||
nsPoint mOffsetToWidget;
|
||||
const nsRegion* mDirtyRegion;
|
||||
nscolor mBackgroundColor;
|
||||
};
|
||||
|
||||
@ -5957,33 +5953,16 @@ static void DrawThebesLayer(ThebesLayer* aLayer,
|
||||
void* aCallbackData)
|
||||
{
|
||||
PaintParams* params = static_cast<PaintParams*>(aCallbackData);
|
||||
nsIFrame* frame = params->mFrame;
|
||||
if (frame) {
|
||||
// We're drawing into a child window.
|
||||
nsIDeviceContext* devCtx = frame->PresContext()->DeviceContext();
|
||||
nsCOMPtr<nsIRenderingContext> rc;
|
||||
nsresult rv = devCtx->CreateRenderingContextInstance(*getter_AddRefs(rc));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rc->Init(devCtx, aContext);
|
||||
nsIRenderingContext::AutoPushTranslation
|
||||
push(rc, params->mOffsetToWidget.x, params->mOffsetToWidget.y);
|
||||
nsLayoutUtils::PaintFrame(rc, frame, *params->mDirtyRegion,
|
||||
params->mBackgroundColor,
|
||||
nsLayoutUtils::PAINT_WIDGET_LAYERS);
|
||||
}
|
||||
} else {
|
||||
aContext->NewPath();
|
||||
aContext->SetColor(gfxRGBA(params->mBackgroundColor));
|
||||
nsIntRect dirtyRect = aRegionToDraw.GetBounds();
|
||||
aContext->Rectangle(
|
||||
gfxRect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height));
|
||||
aContext->Fill();
|
||||
}
|
||||
aContext->NewPath();
|
||||
aContext->SetColor(gfxRGBA(params->mBackgroundColor));
|
||||
nsIntRect dirtyRect = aRegionToDraw.GetBounds();
|
||||
aContext->Rectangle(
|
||||
gfxRect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height));
|
||||
aContext->Fill();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::Paint(nsIView* aDisplayRoot,
|
||||
nsIView* aViewToPaint,
|
||||
PresShell::Paint(nsIView* aViewToPaint,
|
||||
nsIWidget* aWidgetToPaint,
|
||||
const nsRegion& aDirtyRegion,
|
||||
const nsIntRegion& aIntDirtyRegion,
|
||||
@ -6002,7 +5981,6 @@ PresShell::Paint(nsIView* aDisplayRoot,
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
|
||||
NS_ASSERTION(aDisplayRoot, "null view");
|
||||
NS_ASSERTION(aViewToPaint, "null view");
|
||||
NS_ASSERTION(aWidgetToPaint, "Can't paint without a widget");
|
||||
|
||||
@ -6010,7 +5988,7 @@ PresShell::Paint(nsIView* aDisplayRoot,
|
||||
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
|
||||
|
||||
nsIFrame* frame = aPaintDefaultBackground
|
||||
? nsnull : static_cast<nsIFrame*>(aDisplayRoot->GetClientData());
|
||||
? nsnull : static_cast<nsIFrame*>(aViewToPaint->GetClientData());
|
||||
|
||||
bool isRetainingManager;
|
||||
LayerManager* layerManager =
|
||||
@ -6041,9 +6019,9 @@ PresShell::Paint(nsIView* aDisplayRoot,
|
||||
frame->ClearPresShellsFromLastPaint();
|
||||
}
|
||||
|
||||
nscolor bgcolor = ComputeBackstopColor(aDisplayRoot);
|
||||
nscolor bgcolor = ComputeBackstopColor(aViewToPaint);
|
||||
|
||||
if (frame && aViewToPaint == aDisplayRoot) {
|
||||
if (frame) {
|
||||
// Defer invalidates that are triggered during painting, and discard
|
||||
// invalidates of areas that are already being repainted.
|
||||
// The layer system can trigger invalidates during painting
|
||||
@ -6063,30 +6041,15 @@ PresShell::Paint(nsIView* aDisplayRoot,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
// Defer invalidates that are triggered during painting, and discard
|
||||
// invalidates of areas that are already being repainted.
|
||||
frame->BeginDeferringInvalidatesForDisplayRoot(aDirtyRegion);
|
||||
}
|
||||
|
||||
nsRefPtr<ThebesLayer> root = layerManager->CreateThebesLayer();
|
||||
if (root) {
|
||||
root->SetVisibleRegion(aIntDirtyRegion);
|
||||
layerManager->SetRoot(root);
|
||||
}
|
||||
if (!frame) {
|
||||
bgcolor = NS_ComposeColors(bgcolor, mCanvasBackgroundColor);
|
||||
}
|
||||
PaintParams params =
|
||||
{ frame,
|
||||
aDisplayRoot->GetOffsetToWidget(aWidgetToPaint),
|
||||
&aDirtyRegion,
|
||||
bgcolor };
|
||||
bgcolor = NS_ComposeColors(bgcolor, mCanvasBackgroundColor);
|
||||
PaintParams params = { bgcolor };
|
||||
layerManager->EndTransaction(DrawThebesLayer, ¶ms);
|
||||
|
||||
if (frame) {
|
||||
frame->EndDeferringInvalidatesForDisplayRoot();
|
||||
}
|
||||
presContext->NotifyDidPaintForSubtree();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ class nsIRenderingContext;
|
||||
class nsGUIEvent;
|
||||
|
||||
#define NS_IVIEWOBSERVER_IID \
|
||||
{ 0xc8ba5804, 0x2459, 0x4b62, \
|
||||
{ 0xa4, 0x15, 0x02, 0x84, 0x1a, 0xd7, 0x93, 0xa7 } }
|
||||
{ 0xdc283a18, 0x61cb, 0x468c, \
|
||||
{ 0x8d, 0xb8, 0x9b, 0x81, 0xf7, 0xc9, 0x33, 0x25 } }
|
||||
|
||||
class nsIViewObserver : public nsISupports
|
||||
{
|
||||
@ -76,8 +76,7 @@ public:
|
||||
* which is to paint some default background color over the dirty region.
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD Paint(nsIView* aDisplayRoot,
|
||||
nsIView* aViewToPaint,
|
||||
NS_IMETHOD Paint(nsIView* aViewToPaint,
|
||||
nsIWidget* aWidgetToPaint,
|
||||
const nsRegion& aDirtyRegion,
|
||||
const nsIntRegion& aIntDirtyRegion,
|
||||
|
@ -441,20 +441,11 @@ void nsViewManager::RenderViews(nsView *aView, nsIWidget *aWidget,
|
||||
PRBool aPaintDefaultBackground,
|
||||
PRBool aWillSendDidPaint)
|
||||
{
|
||||
nsView* displayRoot = GetDisplayRootFor(aView);
|
||||
// Make sure we call Paint from the view manager that owns displayRoot.
|
||||
// (Bug 485275)
|
||||
nsViewManager* displayRootVM = displayRoot->GetViewManager();
|
||||
if (displayRootVM && displayRootVM != this) {
|
||||
displayRootVM->
|
||||
RenderViews(aView, aWidget, aRegion, aIntRegion, aPaintDefaultBackground,
|
||||
aWillSendDidPaint);
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
|
||||
"Widgets that we paint must all be display roots");
|
||||
|
||||
if (mObserver) {
|
||||
nsRegion region = ConvertRegionBetweenViews(aRegion, aView, displayRoot);
|
||||
mObserver->Paint(displayRoot, aView, aWidget, region, aIntRegion,
|
||||
mObserver->Paint(aView, aWidget, aRegion, aIntRegion,
|
||||
aPaintDefaultBackground, aWillSendDidPaint);
|
||||
if (!gFirstPaintTimestamp)
|
||||
gFirstPaintTimestamp = PR_Now();
|
||||
|
Loading…
Reference in New Issue
Block a user