Bug 848421. Part 1. Handle having no frame for the body element when determining the image filter to use for drawing the page background. r=roc

Just use nsCSSRendering::FindBackground like we do everywhere else for finding the background, it handles this case correctly. Although this function is used for other images besides backgrounds, when it is called on a canvas frame it can only be for a background image.
This commit is contained in:
Timothy Nikkel 2013-03-06 23:13:13 -06:00
parent 50e11d2f0a
commit 9142082cd4

View File

@ -3771,10 +3771,14 @@ GraphicsFilter
nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
{
GraphicsFilter defaultFilter = gfxPattern::FILTER_GOOD;
nsIFrame *frame = nsCSSRendering::IsCanvasFrame(aForFrame) ?
nsCSSRendering::FindBackgroundStyleFrame(aForFrame) : aForFrame;
nsStyleContext *sc;
if (nsCSSRendering::IsCanvasFrame(aForFrame)) {
nsCSSRendering::FindBackground(aForFrame->PresContext(), aForFrame, &sc);
} else {
sc = aForFrame->StyleContext();
}
switch (frame->StyleSVG()->mImageRendering) {
switch (sc->StyleSVG()->mImageRendering) {
case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
return gfxPattern::FILTER_FAST;
case NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY: