diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index 7357bed906..8cfe0d7516 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -596,12 +596,13 @@ void GifsListWidget::layoutInlineRow(Row &row, int fullWidth) { row.height = 0; int availw = fullWidth - (st::inlineResultsLeft - st::buttonRadius); for (int i = 0; i < count; ++i) { - int index = indices[i]; - int w = desiredWidth - ? (row.items[index]->maxWidth() * availw / desiredWidth) - : row.items[index]->maxWidth(); - int actualw = qMax(w, int(st::inlineResultsMinWidth)); - row.height = qMax(row.height, row.items[index]->resizeGetHeight(actualw)); + const auto index = indices[i]; + const auto &item = row.items[index]; + const auto w = desiredWidth + ? (item->maxWidth() * availw / desiredWidth) + : item->maxWidth(); + auto actualw = qMax(w, st::inlineResultsMinWidth); + row.height = qMax(row.height, item->resizeGetHeight(actualw)); if (desiredWidth) { availw -= actualw; desiredWidth -= row.items[index]->maxWidth(); diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index 860aad990a..fbaf74b6d4 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -134,6 +134,12 @@ void DeleteSavedGifClickHandler::onClickImpl() const { Auth().data().markSavedGifsUpdated(); } +int Gif::resizeGetHeight(int width) { + _width = width; + _height = _minh; + return _height; +} + void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) const { DocumentData *document = getShownDocument(); document->automaticLoad(nullptr); @@ -921,12 +927,6 @@ void Contact::initDimensions() { _minh += st::inlineRowMargin * 2 + st::inlineRowBorder; } -int32 Contact::resizeGetHeight(int32 width) { - _width = qMin(width, _maxw); - _height = _minh; - return _height; -} - void Contact::paint(Painter &p, const QRect &clip, const PaintContext *context) const { int32 left = st::emojiPanHeaderLeft - st::inlineResultsLeft; diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h index a47728d58a..42874cc948 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h @@ -80,10 +80,7 @@ public: // ClickHandlerHost interface void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override; - int resizeGetHeight(int width) override { - _width = width; - return _minh; - } + int resizeGetHeight(int width) override; private: QSize countFrameSize() const; @@ -306,7 +303,6 @@ public: Contact(not_null context, Result *result); void initDimensions() override; - int resizeGetHeight(int width) override; void paint(Painter &p, const QRect &clip, const PaintContext *context) const override; HistoryTextState getState(