Fix web page video message with reactions.

This commit is contained in:
John Preston 2023-08-21 13:32:09 +02:00
parent d7e2046ef3
commit 58d762f130
3 changed files with 21 additions and 4 deletions

View file

@ -1027,9 +1027,13 @@ void Message::draw(Painter &p, const PaintContext &context) const {
auto trect = inner.marginsRemoved(st::msgPadding); auto trect = inner.marginsRemoved(st::msgPadding);
const auto reactionsTop = (reactionsInBubble && !_viewButton) const auto additionalInfoSkip = (mediaDisplayed
? st::mediaInBubbleSkip && !media->additionalInfoString().isEmpty())
? st::msgDateFont->height
: 0; : 0;
const auto reactionsTop = (reactionsInBubble && !_viewButton)
? (additionalInfoSkip + st::mediaInBubbleSkip)
: additionalInfoSkip;
const auto reactionsHeight = reactionsInBubble const auto reactionsHeight = reactionsInBubble
? (reactionsTop + _reactions->height()) ? (reactionsTop + _reactions->height())
: 0; : 0;
@ -2045,9 +2049,13 @@ TextState Message::textState(
return result; return result;
} }
auto trect = inner.marginsRemoved(st::msgPadding); auto trect = inner.marginsRemoved(st::msgPadding);
const auto reactionsTop = (reactionsInBubble && !_viewButton) const auto additionalInfoSkip = (mediaDisplayed
? st::mediaInBubbleSkip && !media->additionalInfoString().isEmpty())
? st::msgDateFont->height
: 0; : 0;
const auto reactionsTop = (reactionsInBubble && !_viewButton)
? (additionalInfoSkip + st::mediaInBubbleSkip)
: additionalInfoSkip;
const auto reactionsHeight = reactionsInBubble const auto reactionsHeight = reactionsInBubble
? (reactionsTop + _reactions->height()) ? (reactionsTop + _reactions->height())
: 0; : 0;
@ -3783,6 +3791,10 @@ int Message::resizeContentGetHeight(int newWidth) {
if (reactionsInBubble) { if (reactionsInBubble) {
if (!mediaDisplayed || _viewButton) { if (!mediaDisplayed || _viewButton) {
newHeight += st::mediaInBubbleSkip; newHeight += st::mediaInBubbleSkip;
} else if (!media->additionalInfoString().isEmpty()) {
// In round videos in a web page status text is painted
// in the bottom left corner, reactions should be below.
newHeight += st::msgDateFont->height;
} }
newHeight += _reactions->height(); newHeight += _reactions->height();
} }

View file

@ -829,6 +829,10 @@ bool WebPage::isDisplayed() const {
&& !item->Has<HistoryMessageLogEntryOriginal>(); && !item->Has<HistoryMessageLogEntryOriginal>();
} }
QString WebPage::additionalInfoString() const {
return _attach ? _attach->additionalInfoString() : QString();
}
TextForMimeData WebPage::selectedText(TextSelection selection) const { TextForMimeData WebPage::selectedText(TextSelection selection) const {
auto siteNameResult = _siteName.toTextForMimeData(selection); auto siteNameResult = _siteName.toTextForMimeData(selection);
auto titleResult = _title.toTextForMimeData( auto titleResult = _title.toTextForMimeData(

View file

@ -40,6 +40,7 @@ public:
bool hasTextForCopy() const override { bool hasTextForCopy() const override {
return false; // we do not add _title and _description in FullSelection text copy. return false; // we do not add _title and _description in FullSelection text copy.
} }
QString additionalInfoString() const override;
bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override { bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override {
return _attach && _attach->toggleSelectionByHandlerClick(p); return _attach && _attach->toggleSelectionByHandlerClick(p);