Bug 525751. When using a subdocument frame as a fallback for drawing canvas background color override the canvas frame check. r=roc a=roc

--HG--
extra : rebase_source : 6719372b7404a598a4ce1c1f5190a4f86d0d896b
This commit is contained in:
Timothy Nikkel 2009-12-01 02:49:53 -06:00
parent b7312afc03
commit 5b698c6db8
3 changed files with 17 additions and 12 deletions

View File

@ -122,10 +122,10 @@ typedef struct CapturingContentInfo {
mAllowed(PR_FALSE), mRetargetToElement(PR_FALSE), mContent(nsnull) { }
} CapturingContentInfo;
// 7190dd0b-4278-4ad6-bee5-6defef4c5647
#define NS_IPRESSHELL_IID \
{ 0x7190dd0b, 0x4278, 0x4ad6, \
{ 0xbe, 0xe5, 0x6d, 0xef, 0xef, 0x4c, 0x56, 0x47 } }
// 4e8724b5-14f9-4bb0-b5a0-24041d653c9f
#define NS_IPRESSHELL_IID \
{ 0x4e8724b5, 0x14f9, 0x4bb0, \
{ 0xb5, 0xa0, 0x24, 0x04, 0x1d, 0x65, 0x3c, 0x9f } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -884,15 +884,17 @@ public:
/**
* Add a solid color item to the bottom of aList with frame aFrame and
* bounds aBounds. Checks first if this needs to be done by checking if
* aFrame is a canvas frame. If aBounds is null (the default) then the
* bounds will be derived from the frame. aBackstopColor is composed behind
* the background color of the canvas, it is transparent by default.
* aFrame is a canvas frame (if aForceDraw is true then this check is
* skipped). If aBounds is null (the default) then the bounds will be derived
* from the frame. aBackstopColor is composed behind the background color of
* the canvas, it is transparent by default.
*/
virtual nsresult AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList,
nsIFrame* aFrame,
nsRect* aBounds = nsnull,
nscolor aBackstopColor = NS_RGBA(0,0,0,0)) = 0;
nscolor aBackstopColor = NS_RGBA(0,0,0,0),
PRBool aForceDraw = PR_FALSE) = 0;
void ObserveNativeAnonMutationsForPrint(PRBool aObserve)
{

View File

@ -902,7 +902,8 @@ public:
nsDisplayList& aList,
nsIFrame* aFrame,
nsRect* aBounds,
nscolor aBackstopColor);
nscolor aBackstopColor,
PRBool aForceDraw);
protected:
virtual ~PresShell();
@ -5795,7 +5796,8 @@ nsresult PresShell::AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList,
nsIFrame* aFrame,
nsRect* aBounds,
nscolor aBackstopColor)
nscolor aBackstopColor,
PRBool aForceDraw)
{
// We don't want to add an item for the canvas background color if the frame
// (sub)tree we are painting doesn't include any canvas frames. There isn't
@ -5803,7 +5805,7 @@ nsresult PresShell::AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
// (sub)tree we are painting is a canvas frame that should cover us in all
// cases (it will usually be a viewport frame when we have a canvas frame in
// the (sub)tree).
if (!nsCSSRendering::IsCanvasFrame(aFrame))
if (!aForceDraw && !nsCSSRendering::IsCanvasFrame(aFrame))
return NS_OK;
nscolor bgcolor = NS_ComposeColors(aBackstopColor, mCanvasBackgroundColor);

View File

@ -391,7 +391,8 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (!aBuilder->IsForEventDelivery()) {
// Add the canvas background color.
rv = presShell->AddCanvasBackgroundColorItem(
*aBuilder, childItems, f ? f : this, &shellBounds);
*aBuilder, childItems, f ? f : this, &shellBounds, NS_RGBA(0,0,0,0),
PR_TRUE);
}
if (f && NS_SUCCEEDED(rv)) {