зеркало из 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:
Родитель
87fc1d4890
Коммит
d84885ee2a
|
@ -7770,6 +7770,8 @@ nsDisplayText::nsDisplayText(nsDisplayListBuilder* aBuilder,
|
|||
mBounds = mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||
// Bug 748228
|
||||
mBounds.Inflate(mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
mVisibleRect = aBuilder->GetVisibleRect() +
|
||||
aBuilder->GetCurrentFrameOffsetToReferenceFrame();
|
||||
}
|
||||
|
||||
bool nsDisplayText::CanApplyOpacity() const {
|
||||
|
@ -7795,7 +7797,10 @@ void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
|||
|
||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||
IsSubpixelAADisabled());
|
||||
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(
|
||||
|
@ -7845,7 +7850,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);
|
||||
}
|
||||
|
@ -7855,7 +7860,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
|||
|
||||
aBuilder.StartGroup(this);
|
||||
|
||||
RenderToContext(textDrawer, aDisplayListBuilder, true);
|
||||
RenderToContext(textDrawer, aDisplayListBuilder, mVisibleRect, true);
|
||||
const bool result = textDrawer->GetTextDrawer()->Finish();
|
||||
|
||||
if (result) {
|
||||
|
@ -7869,6 +7874,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
|||
|
||||
void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aVisibleRect,
|
||||
bool aIsRecording) {
|
||||
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
|
||||
|
||||
|
@ -7878,7 +7884,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,
|
||||
|
|
|
@ -6794,7 +6794,7 @@ class nsDisplayText final : public nsPaintedDisplayItem {
|
|||
nsRegion* aInvalidRegion) const final;
|
||||
|
||||
void RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
|
||||
bool aIsRecording = false);
|
||||
const nsRect& aVisibleRect, bool aIsRecording = false);
|
||||
|
||||
bool CanApplyOpacity() const final;
|
||||
|
||||
|
@ -6846,6 +6846,7 @@ class nsDisplayText final : public nsPaintedDisplayItem {
|
|||
|
||||
private:
|
||||
nsRect mBounds;
|
||||
nsRect mVisibleRect;
|
||||
float mOpacity;
|
||||
|
||||
// Lengths measured from the visual inline start and end sides
|
||||
|
|
|
@ -269,7 +269,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);
|
||||
|
||||
|
@ -279,7 +280,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(
|
||||
|
|
Загрузка…
Ссылка в новой задаче