Bug 626343. Check return value when creating a plugin widget. r=roc a=blocking

This commit is contained in:
Timothy Nikkel 2011-01-31 17:31:34 -06:00
Родитель b5cc0b1b70
Коммит 07d8bebb97
2 изменённых файлов: 21 добавлений и 3 удалений

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

@ -758,8 +758,21 @@ ContainerState::CreateOrRecycleThebesLayer(nsIFrame* aActiveScrolledRoot)
// Set up transform so that 0,0 in the Thebes layer corresponds to the
// (pixel-snapped) top-left of the aActiveScrolledRoot.
nsPoint offset = mBuilder->ToReferenceFrame(aActiveScrolledRoot);
nsIntPoint pixOffset = offset.ToNearestPixels(
nsIntPoint pixOffset;
pixOffset.x = NSToIntRound(NSAppUnitsToFloatPixels(offset.x, float(aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel())));
pixOffset.y = NSToIntRound(NSAppUnitsToFloatPixels(offset.y, float(aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel())));
nsIntPoint pixOffset2 = offset.ToNearestPixels(
aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel());
if (pixOffset != pixOffset2) {
printf("offset %d %d offset/60 %d %d pixoffset %d %d pixoffset2 %d %d", offset.x, offset.y, offset.x/60, offset.y/60, pixOffset.x, pixOffset.y, pixOffset2.x, pixOffset2.y);
if (offset.y % 60 == 0) printf(" exact");
if ((offset.y / 60)*60 == offset.y) printf(" exact2");
printf(" float val %f double val %fL", NSAppUnitsToFloatPixels(offset.y, float(aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel())),
double(offset.y)/double(aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel()));
printf("\n");
}
pixOffset.x = NSToIntRound(float(double(offset.x)/double(aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel())));
pixOffset.y = NSToIntRound(float(double(offset.y)/double(aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel())));
gfxMatrix matrix;
matrix.Translate(gfxPoint(pixOffset.x, pixOffset.y));
layer->SetTransform(gfx3DMatrix::From2D(matrix));

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

@ -787,8 +787,13 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
// allow the view to attach its event handler to mWidget even though
// mWidget isn't the view's designated widget.
EVENT_CALLBACK eventHandler = mInnerView->AttachWidgetEventHandler(mWidget);
mWidget->Create(parentWidget, nsnull, nsIntRect(0,0,0,0),
eventHandler, dx, nsnull, nsnull, &initData);
rv = mWidget->Create(parentWidget, nsnull, nsIntRect(0,0,0,0),
eventHandler, dx, nsnull, nsnull, &initData);
if (NS_FAILED(rv)) {
mWidget->Destroy();
mWidget = nsnull;
return rv;
}
mWidget->EnableDragDrop(PR_TRUE);