diff --git a/Telegram/SourceFiles/iv/iv.style b/Telegram/SourceFiles/iv/iv.style index 0e35e963a9..66250dc2f3 100644 --- a/Telegram/SourceFiles/iv/iv.style +++ b/Telegram/SourceFiles/iv/iv.style @@ -471,7 +471,7 @@ defaultMarkdownTable: MarkdownTable { overflowWidth: 4px; overflowFg: windowSubTextFg; scrollbarSkip: 4px; - scrollbarHeight: 6px; + scrollbarHeight: 12px; scrollbarMinThumbWidth: 24px; } defaultMarkdownDetailsSummaryStyle: TextStyle(defaultTextStyle) { @@ -874,7 +874,7 @@ messageMarkdownTable: MarkdownTable(defaultMarkdownTable) { overflowWidth: 3px; overflowFg: msgInDateFg; scrollbarSkip: 3px; - scrollbarHeight: 5px; + scrollbarHeight: 10px; scrollbarMinThumbWidth: 20px; } messageMarkdownDisplayMath: MarkdownDisplayMath(defaultMarkdownDisplayMath) { diff --git a/Telegram/SourceFiles/iv/markdown/iv_markdown_article_layout_structure.cpp b/Telegram/SourceFiles/iv/markdown/iv_markdown_article_layout_structure.cpp index 0fbaa95c28..a2ff32d525 100644 --- a/Telegram/SourceFiles/iv/markdown/iv_markdown_article_layout_structure.cpp +++ b/Telegram/SourceFiles/iv/markdown/iv_markdown_article_layout_structure.cpp @@ -689,10 +689,13 @@ void FinalizeOwnerSelection( bodyLineHeight); } - const auto scrollOwner = IsActiveScrollOwner(analysis, activeScrollOwner); + const auto currentScrollOwner = NextActiveScrollOwner( + analysis, + activeScrollOwner); + const auto scrollOwner = IsActiveScrollOwner(analysis, currentScrollOwner); const auto outerLogicalWidth = LogicalOuterWidth( analysis, - activeScrollOwner, + currentScrollOwner, logicalWidth); block.markerWidth = std::max(list.markerWidth, markerTextWidth); const auto bodyLeft = left + block.markerWidth + list.markerSkip; @@ -702,9 +705,7 @@ void FinalizeOwnerSelection( const auto bodyLogicalWidth = std::max( outerLogicalWidth - block.markerWidth - list.markerSkip, 1); - const auto childActiveScrollOwner = NextActiveScrollOwner( - analysis, - activeScrollOwner); + const auto childActiveScrollOwner = currentScrollOwner; auto childContext = context; childContext.tightList = tight; @@ -826,17 +827,18 @@ void FinalizeOwnerSelection( const auto listWidth = std::max( width - depthDelta * st.list.indent, 1); - const auto scrollOwner = IsActiveScrollOwner(analysis, activeScrollOwner); + const auto currentScrollOwner = NextActiveScrollOwner( + analysis, + activeScrollOwner); + const auto scrollOwner = IsActiveScrollOwner(analysis, currentScrollOwner); const auto outerLogicalWidth = LogicalOuterWidth( analysis, - activeScrollOwner, + currentScrollOwner, logicalWidth); const auto listLogicalWidth = std::max( outerLogicalWidth - depthDelta * st.list.indent, 1); - const auto childActiveScrollOwner = NextActiveScrollOwner( - analysis, - activeScrollOwner); + const auto childActiveScrollOwner = currentScrollOwner; auto childContext = context; childContext.listDepth = prepared.visualDepth; @@ -1501,15 +1503,22 @@ void FinalizeOwnerSelection( MathRenderer *renderer, InlineFormulaObjectCache *inlineFormulaObjects, const std::shared_ptr &mediaRuntime, - const WidthAnalysisNode &analysis, - const WidthAnalysisNode *activeScrollOwner, + const WidthAnalysisNode &analysis, + const WidthAnalysisNode *activeScrollOwner, const style::Markdown &st, - int left, + int left, int top, int width, int logicalWidth, LayoutContext context) { - const auto scrollOwner = IsActiveScrollOwner(analysis, activeScrollOwner); + const auto currentScrollOwner = NextActiveScrollOwner( + analysis, + activeScrollOwner); + const auto scrollOwner = IsActiveScrollOwner(analysis, currentScrollOwner); + const auto effectiveLogicalWidth = LogicalOuterWidth( + analysis, + currentScrollOwner, + logicalWidth); switch (prepared.kind) { case PreparedBlockKind::Paragraph: case PreparedBlockKind::Thinking: @@ -1523,7 +1532,7 @@ void FinalizeOwnerSelection( left, top, width, - logicalWidth, + effectiveLogicalWidth, scrollOwner, context); case PreparedBlockKind::CodeBlock: @@ -1536,7 +1545,7 @@ void FinalizeOwnerSelection( left, top, width, - logicalWidth, + effectiveLogicalWidth, scrollOwner, context.allowAsyncSyntaxHighlighting, context.syntaxHighlightTracker, @@ -1552,12 +1561,12 @@ void FinalizeOwnerSelection( inlineFormulaObjects, mediaRuntime, analysis, - activeScrollOwner, + currentScrollOwner, st, left, top, width, - logicalWidth, + effectiveLogicalWidth, context); case PreparedBlockKind::ListItem: return LayoutListItemBlock( @@ -1568,12 +1577,12 @@ void FinalizeOwnerSelection( inlineFormulaObjects, mediaRuntime, analysis, - activeScrollOwner, + currentScrollOwner, st, left, top, width, - logicalWidth, + effectiveLogicalWidth, context, false); case PreparedBlockKind::Quote: @@ -1585,12 +1594,12 @@ void FinalizeOwnerSelection( inlineFormulaObjects, mediaRuntime, analysis, - activeScrollOwner, + currentScrollOwner, st, left, top, width, - logicalWidth, + effectiveLogicalWidth, context); case PreparedBlockKind::DisplayMath: return LayoutDisplayMathBlock( @@ -1600,7 +1609,7 @@ void FinalizeOwnerSelection( left, top, width, - logicalWidth, + effectiveLogicalWidth, scrollOwner); case PreparedBlockKind::Table: return LayoutTableBlock( @@ -1612,7 +1621,7 @@ void FinalizeOwnerSelection( left, top, width, - logicalWidth, + effectiveLogicalWidth, scrollOwner, context); case PreparedBlockKind::Photo: @@ -1709,12 +1718,12 @@ void FinalizeOwnerSelection( inlineFormulaObjects, mediaRuntime, analysis, - activeScrollOwner, + currentScrollOwner, st, left, top, width, - logicalWidth, + effectiveLogicalWidth, context); case PreparedBlockKind::EmbedPost: return LayoutEmbedPostBlock( @@ -1725,12 +1734,12 @@ void FinalizeOwnerSelection( inlineFormulaObjects, mediaRuntime, analysis, - activeScrollOwner, + currentScrollOwner, st, left, top, width, - logicalWidth, + effectiveLogicalWidth, context); } Unexpected("Unknown markdown article block kind."); diff --git a/Telegram/SourceFiles/iv/markdown/iv_markdown_article_paint.cpp b/Telegram/SourceFiles/iv/markdown/iv_markdown_article_paint.cpp index f9894fafbd..9e49799975 100644 --- a/Telegram/SourceFiles/iv/markdown/iv_markdown_article_paint.cpp +++ b/Telegram/SourceFiles/iv/markdown/iv_markdown_article_paint.cpp @@ -2856,16 +2856,30 @@ void PaintBlock( }); break; case PreparedBlockKind::List: - PaintBlocks( - p, - block.children, - formulas, - renderedFormulas, - renderer, - devicePixelRatio, - outerWidth, - st, - context); + { + const auto childContext = block.scrollViewportRect.isEmpty() + ? context + : ClippedContext( + context, + context.clip.intersected(block.scrollViewportRect)); + PaintBlocks( + p, + block.children, + formulas, + renderedFormulas, + renderer, + devicePixelRatio, + outerWidth, + st, + childContext); + PaintHorizontalOverflowIndicators( + p, + block, + st, + context, + block.scrollViewportRect); + PaintHorizontalScrollbar(p, block, st, context); + } break; case PreparedBlockKind::ListItem: if (!context.reveal @@ -2886,16 +2900,30 @@ void PaintBlock( PaintBulletMarker(p, block, st, markerContext); } } - PaintBlocks( - p, - block.children, - formulas, - renderedFormulas, - renderer, - devicePixelRatio, - outerWidth, - st, - context); + { + const auto childContext = block.scrollViewportRect.isEmpty() + ? context + : ClippedContext( + context, + context.clip.intersected(block.scrollViewportRect)); + PaintBlocks( + p, + block.children, + formulas, + renderedFormulas, + renderer, + devicePixelRatio, + outerWidth, + st, + childContext); + PaintHorizontalOverflowIndicators( + p, + block, + st, + context, + block.scrollViewportRect); + PaintHorizontalScrollbar(p, block, st, context); + } break; case PreparedBlockKind::Quote: PaintQuoteBlock(