Improved style of sponsored messages with media with max width.

This commit is contained in:
23rd 2024-11-14 20:27:15 +03:00
parent 2b5f68003d
commit ddaf11ed6a

View file

@ -560,7 +560,9 @@ QSize WebPage::countOptimalSize() {
}
// init dimensions
const auto skipBlockWidth = _parent->skipBlockWidth();
const auto skipBlockWidth = (sponsored && sponsored->hasMedia)
? 0
: _parent->skipBlockWidth();
auto maxWidth = skipBlockWidth;
auto minHeight = 0;
@ -628,8 +630,10 @@ QSize WebPage::countOptimalSize() {
_durationWidth = st::msgDateFont->width(_duration);
}
if (!_openButton.isEmpty()) {
maxWidth += rect::m::sum::h(st::historyPageButtonPadding)
+ _openButton.maxWidth();
accumulate_max(
maxWidth,
rect::m::sum::h(st::historyPageButtonPadding)
+ _openButton.maxWidth());
}
maxWidth += rect::m::sum::h(padding);
minHeight += rect::m::sum::v(padding);