Bug 769514 - Kill the Mac bitmap fallback code in nsSVGOuterSVGFrame. r=roc.

This commit is contained in:
Jonathan Watt 2012-07-05 17:18:03 +02:00
parent e5c4fa82d7
commit 379c18f4f5
2 changed files with 6 additions and 67 deletions

View File

@ -109,9 +109,6 @@ nsSVGOuterSVGFrame::nsSVGOuterSVGFrame(nsStyleContext* aContext)
: nsSVGOuterSVGFrameBase(aContext)
, mFullZoom(0)
, mViewportInitialized(false)
#ifdef XP_MACOSX
, mEnableBitmapFallback(false)
#endif
, mIsRootContent(false)
{
// Outer-<svg> has CSS layout, so remove this bit:
@ -490,64 +487,19 @@ nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder,
PRTime start = PR_Now();
#endif
aContext->PushState();
nsSVGOuterSVGFrame *frame = static_cast<nsSVGOuterSVGFrame*>(mFrame);
#ifdef XP_MACOSX
if (frame->BitmapFallbackEnabled()) {
// nquartz fallback paths, which svg tends to trigger, need
// a non-window context target
aContext->ThebesContext()->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
}
#endif
nsRect viewportRect =
frame->GetContentRectRelativeToSelf() + ToReferenceFrame();
mFrame->GetContentRectRelativeToSelf() + ToReferenceFrame();
nsRect clipRect = mVisibleRect.Intersect(viewportRect);
aContext->PushState();
aContext->IntersectClip(clipRect);
aContext->Translate(viewportRect.TopLeft());
frame->Paint(aBuilder, aContext, clipRect - viewportRect.TopLeft());
#ifdef XP_MACOSX
if (frame->BitmapFallbackEnabled()) {
// show the surface we pushed earlier for fallbacks
aContext->ThebesContext()->PopGroupToSource();
aContext->ThebesContext()->Paint();
}
if (aContext->ThebesContext()->HasError() && !frame->BitmapFallbackEnabled()) {
frame->SetBitmapFallbackEnabled(true);
// It's not really clear what area to invalidate here. We might have
// stuffed up rendering for the entire window in this paint pass,
// so we can't just invalidate our own rect. Invalidate everything
// in sight.
// This won't work for printing, by the way, but failure to print the
// odd document is probably no worse than printing horribly for all
// documents. Better to fix things so we don't need fallback.
nsIFrame* ancestor = frame;
PRUint32 flags = 0;
while (true) {
nsIFrame* next = nsLayoutUtils::GetCrossDocParentFrame(ancestor);
if (!next)
break;
if (ancestor->GetParent() != next) {
// We're crossing a document boundary. Logically, the invalidation is
// being triggered by a subdocument of the root document. This will
// prevent an untrusted root document being told about invalidation
// that happened because a child was using SVG...
flags |= nsIFrame::INVALIDATE_CROSS_DOC;
}
ancestor = next;
}
ancestor->InvalidateWithFlags(nsRect(nsPoint(0, 0), ancestor->GetSize()), flags);
}
#endif
mFrame->Paint(aBuilder, aContext, clipRect - viewportRect.TopLeft());
aContext->PopState();
NS_ASSERTION(!aContext->ThebesContext()->HasError(), "Cairo in error state");
#if defined(DEBUG) && defined(SVG_DEBUG_PAINT_TIMING)
PRTime end = PR_Now();
printf("SVG Paint Timing: %f ms\n", (end-start)/1000.0);

View File

@ -95,16 +95,6 @@ public:
virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const;
#ifdef XP_MACOSX
bool BitmapFallbackEnabled() const {
return mEnableBitmapFallback;
}
void SetBitmapFallbackEnabled(bool aVal) {
NS_NOTREACHED("don't think me need this any more"); // comment in bug 732429 if we do
mEnableBitmapFallback = aVal;
}
#endif
/**
* Return true only if the height is unspecified (defaulting to 100%) or else
* the height is explicitly set to a percentage value no greater than 100%.
@ -135,9 +125,6 @@ protected:
float mFullZoom;
bool mViewportInitialized;
#ifdef XP_MACOSX
bool mEnableBitmapFallback;
#endif
bool mIsRootContent;
};