Bug 1729236 - Don't use GetPaintRect for CreateWebRenderCommands. r=jrmuizel

WebRender prefers to know the full bounds of the primitive, since it makes invalidation easier (and doesn't increase the size of the commands we send).

Differential Revision: https://phabricator.services.mozilla.com/D124588
This commit is contained in:
Matt Woodrow 2021-09-06 03:42:25 +00:00
Родитель c701e5f6e9
Коммит 87fc1d4890
5 изменённых файлов: 30 добавлений и 19 удалений

Просмотреть файл

@ -287,8 +287,9 @@ bool nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
LayoutDeviceRect::FromAppUnits(shadowRect, appUnitsPerDevPixel);
wr::LayoutRect deviceBoxRect = wr::ToLayoutRect(deviceBox);
LayoutDeviceRect clipRect =
LayoutDeviceRect::FromAppUnits(GetPaintRect(), appUnitsPerDevPixel);
bool dummy;
LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
GetBounds(aDisplayListBuilder, &dummy), appUnitsPerDevPixel);
wr::LayoutRect deviceClipRect = wr::ToLayoutRect(clipRect);
bool hasBorderRadius;
@ -511,10 +512,11 @@ bool nsDisplayButtonForeground::CreateWebRenderCommands(
nsDisplayListBuilder* aDisplayListBuilder) {
Maybe<nsCSSBorderRenderer> br;
bool borderIsEmpty = false;
bool dummy;
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
br = mBFR->CreateInnerFocusBorderRenderer(aDisplayListBuilder,
mFrame->PresContext(), nullptr,
GetPaintRect(), r, &borderIsEmpty);
br = mBFR->CreateInnerFocusBorderRenderer(
aDisplayListBuilder, mFrame->PresContext(), nullptr,
GetBounds(aDisplayListBuilder, &dummy), r, &borderIsEmpty);
if (!br) {
return borderIsEmpty;

Просмотреть файл

@ -74,8 +74,10 @@ bool nsDisplayColumnRule::CreateWebRenderCommands(
RefPtr<gfxContext> screenRefCtx = gfxContext::CreateOrNull(
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget().get());
bool dummy;
static_cast<nsColumnSetFrame*>(mFrame)->CreateBorderRenderers(
mBorderRenderers, screenRefCtx, GetPaintRect(), ToReferenceFrame());
mBorderRenderers, screenRefCtx, GetBounds(aDisplayListBuilder, &dummy),
ToReferenceFrame());
if (mBorderRenderers.IsEmpty()) {
return true;

Просмотреть файл

@ -728,11 +728,13 @@ ImgDrawResult nsCSSRendering::CreateWebRenderCommandsForBorderWithStyleBorder(
flags |= nsImageRenderer::FLAG_SYNC_DECODE_IMAGES;
}
bool dummy;
image::ImgDrawResult result;
Maybe<nsCSSBorderImageRenderer> bir =
nsCSSBorderImageRenderer::CreateBorderImageRenderer(
aForFrame->PresContext(), aForFrame, aBorderArea, aStyleBorder,
aItem->GetPaintRect(), aForFrame->GetSkipSides(), flags, &result);
aItem->GetBounds(aDisplayListBuilder, &dummy),
aForFrame->GetSkipSides(), flags, &result);
if (!bir) {
// We aren't ready. Try to fallback to the null border image if present but

Просмотреть файл

@ -3610,10 +3610,12 @@ bool nsDisplayBackgroundImage::CreateWebRenderCommands(
}
CheckForBorderItem(this, mImageFlags);
bool dummy;
nsCSSRendering::PaintBGParams params =
nsCSSRendering::PaintBGParams::ForSingleLayer(
*StyleFrame()->PresContext(), GetPaintRect(), mBackgroundRect,
StyleFrame(), mImageFlags, mLayer, CompositionOp::OP_OVER, mOpacity);
*StyleFrame()->PresContext(), GetBounds(aDisplayListBuilder, &dummy),
mBackgroundRect, StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER, mOpacity);
params.bgClipRect = &mBounds;
ImgDrawResult result =
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(
@ -4271,10 +4273,11 @@ bool nsDisplayOutline::CreateWebRenderCommands(
StyleAppearance::FocusOutline, rect);
}
bool dummy;
Maybe<nsCSSBorderRenderer> borderRenderer =
nsCSSRendering::CreateBorderRendererForNonThemedOutline(
pc, /* aDrawTarget = */ nullptr, mFrame, GetPaintRect(), rect,
mFrame->Style());
pc, /* aDrawTarget = */ nullptr, mFrame,
GetBounds(aDisplayListBuilder, &dummy), rect, mFrame->Style());
if (!borderRenderer) {
// No border renderer means "there is no outline".
@ -8307,16 +8310,16 @@ void nsDisplayMasksAndClipPaths::PaintWithContentsPaintCallback(
// region of the target frame and its out-of-flow and inflow descendants.
gfxContext* context = aCtx;
Rect bounds = NSRectToRect(GetPaintRect(),
Rect bounds = NSRectToRect(GetPaintRect(aBuilder, aCtx),
mFrame->PresContext()->AppUnitsPerDevPixel());
bounds.RoundOut();
context->Clip(bounds);
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
SVGIntegrationUtils::PaintFramesParams params(*aCtx, mFrame, GetPaintRect(),
borderArea, aBuilder, nullptr,
mHandleOpacity, imgParams);
SVGIntegrationUtils::PaintFramesParams params(
*aCtx, mFrame, GetPaintRect(aBuilder, aCtx), borderArea, aBuilder,
nullptr, mHandleOpacity, imgParams);
ComputeMaskGeometry(params);
@ -8710,9 +8713,9 @@ void nsDisplayFilters::PaintWithContentsPaintCallback(
const std::function<void(gfxContext* aContext)>& aPaintChildren) {
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
SVGIntegrationUtils::PaintFramesParams params(*aCtx, mFrame, GetPaintRect(),
borderArea, aBuilder, nullptr,
mHandleOpacity, imgParams);
SVGIntegrationUtils::PaintFramesParams params(
*aCtx, mFrame, GetPaintRect(aBuilder, aCtx), borderArea, aBuilder,
nullptr, mHandleOpacity, imgParams);
gfxPoint userSpaceToFrameSpaceOffset =
SVGIntegrationUtils::GetOffsetToUserSpaceInDevPx(mFrame, params);

Просмотреть файл

@ -7567,8 +7567,10 @@ bool nsDisplayTableBorderCollapse::CreateWebRenderCommands(
const StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) {
bool dummy;
static_cast<nsTableFrame*>(mFrame)->CreateWebRenderCommandsForBCBorders(
aBuilder, aSc, GetPaintRect(), ToReferenceFrame());
aBuilder, aSc, GetBounds(aDisplayListBuilder, &dummy),
ToReferenceFrame());
return true;
}