tdf#98598 tdf#172186 sw: fix Web View with transparent page

Page background with transparent image or transparent color
resulted broken scrolling in Web View, painting page content
without clearing the screen. Force painting of page margin
to clear the screen, as in the Normal View.

Regression since commit 65a56636a6
"tdf#88337 tdf#89193: sw: add missing SwXPageStyle properties".

Change-Id: Id62e300ba951bcb5d623098def7cf3d9d8b16e93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205479
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
László Németh
2026-05-22 01:58:55 +02:00
parent 764083f269
commit df0f3bebee
2 changed files with 38 additions and 1 deletions
+10
View File
@@ -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
+28 -1
View File
@@ -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<Color> 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()
{