зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1729236 - Don't use GetPaintRect for painting text. r=jrmuizel
Text is the exception, where clipping the WR commands to the paint rect can let us reduce the size sent. We want to avoid this when doing fallback painting, since we don't want to have to track paint rect changes for invalidation. Differential Revision: https://phabricator.services.mozilla.com/D124589
This commit is contained in:
Родитель
3be3d71f55
Коммит
9e33e350cd
|
@ -7720,6 +7720,8 @@ nsDisplayText::nsDisplayText(nsDisplayListBuilder* aBuilder,
|
|||
mBounds = mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||
// Bug 748228
|
||||
mBounds.Inflate(mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
mVisibleRect = aBuilder->GetVisibleRect() +
|
||||
aBuilder->GetCurrentFrameOffsetToReferenceFrame();
|
||||
}
|
||||
|
||||
bool nsDisplayText::CanApplyOpacity(WebRenderLayerManager* aManager,
|
||||
|
@ -7743,7 +7745,10 @@ bool nsDisplayText::CanApplyOpacity(WebRenderLayerManager* aManager,
|
|||
|
||||
void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||
AUTO_PROFILER_LABEL("nsDisplayText::Paint", GRAPHICS);
|
||||
RenderToContext(aCtx, aBuilder);
|
||||
// We don't pass mVisibleRect here, since this can be called from within
|
||||
// the WebRender fallback painting path, and we don't want to issue
|
||||
// recorded commands that are dependent on the visible/building rect.
|
||||
RenderToContext(aCtx, aBuilder, GetPaintRect(aBuilder, aCtx));
|
||||
}
|
||||
|
||||
bool nsDisplayText::CreateWebRenderCommands(
|
||||
|
@ -7793,7 +7798,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
|||
// ::selected and ::inctive-selected pseudo-selectors. So don't do this
|
||||
// optimization if we have shadows or a selection.
|
||||
if (!(f->IsSelected() || f->StyleText()->HasTextShadow())) {
|
||||
nsRect visible = GetPaintRect();
|
||||
nsRect visible = mVisibleRect;
|
||||
visible.Inflate(3 * appUnitsPerDevPixel);
|
||||
bounds = bounds.Intersect(visible);
|
||||
}
|
||||
|
@ -7803,7 +7808,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
|||
|
||||
aBuilder.StartGroup(this);
|
||||
|
||||
RenderToContext(textDrawer, aDisplayListBuilder,
|
||||
RenderToContext(textDrawer, aDisplayListBuilder, mVisibleRect,
|
||||
aBuilder.GetInheritedOpacity(), true);
|
||||
const bool result = textDrawer->GetTextDrawer()->Finish();
|
||||
|
||||
|
@ -7818,7 +7823,8 @@ bool nsDisplayText::CreateWebRenderCommands(
|
|||
|
||||
void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
float aOpacity, bool aIsRecording) {
|
||||
const nsRect& aVisibleRect, float aOpacity,
|
||||
bool aIsRecording) {
|
||||
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
|
||||
|
||||
// Add 1 pixel of dirty area around mVisibleRect to allow us to paint
|
||||
|
@ -7827,7 +7833,7 @@ void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
|||
// extents.
|
||||
auto A2D = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect extraVisible =
|
||||
LayoutDeviceRect::FromAppUnits(GetPaintRect(), A2D);
|
||||
LayoutDeviceRect::FromAppUnits(aVisibleRect, A2D);
|
||||
extraVisible.Inflate(1);
|
||||
|
||||
gfxRect pixelVisible(extraVisible.x, extraVisible.y, extraVisible.width,
|
||||
|
|
|
@ -6640,7 +6640,8 @@ class nsDisplayText final : public nsPaintedDisplayItem {
|
|||
nsRegion* aInvalidRegion) const final;
|
||||
|
||||
void RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
|
||||
float aOpacity = 1.0f, bool aIsRecording = false);
|
||||
const nsRect& aVisibleRect, float aOpacity = 1.0f,
|
||||
bool aIsRecording = false);
|
||||
|
||||
bool CanApplyOpacity(WebRenderLayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder) const final;
|
||||
|
@ -6685,6 +6686,7 @@ class nsDisplayText final : public nsPaintedDisplayItem {
|
|||
|
||||
private:
|
||||
nsRect mBounds;
|
||||
nsRect mVisibleRect;
|
||||
|
||||
// Lengths measured from the visual inline start and end sides
|
||||
// (i.e. left and right respectively in horizontal writing modes,
|
||||
|
|
|
@ -266,7 +266,8 @@ void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
|
|||
// Paint the text shadow before doing any foreground stuff
|
||||
nsRect drawRect =
|
||||
static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
|
||||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect, GetPaintRect(),
|
||||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect,
|
||||
GetPaintRect(aBuilder, aCtx),
|
||||
mFrame->StyleText()->mColor.ToColor(),
|
||||
PaintTextShadowCallback, (void*)this);
|
||||
|
||||
|
@ -276,7 +277,8 @@ void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
|
|||
void nsDisplayXULTextBox::PaintTextToContext(gfxContext* aCtx, nsPoint aOffset,
|
||||
const nscolor* aColor) {
|
||||
static_cast<nsTextBoxFrame*>(mFrame)->PaintTitle(
|
||||
*aCtx, GetPaintRect(), ToReferenceFrame() + aOffset, aColor);
|
||||
*aCtx, mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame(),
|
||||
ToReferenceFrame() + aOffset, aColor);
|
||||
}
|
||||
|
||||
bool nsDisplayXULTextBox::CreateWebRenderCommands(
|
||||
|
|
Загрузка…
Ссылка в новой задаче