Praise be to Allah.
The landlord should repair whatever gets damaged of rented property without the tenant having caused the damage, or what gets worn out by normal usage, such as if the roof collapses or a window develops problems and so on, because the tenant has the right to make use of what he is renting, which should be in good condition, for the duration of his tenancy.
It says in Kashshaaf al-Qinaa‘ (4/21): The landlord must maintain the property, i.e., what he rents out, whether it is a house, a bathhouse, and so on, including the floor and roof, by repairing what needs to be repaired, fixing what is broken, setting upright what has started to lean, making a door, plastering and so on, as needed, because by doing this he is enabling the tenant to make proper use of the property.
If the landlord does not do that, then the tenant has the right to cancel the contract, so as to remove the harm that will affect him if he does not cancel the contract.
If the landlord does not fix what needs fixing, and as a result something belonging to the tenant gets damaged, then he becomes liable for it. The basic principle with regard to damaged property is that what can be replaced with something of similar quality should be replaced, and if something similar cannot be found, then he is liable for the value thereof.
Therefore if the mattress got damaged because of the water that came in through the window, and this mattress was new, and there is something similar in the market, then you must replace it with something similar.
If there is nothing similar to it, or it was old, and it is difficult to find something similar to it in a similar condition, then you must pay the estimated value of the mattress before the damage occurred.
In either case, the damaged mattress becomes your property.
If you both agreed to some compensation, and the tenant kept his damaged mattress, there is nothing wrong with that.
Ibn al-Qayyim (may Allah have mercy on him) said:
The second principle is that whatever items are damaged must be replaced (in the case of liability) with similar items, as far as possible, whilst bearing in mind their value.
If finding another item that is similar in all aspects is not possible, even with regard to items that could be measured by volume and weight, then whatever is closest to the original item is more appropriate (as a replacement).
Undoubtedly replacing an item with a similar item is more appropriate than replacing an item with its estimated value. This is on the basis of analogy and is what may be understood from the religious texts. And Allah is the source of strength.
End quote from I‘laam al-Muwaqqi‘een (2/20).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
When an item can be replaced with a similar item in the case of liability, that is what should be done, and in the case of that which is subject to estimation of its value, its estimated value should be paid. That is because the Prophet (blessings and peace of Allah be upon him) said: “A vessel for a vessel and food for food.” That refers to the well-known story, that the Prophet (blessings and peace of Allah be upon him) was with one of his wives (may Allah be pleased with them all), and another wife sent a servant with food in a bowl. The servant came in and brought the food and the bowl to the Messenger (blessings and peace of Allah be upon him) in the house of the co-wife, who became jealous, so she struck the hand of the servant, causing the bowl to fall and break. The Prophet (blessings and peace of Allah be upon him) picked up the food of the wife in whose house he was, and her bowl, gave them to the servant and said: “A vessel for a vessel and food for food.” In this case the liability was like-for-like, because it was possible to replace like for like.
And Allah knows best.