diff --git a/image/SurfaceCache.cpp b/image/SurfaceCache.cpp index fe4a9976bc72..2c805b22b7b2 100644 --- a/image/SurfaceCache.cpp +++ b/image/SurfaceCache.cpp @@ -562,6 +562,10 @@ class ImageSurfaceCache { MOZ_ASSERT_UNREACHABLE("Expected valid native size!"); return aSize; } + if (image->GetOrientation().SwapsWidthAndHeight() && + image->HandledOrientation()) { + std::swap(factorSize.width, factorSize.height); + } if (mIsVectorImage) { // Ensure the aspect ratio matches the native size before forcing the