зеркало из 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:
Родитель
3cdf8e4aeb
Коммит
42dfbb387c
|
@ -7770,6 +7770,8 @@ nsDisplayText::nsDisplayText(nsDisplayListBuilder* aBuilder,
|
||||||
mBounds = mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame();
|
mBounds = mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||||
// Bug 748228
|
// Bug 748228
|
||||||
mBounds.Inflate(mFrame->PresContext()->AppUnitsPerDevPixel());
|
mBounds.Inflate(mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||||
|
mVisibleRect = aBuilder->GetVisibleRect() +
|
||||||
|
aBuilder->GetCurrentFrameOffsetToReferenceFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsDisplayText::CanApplyOpacity() const {
|
bool nsDisplayText::CanApplyOpacity() const {
|
||||||
|
@ -7795,7 +7797,10 @@ void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||||
|
|
||||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||||
IsSubpixelAADisabled());
|
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(
|
bool nsDisplayText::CreateWebRenderCommands(
|
||||||
|
@ -7845,7 +7850,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
||||||
// ::selected and ::inctive-selected pseudo-selectors. So don't do this
|
// ::selected and ::inctive-selected pseudo-selectors. So don't do this
|
||||||
// optimization if we have shadows or a selection.
|
// optimization if we have shadows or a selection.
|
||||||
if (!(f->IsSelected() || f->StyleText()->HasTextShadow())) {
|
if (!(f->IsSelected() || f->StyleText()->HasTextShadow())) {
|
||||||
nsRect visible = GetPaintRect();
|
nsRect visible = mVisibleRect;
|
||||||
visible.Inflate(3 * appUnitsPerDevPixel);
|
visible.Inflate(3 * appUnitsPerDevPixel);
|
||||||
bounds = bounds.Intersect(visible);
|
bounds = bounds.Intersect(visible);
|
||||||
}
|
}
|
||||||
|
@ -7855,7 +7860,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
||||||
|
|
||||||
aBuilder.StartGroup(this);
|
aBuilder.StartGroup(this);
|
||||||
|
|
||||||
RenderToContext(textDrawer, aDisplayListBuilder, true);
|
RenderToContext(textDrawer, aDisplayListBuilder, mVisibleRect, true);
|
||||||
const bool result = textDrawer->GetTextDrawer()->Finish();
|
const bool result = textDrawer->GetTextDrawer()->Finish();
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -7869,6 +7874,7 @@ bool nsDisplayText::CreateWebRenderCommands(
|
||||||
|
|
||||||
void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsRect& aVisibleRect,
|
||||||
bool aIsRecording) {
|
bool aIsRecording) {
|
||||||
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
|
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
|
||||||
|
|
||||||
|
@ -7878,7 +7884,7 @@ void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
||||||
// extents.
|
// extents.
|
||||||
auto A2D = mFrame->PresContext()->AppUnitsPerDevPixel();
|
auto A2D = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||||
LayoutDeviceRect extraVisible =
|
LayoutDeviceRect extraVisible =
|
||||||
LayoutDeviceRect::FromAppUnits(GetPaintRect(), A2D);
|
LayoutDeviceRect::FromAppUnits(aVisibleRect, A2D);
|
||||||
extraVisible.Inflate(1);
|
extraVisible.Inflate(1);
|
||||||
|
|
||||||
gfxRect pixelVisible(extraVisible.x, extraVisible.y, extraVisible.width,
|
gfxRect pixelVisible(extraVisible.x, extraVisible.y, extraVisible.width,
|
||||||
|
|
|
@ -6794,7 +6794,7 @@ class nsDisplayText final : public nsPaintedDisplayItem {
|
||||||
nsRegion* aInvalidRegion) const final;
|
nsRegion* aInvalidRegion) const final;
|
||||||
|
|
||||||
void RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
|
void RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
|
||||||
bool aIsRecording = false);
|
const nsRect& aVisibleRect, bool aIsRecording = false);
|
||||||
|
|
||||||
bool CanApplyOpacity() const final;
|
bool CanApplyOpacity() const final;
|
||||||
|
|
||||||
|
@ -6846,6 +6846,7 @@ class nsDisplayText final : public nsPaintedDisplayItem {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsRect mBounds;
|
nsRect mBounds;
|
||||||
|
nsRect mVisibleRect;
|
||||||
float mOpacity;
|
float mOpacity;
|
||||||
|
|
||||||
// Lengths measured from the visual inline start and end sides
|
// 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
|
// Paint the text shadow before doing any foreground stuff
|
||||||
nsRect drawRect =
|
nsRect drawRect =
|
||||||
static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
|
static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
|
||||||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect, GetPaintRect(),
|
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect,
|
||||||
|
GetPaintRect(aBuilder, aCtx),
|
||||||
mFrame->StyleText()->mColor.ToColor(),
|
mFrame->StyleText()->mColor.ToColor(),
|
||||||
PaintTextShadowCallback, (void*)this);
|
PaintTextShadowCallback, (void*)this);
|
||||||
|
|
||||||
|
@ -279,7 +280,8 @@ void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
void nsDisplayXULTextBox::PaintTextToContext(gfxContext* aCtx, nsPoint aOffset,
|
void nsDisplayXULTextBox::PaintTextToContext(gfxContext* aCtx, nsPoint aOffset,
|
||||||
const nscolor* aColor) {
|
const nscolor* aColor) {
|
||||||
static_cast<nsTextBoxFrame*>(mFrame)->PaintTitle(
|
static_cast<nsTextBoxFrame*>(mFrame)->PaintTitle(
|
||||||
*aCtx, GetPaintRect(), ToReferenceFrame() + aOffset, aColor);
|
*aCtx, mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame(),
|
||||||
|
ToReferenceFrame() + aOffset, aColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsDisplayXULTextBox::CreateWebRenderCommands(
|
bool nsDisplayXULTextBox::CreateWebRenderCommands(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче