Bug 1097441 - Use SetScaleToSize for scaling videos so that it works for asynchronous size changes. r=roc
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -218,19 +218,18 @@ nsVideoFrame::BuildLayer(nsDisplayListBu
return nullptr;
}
layer->SetContainer(container);
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
// Set a transform on the layer to draw the video in the right place
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
- transform.PreScale(r.Width() / frameSize.width,
- r.Height() / frameSize.height);
layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
+ layer->SetScaleToSize(IntSize(r.width, r.height), ScaleMode::STRETCH);
nsRefPtr<Layer> result = layer.forget();
return result.forget();
}
class DispatchResizeToControls : public nsRunnable
{
public:
explicit DispatchResizeToControls(nsIContent* aContent)