Page MenuHomePhabricator

[web] Support thumbhash in modals
ClosedPublic

Authored by bartek on May 23 2023, 7:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 9:12 PM
Unknown Object (File)
Feb 23 2024, 8:30 PM
Unknown Object (File)
Feb 23 2024, 8:30 PM
Unknown Object (File)
Feb 23 2024, 8:29 PM
Unknown Object (File)
Feb 23 2024, 7:31 PM
Unknown Object (File)
Feb 23 2024, 5:42 PM
Unknown Object (File)
Jan 12 2024, 12:17 PM
Unknown Object (File)
Dec 17 2023, 12:00 AM
Subscribers

Details

Summary

This adds support for thumb hash in modals. Unfortunately, CSS in encrypted media does not know its width and height so had to do measuring magic to get it to work with thumbhash, before actual src is available. Encrypted video support is added in D7900

Test Plan

Throttled network, slowed down decryption. Ensured the loading behavior is the same as for in-chat media (both non-encrypted images and videos). Resized browser window. Ensured the aspect ratio is maintained.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.May 23 2023, 8:12 AM
bartek added inline comments.
web/media/multimedia-modal.react.js
149 ↗(On Diff #26900)

Unfortunately, CSS in encrypted media does not know its width and height before its decrypted so we need this to resize the thumbhash image manually. This function does the same as the following CSS:

width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
display: block;
ashoat added inline comments.
web/media/multimedia-modal.react.js
73–77 ↗(On Diff #26900)

Seems like we could move this inside the conditional on line 78, to make it clear it's only used for that case

149 ↗(On Diff #26900)

Thanks for explaining!

web/media/multimedia.react.js
100–112 ↗(On Diff #26900)

I think if you rebase on the latest version of D7902, this change will be gone

This revision is now accepted and ready to land.May 23 2023, 1:15 PM
bartek edited the test plan for this revision. (Show Details)
bartek edited the summary of this revision. (Show Details)

Reworked the diff to the new approach. The only significant change here is that one usage of the state defined in this diff is moved to D7900.

The whole approach and diff tree changes discussed in D7902

web/media/multimedia-modal.react.js
48–50 ↗(On Diff #26922)

This state is used in the next diff: D7900

ashoat added inline comments.
web/media/multimedia-modal.react.js
53–58 ↗(On Diff #26922)

Arguably this way is cleaner, but both work

This revision was automatically updated to reflect the committed changes.