Merge backout of rev 86c8e18f20eb

This commit is contained in:
Boris Zbarsky 2009-04-09 11:55:47 -04:00
commit a5cdcbf037
4 changed files with 50 additions and 65 deletions

View File

@ -903,59 +903,7 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext,
return context;
}
// Returns true if aFrame is a canvas frame.
// We need to treat the viewport as canvas because, even though
// it does not actually paint a background, we need to get the right
// background style so we correctly detect transparent documents.
PRBool
nsCSSRendering::IsCanvasFrame(nsIFrame* aFrame)
{
nsIAtom* frameType = aFrame->GetType();
return frameType == nsGkAtoms::canvasFrame ||
frameType == nsGkAtoms::rootFrame ||
frameType == nsGkAtoms::pageFrame ||
frameType == nsGkAtoms::pageContentFrame ||
frameType == nsGkAtoms::viewportFrame;
}
nsIFrame*
nsCSSRendering::FindRootFrame(nsIFrame* aForFrame)
{
const nsStyleBackground* result = aForFrame->GetStyleBackground();
// Check if we need to do propagation from BODY rather than HTML.
if (result->IsTransparent()) {
nsIContent* content = aForFrame->GetContent();
// The root element content can't be null. We wouldn't know what
// frame to create for aFrame.
// Use |GetOwnerDoc| so it works during destruction.
if (content) {
nsIDocument* document = content->GetOwnerDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
if (htmlDoc) {
nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
// We need to null check the body node (bug 118829) since
// there are cases, thanks to the fix for bug 5569, where we
// will reflow a document with no body. In particular, if a
// SCRIPT element in the head blocks the parser and then has a
// SCRIPT that does "document.location.href = 'foo'", then
// nsParser::Terminate will call |DidBuildModel| methods
// through to the content sink, which will call |StartLayout|
// and thus |InitialReflow| on the pres shell. See bug 119351
// for the ugly details.
if (bodyContent) {
nsIFrame *bodyFrame = aForFrame->PresContext()->GetPresShell()->
GetPrimaryFrameFor(bodyContent);
if (bodyFrame) {
return bodyFrame;
}
}
}
}
}
return aForFrame;
}
/**
* |FindBackground| finds the correct style data to use to paint the
@ -986,10 +934,56 @@ nsCSSRendering::FindRootFrame(nsIFrame* aForFrame)
* whether the frame is the canvas frame, because PaintBackground must
* propagate that frame's background color to the view manager.
*/
// Returns true if aFrame is a canvas frame.
// We need to treat the viewport as canvas because, even though
// it does not actually paint a background, we need to get the right
// background style so we correctly detect transparent documents.
PRBool
nsCSSRendering::IsCanvasFrame(nsIFrame *aFrame)
{
nsIAtom* frameType = aFrame->GetType();
return frameType == nsGkAtoms::canvasFrame ||
frameType == nsGkAtoms::rootFrame ||
frameType == nsGkAtoms::pageFrame ||
frameType == nsGkAtoms::pageContentFrame ||
frameType == nsGkAtoms::viewportFrame;
}
const nsStyleBackground*
nsCSSRendering::FindRootFrameBackground(nsIFrame* aForFrame)
{
return FindRootFrame(aForFrame)->GetStyleBackground();
const nsStyleBackground* result = aForFrame->GetStyleBackground();
// Check if we need to do propagation from BODY rather than HTML.
if (result->IsTransparent()) {
nsIContent* content = aForFrame->GetContent();
// The root element content can't be null. We wouldn't know what
// frame to create for aForFrame.
// Use |GetOwnerDoc| so it works during destruction.
nsIDocument* document = content->GetOwnerDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
if (htmlDoc) {
nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
// We need to null check the body node (bug 118829) since
// there are cases, thanks to the fix for bug 5569, where we
// will reflow a document with no body. In particular, if a
// SCRIPT element in the head blocks the parser and then has a
// SCRIPT that does "document.location.href = 'foo'", then
// nsParser::Terminate will call |DidBuildModel| methods
// through to the content sink, which will call |StartLayout|
// and thus |InitialReflow| on the pres shell. See bug 119351
// for the ugly details.
if (bodyContent) {
nsIFrame *bodyFrame = aForFrame->PresContext()->GetPresShell()->
GetPrimaryFrameFor(bodyContent);
if (bodyFrame)
result = bodyFrame->GetStyleBackground();
}
}
}
return result;
}
inline void

View File

@ -118,11 +118,6 @@ struct nsCSSRendering {
const nsRect& aFocusRect,
nscolor aColor);
/**
* Gets the root frame for the frame
*/
static nsIFrame* FindRootFrame(nsIFrame* aForFrame);
/**
* @return PR_TRUE if |aFrame| is a canvas frame, in the CSS sense.
*/

View File

@ -2687,13 +2687,10 @@ nsLayoutUtils::GetClosestLayer(nsIFrame* aFrame)
}
gfxPattern::GraphicsFilter
nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aFrame)
{
#ifdef MOZ_SVG
nsIFrame *frame = nsCSSRendering::IsCanvasFrame(aForFrame) ?
nsCSSRendering::FindRootFrame(aForFrame) : aForFrame;
switch (frame->GetStyleSVG()->mImageRendering) {
switch (aFrame->GetStyleSVG()->mImageRendering) {
case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
return gfxPattern::FILTER_FAST;
case NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY:

View File

@ -1,2 +1 @@
== background-image-zoom-1.html background-image-zoom-1-ref.html
== image-zoom-1.html image-zoom-1-ref.html
== image-zoom-1.html image-zoom-1-ref.html