diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index d97df16d8361..df6155e2aaaf 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -269,6 +269,16 @@ public: */ Color GetDrawBackgroundColor() const; + /** SwPageFrame::IsTransparent + + determine transparency to force paint of margin area to clear + the screen during scrolling also in the browse mode (Web View), + if the page has transparent background color or image + + @return true, if the background is transparent + */ + bool IsTransparent() const; + /** paint margin area of a page implement paint of margin area; margin area will be painted for a diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 8c20533fd19c..6aba6542c894 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -6327,7 +6327,13 @@ void SwPageFrame::PaintBaselineGrid(OutputDevice& rOututDevice) const void SwPageFrame::PaintMarginArea( const SwRect& _rOutputRect, SwViewShell const * _pViewShell ) const { - if ( !_pViewShell->GetWin() || _pViewShell->GetViewOptions()->getBrowseMode() ) + if ( !_pViewShell->GetWin() ) + return; + + // no need for page margin in browse mode, except in the case of + // (scrolling with) transparent page background color or + // transparent page background image + if ( _pViewShell->GetViewOptions()->getBrowseMode() && !IsTransparent() ) return; // Simplified paint with DrawingLayer FillStyle @@ -7885,6 +7891,27 @@ Color SwPageFrame::GetDrawBackgroundColor() const return aGlobalRetoucheColor; } +/** + * For tdf#98598 and tdf#172186 (Web View scrolling regressions) + * + * @return isTransparent() + */ +bool SwPageFrame::IsTransparent() const +{ + const SvxBrushItem* pBrushItem; + std::optional xDummyColor; + SwRect aDummyRect; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + + if ( GetBackgroundBrush( aFillAttributes, pBrushItem, xDummyColor, aDummyRect, true, /*bConsiderTextBox=*/false) ) + { + if ( aFillAttributes && aFillAttributes->isUsed() ) + return aFillAttributes->isTransparent(); + } + + return false; +} + /// create/return font used to paint the "empty page" string const vcl::Font& SwPageFrame::GetEmptyPageFont() {