Bug 1097441 - Use SetScaleToSize for scaling videos so that it works for asynchronous size changes. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 12 Nov 2014 17:11:53 +1300
changeset 231915 11c5034cb10b1199bd34b80ed14433da2f59af40
parent 231914 a98abd02074ff940428ff3ad839d7d2aa6491fe4
child 231916 b52b8019d49a2c41fac48ee5b01ba07a6ee3db5e
push id7326
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:58:42 +0000
treeherdermozilla-aurora@d3a3b2a0f2f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1097441
milestone36.0a1
Bug 1097441 - Use SetScaleToSize for scaling videos so that it works for asynchronous size changes. r=roc
layout/generic/nsVideoFrame.cpp
--- 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)