mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1064082 - Get rid of nsRenderingContext's PushState and PopState methods. r=Bas
This commit is contained in:
parent
604f621c00
commit
f0b7de4fce
@ -85,18 +85,6 @@ nsRenderingContext::Init(nsDeviceContext* aContext,
|
||||
// graphics state
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::PushState()
|
||||
{
|
||||
mThebes->Save();
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContext::PopState()
|
||||
{
|
||||
mThebes->Restore();
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContext::IntersectClip(const nsRect& aRect)
|
||||
{
|
||||
|
@ -51,8 +51,6 @@ public:
|
||||
|
||||
// Graphics state
|
||||
|
||||
void PushState(void);
|
||||
void PopState(void);
|
||||
void IntersectClip(const nsRect& aRect);
|
||||
void SetClip(const nsIntRegion& aRegion);
|
||||
void SetLineStyle(nsLineStyle aLineStyle);
|
||||
|
@ -3031,11 +3031,11 @@ nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder,
|
||||
js::ProfileEntry::Category::GRAPHICS);
|
||||
|
||||
for (uint32_t i = 0; i < rects.Length(); ++i) {
|
||||
aCtx->PushState();
|
||||
aCtx->ThebesContext()->Save();
|
||||
aCtx->IntersectClip(rects[i]);
|
||||
nsCSSRendering::PaintBoxShadowInner(presContext, *aCtx, mFrame,
|
||||
borderRect, rects[i]);
|
||||
aCtx->PopState();
|
||||
aCtx->ThebesContext()->Restore();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9968,7 +9968,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
||||
IndiReflowCounter * counter =
|
||||
(IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
|
||||
if (counter != nullptr && counter->mName.EqualsASCII(aName)) {
|
||||
aRenderingContext->PushState();
|
||||
aRenderingContext->ThebesContext()->Save();
|
||||
gfxPoint devPixelOffset =
|
||||
nsLayoutUtils::PointToGfxPoint(aOffset,
|
||||
aPresContext->AppUnitsPerDevPixel());
|
||||
@ -10022,7 +10022,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
||||
aRenderingContext->SetColor(color);
|
||||
aRenderingContext->DrawString(buf, strlen(buf), x,y);
|
||||
|
||||
aRenderingContext->PopState();
|
||||
aRenderingContext->ThebesContext()->Restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1494,7 +1494,7 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || sFocused != this)
|
||||
return;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
nsRect clipRect = mDisplayFrame->GetRect() + aPt;
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
|
||||
@ -1518,7 +1518,7 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
|
||||
aRenderingContext.DrawLine(clipRect.BottomRight(), clipRect.BottomLeft());
|
||||
aRenderingContext.DrawLine(clipRect.BottomLeft(), clipRect.TopLeft());
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -219,12 +219,12 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
clipRect.width = legendRect.x - rect.x;
|
||||
clipRect.height = topBorder;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
|
||||
|
||||
// draw right side
|
||||
@ -233,12 +233,12 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
clipRect.width = rect.XMost() - legendRect.XMost();
|
||||
clipRect.height = topBorder;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
|
||||
|
||||
// draw bottom
|
||||
@ -246,12 +246,12 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
clipRect.y += topBorder;
|
||||
clipRect.height = mRect.height - (yoff + topBorder);
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
} else {
|
||||
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
|
@ -1219,7 +1219,7 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
|
||||
// Clip so we don't render outside the inner rect
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(inner);
|
||||
|
||||
// Check if we should display image placeholders
|
||||
@ -1262,11 +1262,11 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
|
||||
inner.XMost() - size : inner.x;
|
||||
nscoord twoPX = nsPresContext::CSSPixelsToAppUnits(2);
|
||||
aRenderingContext.DrawRect(iconXPos, inner.y,size,size);
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.SetColor(NS_RGB(0xFF,0,0));
|
||||
aRenderingContext.FillEllipse(size/2 + iconXPos, size/2 + inner.y,
|
||||
size/2 - twoPX, size/2 - twoPX);
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
// Reduce the inner rect by the width of the icon, and leave an
|
||||
@ -1288,7 +1288,7 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
}
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -1298,14 +1298,14 @@ static void PaintDebugImageMap(nsIFrame* aFrame, nsRenderingContext* aCtx,
|
||||
nsRect inner = f->GetInnerArea() + aPt;
|
||||
|
||||
aCtx->SetColor(NS_RGB(0, 0, 0));
|
||||
aCtx->PushState();
|
||||
aCtx->ThebesContext()->Save();
|
||||
gfxPoint devPixelOffset =
|
||||
nsLayoutUtils::PointToGfxPoint(inner.TopLeft(),
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
aCtx->ThebesContext()->SetMatrix(
|
||||
aCtx->ThebesContext()->CurrentMatrix().Translate(devPixelOffset));
|
||||
f->GetImageMap()->Draw(aFrame, *aCtx);
|
||||
aCtx->PopState();
|
||||
aCtx->ThebesContext()->Restore();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1472,7 +1472,7 @@ nsImageFrame::PaintImage(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
||||
|
||||
nsImageMap* map = GetImageMap();
|
||||
if (nullptr != map) {
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
gfxPoint devPixelOffset =
|
||||
nsLayoutUtils::PointToGfxPoint(inner.TopLeft(),
|
||||
PresContext()->AppUnitsPerDevPixel());
|
||||
@ -1484,7 +1484,7 @@ nsImageFrame::PaintImage(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
||||
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
|
||||
aRenderingContext.SetLineStyle(nsLineStyle_kDotted);
|
||||
map->Draw(this, aRenderingContext);
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,11 +373,11 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
|
||||
// set up new clip and draw the text
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
aRenderingContext.IntersectClip(aRect);
|
||||
nsLayoutUtils::DrawString(this, &aRenderingContext, str.get(), str.Length(), nsPoint(x, y + aAscent));
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3147,9 +3147,9 @@ nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
|
||||
gfxMatrix::Translation(devPixelOffset);
|
||||
|
||||
aCtx->PushState();
|
||||
aCtx->ThebesContext()->Save();
|
||||
static_cast<SVGTextFrame*>(mFrame)->PaintSVG(aCtx, tm);
|
||||
aCtx->PopState();
|
||||
aCtx->ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -610,13 +610,13 @@ nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxPoint devPixelOffset =
|
||||
nsLayoutUtils::PointToGfxPoint(viewportRect.TopLeft(), appUnitsPerDevPixel);
|
||||
|
||||
aContext->PushState();
|
||||
aContext->ThebesContext()->Save();
|
||||
// We include the offset of our frame and a scale from device pixels to user
|
||||
// units (i.e. CSS px) in the matrix that we pass to our children):
|
||||
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
|
||||
gfxMatrix::Translation(devPixelOffset);
|
||||
nsSVGUtils::PaintFrameWithEffects(mFrame, aContext, tm, &contentAreaDirtyRect);
|
||||
aContext->PopState();
|
||||
aContext->ThebesContext()->Restore();
|
||||
|
||||
NS_ASSERTION(!aContext->ThebesContext()->HasError(), "Cairo in error state");
|
||||
|
||||
|
@ -107,11 +107,11 @@ nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxPoint devPixelOffset =
|
||||
nsLayoutUtils::PointToGfxPoint(offset, appUnitsPerDevPixel);
|
||||
|
||||
aCtx->PushState();
|
||||
aCtx->ThebesContext()->Save();
|
||||
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
|
||||
gfxMatrix::Translation(devPixelOffset);
|
||||
static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(aCtx, tm);
|
||||
aCtx->PopState();
|
||||
aCtx->ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -161,12 +161,12 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
clipRect.width = groupRect.x - rect.x;
|
||||
clipRect.height = border.top;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
|
||||
|
||||
// draw right side
|
||||
@ -175,12 +175,12 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
clipRect.width = rect.XMost() - groupRect.XMost();
|
||||
clipRect.height = border.top;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
|
||||
|
||||
|
||||
@ -190,12 +190,12 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
clipRect.y += border.top;
|
||||
clipRect.height = mRect.height - (yoff + border.top);
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(clipRect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
|
||||
} else {
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
|
@ -2816,7 +2816,7 @@ nsTreeBodyFrame::PaintTreeBody(nsRenderingContext& aRenderingContext,
|
||||
{
|
||||
// Update our available height and our page count.
|
||||
CalcInnerBox();
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
aRenderingContext.IntersectClip(mInnerBox + aPt);
|
||||
int32_t oldPageCount = mPageLength;
|
||||
if (!mHasFixedRowCount)
|
||||
@ -2875,7 +2875,7 @@ nsTreeBodyFrame::PaintTreeBody(nsRenderingContext& aRenderingContext,
|
||||
PaintDropFeedback(feedbackRect, PresContext(), aRenderingContext, aDirtyRect, aPt);
|
||||
}
|
||||
}
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
|
||||
@ -3195,7 +3195,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
|
||||
twistyContext->StyleMargin()->GetMargin(twistyMargin);
|
||||
twistyRect.Inflate(twistyMargin);
|
||||
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.ThebesContext()->Save();
|
||||
|
||||
const nsStyleBorder* borderStyle = lineContext->StyleBorder();
|
||||
nscolor color;
|
||||
@ -3244,7 +3244,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
|
||||
srcX -= mIndentation;
|
||||
}
|
||||
|
||||
aRenderingContext.PopState();
|
||||
aRenderingContext.ThebesContext()->Restore();
|
||||
}
|
||||
|
||||
// Always leave space for the twisty.
|
||||
|
Loading…
Reference in New Issue
Block a user