@@ -347,12 +347,21 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
347
347
className = "mx_MImageBody_thumbnail"
348
348
src = { thumbUrl }
349
349
ref = { this . image }
350
- style = { { maxWidth : `min(100%, ${ maxWidth } px)` } }
350
+ // Force the image to be the full size of the container, even if the
351
+ // pixel size is smaller. The problem here is that we don't know what
352
+ // thumbnail size the HS is going to give us, but we have to commit to
353
+ // a container size immediately and not change it when the image loads
354
+ // or we'll get a scroll jump (or have to leave blank space).
355
+ // This will obviously result in an upscaled image which will be a bit
356
+ // blurry. The best fix would be for the HS to advertise what size thumbnails
357
+ // it guarantees to produce.
358
+ style = { { height : '100%' } }
351
359
alt = { content . body }
352
360
onError = { this . onImageError }
353
361
onLoad = { this . onImageLoad }
354
362
onMouseEnter = { this . onImageEnter }
355
- onMouseLeave = { this . onImageLeave } />
363
+ onMouseLeave = { this . onImageLeave }
364
+ />
356
365
) ;
357
366
}
358
367
@@ -379,7 +388,10 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
379
388
</ div >
380
389
}
381
390
382
- < div style = { { display : ! showPlaceholder ? undefined : 'none' } } >
391
+ < div style = { {
392
+ display : ! showPlaceholder ? undefined : 'none' ,
393
+ height : '100%' , // Also force to size of a parent to prevent scroll-jumps (see above)
394
+ } } >
383
395
{ img }
384
396
{ gifLabel }
385
397
</ div >
0 commit comments