Fix layout of webpage preview with a sticker with small height.

This commit is contained in:
John Preston 2021-11-05 15:28:32 +04:00
parent 55eb381bd2
commit d0cb387c6e

View file

@ -77,7 +77,8 @@ QSize UnwrappedMedia::countOptimalSize() {
QSize UnwrappedMedia::countCurrentSize(int newWidth) { QSize UnwrappedMedia::countCurrentSize(int newWidth) {
const auto item = _parent->data(); const auto item = _parent->data();
accumulate_min(newWidth, maxWidth()); accumulate_min(newWidth, maxWidth());
if (_parent->media() == this) { const auto isPageAttach = (_parent->media() != this);
if (!isPageAttach) {
const auto via = item->Get<HistoryMessageVia>(); const auto via = item->Get<HistoryMessageVia>();
const auto reply = _parent->displayedReply(); const auto reply = _parent->displayedReply();
const auto forwarded = getDisplayedForwardedInfo(); const auto forwarded = getDisplayedForwardedInfo();
@ -93,8 +94,9 @@ QSize UnwrappedMedia::countCurrentSize(int newWidth) {
} }
} }
auto newHeight = minHeight(); auto newHeight = minHeight();
if (_parent->hasOutLayout() if (!isPageAttach
&& !_parent->delegate()->elementIsChatWide()) { && _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide()) {
// Add some height to isolated emoji for the timestamp info. // Add some height to isolated emoji for the timestamp info.
const auto infoHeight = st::msgDateImgPadding.y() * 2 const auto infoHeight = st::msgDateImgPadding.y() * 2
+ st::msgDateFont->height; + st::msgDateFont->height;