diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 5df96b23353..ae086de9a10 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -1191,9 +1191,10 @@ PresShell::FindFrameWithContent(nsIContent* aContent) //nsIViewObserver -NS_IMETHODIMP PresShell :: Paint(nsIView *aView, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) +NS_IMETHODIMP +PresShell::Paint(nsIView *aView, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect) { void* clientData; nsIFrame* frame; @@ -1205,7 +1206,12 @@ NS_IMETHODIMP PresShell :: Paint(nsIView *aView, frame = (nsIFrame *)clientData; if (nsnull != frame) { - rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect); + rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Underlay); + rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Content); + rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Overlay); #ifdef NS_DEBUG // Draw a border around the frame if (nsIFrame::GetShowFrameBorders()) { @@ -1219,9 +1225,10 @@ NS_IMETHODIMP PresShell :: Paint(nsIView *aView, return rv; } -NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView, - nsGUIEvent* aEvent, - nsEventStatus& aEventStatus) +NS_IMETHODIMP +PresShell::HandleEvent(nsIView *aView, + nsGUIEvent* aEvent, + nsEventStatus& aEventStatus) { void* clientData; nsIFrame* frame; @@ -1281,7 +1288,8 @@ NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView, return rv; } -NS_IMETHODIMP PresShell :: Scrolled(nsIView *aView) +NS_IMETHODIMP +PresShell::Scrolled(nsIView *aView) { void* clientData; nsIFrame* frame; @@ -1300,7 +1308,8 @@ NS_IMETHODIMP PresShell :: Scrolled(nsIView *aView) return rv; } -NS_IMETHODIMP PresShell :: ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight) +NS_IMETHODIMP +PresShell::ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight) { return ResizeReflow(aWidth, aHeight); } @@ -1311,8 +1320,6 @@ NS_IMETHODIMP PresShell :: ResizeReflow(nsIView *aView, nscoord aWidth, nscoord #include "nsIScrollableView.h" #include "nsIDeviceContext.h" #include "nsIURL.h" -//#include "nsICSSParser.h" -//#include "nsIStyleSheet.h" static NS_DEFINE_IID(kViewManagerCID, NS_VIEW_MANAGER_CID); static NS_DEFINE_IID(kIViewManagerIID, NS_IVIEWMANAGER_IID); diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 473732ca4c6..081562821be 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -112,6 +112,14 @@ typedef PRUint32 nsFrameState; //---------------------------------------------------------------------- +enum nsFramePaintLayer { + eFramePaintLayer_Underlay = 0, + eFramePaintLayer_Content = 1, + eFramePaintLayer_Overlay = 2, +}; + +//---------------------------------------------------------------------- + /** * A frame in the layout model. This interface is supported by all frame * objects. @@ -262,11 +270,14 @@ public: NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling) = 0; /** - * Painting + * Paint is responsible for painting the a frame. The aWhichLayer + * argument indicates which layer of painting should be done during + * the call. */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) = 0; + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) = 0; /** * Event handling of GUI events. diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index 87df47b3fe6..37692d7eebf 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -70,7 +70,8 @@ public: NS_METHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("FieldSet", aResult); @@ -172,42 +173,45 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsFieldSetFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Paint our background and border - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); + if (eFramePaintLayer_Underlay == aWhichLayer) { + // Paint our background and border + const nsStyleDisplay* disp = + (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - if (disp->mVisible && mRect.width && mRect.height) { - PRIntn skipSides = GetSkipSides(); - const nsStyleColor* color = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* spacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + if (disp->mVisible && mRect.width && mRect.height) { + PRIntn skipSides = GetSkipSides(); + const nsStyleColor* color = + (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* spacing = + (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - nsRect backgroundRect(0, 0, mRect.width, mRect.height); - // XXX our parent doesn't account for top and bottom margins yet, if we are inline - if (mInline) { - nsMargin margin; - spacing->CalcMarginFor(this, margin); - nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - margin.top - - margin.bottom - mTopBorderOffset); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); - } else { - nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - mTopBorderOffset); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); - } + nsRect backgroundRect(0, 0, mRect.width, mRect.height); + // XXX our parent doesn't account for top and bottom margins yet, if we are inline + if (mInline) { + nsMargin margin; + spacing->CalcMarginFor(this, margin); + nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - margin.top - + margin.bottom - mTopBorderOffset); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); + } else { + nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - mTopBorderOffset); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); + } + } } - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { nsIView* view; GetView(view); if (nsnull != view) { diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 814030fdeb6..5bfbf41062d 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -147,29 +147,19 @@ nsFormControlFrame::SetClickPoint(nscoord aX, nscoord aY) // they could be blended, and bordered, and so on... NS_METHOD nsFormControlFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - - if (disp->mVisible) { - // Make sure the widget is visible if it isn't currently visible -// if (PR_FALSE == mDidInit) { -// PostCreateWidget(&aPresContext); -// mDidInit = PR_TRUE; -// } - // Point borders/padding if any - return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); - } - return NS_OK; + return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } void nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext, - const nsHTMLReflowState& aReflowState, - nsHTMLReflowMetrics& aDesiredLayoutSize, - nsSize& aDesiredWidgetSize) + const nsHTMLReflowState& aReflowState, + nsHTMLReflowMetrics& aDesiredLayoutSize, + nsSize& aDesiredWidgetSize) { // get the css size and let the frame use or override it nsSize styleSize; diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index 9e47311ef17..f022c1eb279 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -111,7 +111,8 @@ public: */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 58cd203d85a..e7a55ec17ed 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -69,7 +69,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -526,10 +527,14 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - nsresult result = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); - if (NS_OK == result) { + nsresult result = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + if (NS_FAILED(result)) { + return result; + } + if (eFramePaintLayer_Overlay == aWhichLayer) { if (mGotFocus) { // draw dashed line to indicate selection, XXX don't calc rect every time const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); @@ -555,8 +560,8 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext, borderColors[i] = black; } nsCSSRendering::DrawDashedSides(0, aRenderingContext, borderStyles, borderColors, outside, - inside, PR_FALSE, nsnull); - } + inside, PR_FALSE, nsnull); + } } return result; } diff --git a/mozilla/layout/forms/nsLegendFrame.cpp b/mozilla/layout/forms/nsLegendFrame.cpp index 26e532917fa..69edf03313a 100644 --- a/mozilla/layout/forms/nsLegendFrame.cpp +++ b/mozilla/layout/forms/nsLegendFrame.cpp @@ -111,9 +111,10 @@ nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsLegendFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsLegendFrame.h b/mozilla/layout/forms/nsLegendFrame.h index b24f656cc71..84623cc2a74 100644 --- a/mozilla/layout/forms/nsLegendFrame.h +++ b/mozilla/layout/forms/nsLegendFrame.h @@ -48,7 +48,8 @@ public: NS_METHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const; diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index e02012c5906..4fcd5babd30 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -510,7 +510,8 @@ nsTextControlFrame::PaintTextControl(nsIPresContext& aPresContext, { aRenderingContext.PushState(); - nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Content); const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); @@ -654,9 +655,11 @@ nsTextControlFrame::PaintTextControl(nsIPresContext& aPresContext, NS_METHOD nsTextControlFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintTextControl(aPresContext, aRenderingContext, aDirtyRect); - + if (eFramePaintLayer_Content == aWhichLayer) { + PaintTextControl(aPresContext, aRenderingContext, aDirtyRect); + } return NS_OK; } diff --git a/mozilla/layout/forms/nsTextControlFrame.h b/mozilla/layout/forms/nsTextControlFrame.h index 5f24f568eda..d57579b2faf 100644 --- a/mozilla/layout/forms/nsTextControlFrame.h +++ b/mozilla/layout/forms/nsTextControlFrame.h @@ -68,8 +68,9 @@ public: // Expect this code to repackaged and moved to a new location in the future. // NS_IMETHOD Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); virtual void PaintTextControl(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/generic/nsBRFrame.cpp b/mozilla/layout/generic/nsBRFrame.cpp index 0421a45e48e..13a0905d698 100644 --- a/mozilla/layout/generic/nsBRFrame.cpp +++ b/mozilla/layout/generic/nsBRFrame.cpp @@ -31,7 +31,8 @@ public: // nsIFrame NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); // nsIHTMLReflow NS_IMETHOD Reflow(nsIPresContext& aPresContext, @@ -61,9 +62,11 @@ BRFrame::~BRFrame() NS_METHOD BRFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && + nsIFrame::GetShowFrameBorders()) { float p2t = aPresContext.GetPixelsToTwips(); nscoord five = NSIntPixelsToTwips(5, p2t); aRenderingContext.SetColor(NS_RGB(0, 255, 255)); diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 32664d39768..d3bebeff9a0 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -3837,13 +3837,14 @@ nsBaseIBFrame::GetSkipSides() const NS_IMETHODIMP nsBaseIBFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); // Only paint the border and background if we're visible - if (disp->mVisible) { + if ((eFramePaintLayer_Underlay == aWhichLayer) && disp->mVisible) { PRIntn skipSides = GetSkipSides(); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); @@ -3869,20 +3870,25 @@ nsBaseIBFrame::Paint(nsIPresContext& aPresContext, // Child elements have the opportunity to override the visibility // property and display even if the parent is hidden - PaintFloaters(aPresContext, aRenderingContext, aDirtyRect); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintFloaters(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { PRBool clipState; aRenderingContext.PopState(clipState); } + + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX CSS2's outline handling goes here + } return NS_OK; } void nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { nsVoidArray* floaters = line->mFloaters; @@ -3893,15 +3899,16 @@ nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, for (i = 0; i < n; i++) { nsPlaceholderFrame* ph = (nsPlaceholderFrame*) floaters->ElementAt(i); PaintChild(aPresContext, aRenderingContext, aDirtyRect, - ph->GetAnchoredItem()); + ph->GetAnchoredItem(), aWhichLayer); } } } void nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { // If the line has outside children or if the line intersects the @@ -3911,7 +3918,8 @@ nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = line->mFirstChild; PRInt32 n = line->ChildCount(); while (--n >= 0) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, + aWhichLayer); kid->GetNextSibling(kid); } } @@ -4852,17 +4860,21 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) void nsBlockFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsnull != mBullet) { - // Paint outside bullets manually - const nsStyleList* list = (const nsStyleList*) - mStyleContext->GetStyleData(eStyleStruct_List); - if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet); + if (eFramePaintLayer_Content == aWhichLayer) { + if (nsnull != mBullet) { + // Paint outside bullets manually + const nsStyleList* list = (const nsStyleList*) + mStyleContext->GetStyleData(eStyleStruct_List); + if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { + PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet, + aWhichLayer); + } } } nsBlockFrameSuper::PaintChildren(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index 4e994e27cbf..ba2db75d568 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -62,7 +62,8 @@ public: nsIFrame*& aContinuingFrame) = 0; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const; NS_IMETHOD GetFrameName(nsString& aResult) const = 0; NS_IMETHOD VerifyTree() const; @@ -250,12 +251,15 @@ protected: //---------------------------------------- //XXX - void PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + virtual void PaintChildren(nsIPresContext& aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); + void PaintFloaters(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); nsLineBox* FindLineFor(nsIFrame* aFrame, PRBool& aIsFloaterResult); @@ -334,7 +338,8 @@ protected: // nsContainerFrame overrides virtual void PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); // nsBaseIBFrame overrides virtual void ComputeFinalSize(nsBlockReflowState& aState, diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 32664d39768..d3bebeff9a0 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -3837,13 +3837,14 @@ nsBaseIBFrame::GetSkipSides() const NS_IMETHODIMP nsBaseIBFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); // Only paint the border and background if we're visible - if (disp->mVisible) { + if ((eFramePaintLayer_Underlay == aWhichLayer) && disp->mVisible) { PRIntn skipSides = GetSkipSides(); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); @@ -3869,20 +3870,25 @@ nsBaseIBFrame::Paint(nsIPresContext& aPresContext, // Child elements have the opportunity to override the visibility // property and display even if the parent is hidden - PaintFloaters(aPresContext, aRenderingContext, aDirtyRect); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintFloaters(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { PRBool clipState; aRenderingContext.PopState(clipState); } + + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX CSS2's outline handling goes here + } return NS_OK; } void nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { nsVoidArray* floaters = line->mFloaters; @@ -3893,15 +3899,16 @@ nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, for (i = 0; i < n; i++) { nsPlaceholderFrame* ph = (nsPlaceholderFrame*) floaters->ElementAt(i); PaintChild(aPresContext, aRenderingContext, aDirtyRect, - ph->GetAnchoredItem()); + ph->GetAnchoredItem(), aWhichLayer); } } } void nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { // If the line has outside children or if the line intersects the @@ -3911,7 +3918,8 @@ nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = line->mFirstChild; PRInt32 n = line->ChildCount(); while (--n >= 0) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, + aWhichLayer); kid->GetNextSibling(kid); } } @@ -4852,17 +4860,21 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) void nsBlockFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsnull != mBullet) { - // Paint outside bullets manually - const nsStyleList* list = (const nsStyleList*) - mStyleContext->GetStyleData(eStyleStruct_List); - if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet); + if (eFramePaintLayer_Content == aWhichLayer) { + if (nsnull != mBullet) { + // Paint outside bullets manually + const nsStyleList* list = (const nsStyleList*) + mStyleContext->GetStyleData(eStyleStruct_List); + if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { + PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet, + aWhichLayer); + } } } nsBlockFrameSuper::PaintChildren(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 32664d39768..d3bebeff9a0 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -3837,13 +3837,14 @@ nsBaseIBFrame::GetSkipSides() const NS_IMETHODIMP nsBaseIBFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); // Only paint the border and background if we're visible - if (disp->mVisible) { + if ((eFramePaintLayer_Underlay == aWhichLayer) && disp->mVisible) { PRIntn skipSides = GetSkipSides(); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); @@ -3869,20 +3870,25 @@ nsBaseIBFrame::Paint(nsIPresContext& aPresContext, // Child elements have the opportunity to override the visibility // property and display even if the parent is hidden - PaintFloaters(aPresContext, aRenderingContext, aDirtyRect); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintFloaters(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { PRBool clipState; aRenderingContext.PopState(clipState); } + + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX CSS2's outline handling goes here + } return NS_OK; } void nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { nsVoidArray* floaters = line->mFloaters; @@ -3893,15 +3899,16 @@ nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, for (i = 0; i < n; i++) { nsPlaceholderFrame* ph = (nsPlaceholderFrame*) floaters->ElementAt(i); PaintChild(aPresContext, aRenderingContext, aDirtyRect, - ph->GetAnchoredItem()); + ph->GetAnchoredItem(), aWhichLayer); } } } void nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { // If the line has outside children or if the line intersects the @@ -3911,7 +3918,8 @@ nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = line->mFirstChild; PRInt32 n = line->ChildCount(); while (--n >= 0) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, + aWhichLayer); kid->GetNextSibling(kid); } } @@ -4852,17 +4860,21 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) void nsBlockFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsnull != mBullet) { - // Paint outside bullets manually - const nsStyleList* list = (const nsStyleList*) - mStyleContext->GetStyleData(eStyleStruct_List); - if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet); + if (eFramePaintLayer_Content == aWhichLayer) { + if (nsnull != mBullet) { + // Paint outside bullets manually + const nsStyleList* list = (const nsStyleList*) + mStyleContext->GetStyleData(eStyleStruct_List); + if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { + PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet, + aWhichLayer); + } } } nsBlockFrameSuper::PaintChildren(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index 764529c040f..2c00d394d0e 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -75,8 +75,13 @@ nsBulletFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const NS_METHOD nsBulletFrame::Paint(nsIPresContext& aCX, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } + const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); nscoord width; diff --git a/mozilla/layout/generic/nsBulletFrame.h b/mozilla/layout/generic/nsBulletFrame.h index 977239f1279..7ef2a6b236a 100644 --- a/mozilla/layout/generic/nsBulletFrame.h +++ b/mozilla/layout/generic/nsBulletFrame.h @@ -35,7 +35,8 @@ public: NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD Paint(nsIPresContext &aCX, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const; diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 5d8e22028d8..622274b7f8e 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -208,9 +208,10 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHODIMP nsContainerFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } @@ -223,7 +224,8 @@ nsContainerFrame::Paint(nsIPresContext& aPresContext, void nsContainerFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); @@ -242,7 +244,7 @@ nsContainerFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = mFirstChild; while (nsnull != kid) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer); kid->GetNextSibling(kid); } @@ -256,7 +258,8 @@ void nsContainerFrame::PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame) + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer) { nsIView *pView; aFrame->GetView(pView); @@ -301,7 +304,7 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, aRenderingContext.Translate(kidRect.x, kidRect.y); // Paint the kid - aFrame->Paint(aPresContext, aRenderingContext, damageArea); + aFrame->Paint(aPresContext, aRenderingContext, damageArea, aWhichLayer); PRBool clipState; aRenderingContext.PopState(clipState); diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index fab2253768d..944b5012a3e 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -40,7 +40,8 @@ public: // Painting NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); /** * Find the correct child frame. @@ -92,14 +93,16 @@ protected: nsIAtom* aList, nsIFrame** aFrame); - virtual void PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + virtual void PaintChildren(nsIPresContext& aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); virtual void PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame); + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer); /** * Queries the child frame for the nsIHTMLReflow interface and if it's diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index bda5753b3a0..b60fc45e6c5 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -557,47 +557,49 @@ PRBool nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurn return result; } -NS_IMETHODIMP nsFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) +NS_IMETHODIMP +nsFrame::Paint(nsIPresContext& aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (DisplaySelection(aPresContext) == PR_FALSE) - return NS_OK; + if (eFramePaintLayer_Overlay == aWhichLayer) { + if (DisplaySelection(aPresContext) == PR_FALSE) + return NS_OK; - PRBool clearAfterPaint = PR_FALSE; + PRBool clearAfterPaint = PR_FALSE; - // Get Content - nsIContent * content; - GetContent(content); - PRInt32 n; - content->ChildCount(n); - if (n > 0) { + // Get Content + nsIContent* content; + nsresult rv = GetContent(content); + if (NS_FAILED(rv) || (nsnull == content)) { + return rv; + } + + PRInt32 n; + content->ChildCount(n); + if ((n == 0) && mSelected) { + nsRect rect; + GetRect(rect); + rect.width--; + rect.height--; + aRenderingContext.SetColor(NS_RGB(0,0,255)); + aRenderingContext.DrawRect(rect); + aRenderingContext.DrawLine(rect.x, rect.y, rect.XMost(), rect.YMost()); + aRenderingContext.DrawLine(rect.x, rect.YMost(), rect.XMost(), rect.y); + } NS_RELEASE(content); - return NS_OK; } - - if (content && mSelected) { - nsRect rect; - GetRect(rect); - rect.width--; - rect.height--; - aRenderingContext.SetColor(NS_RGB(0,0,255)); - aRenderingContext.DrawRect(rect); - aRenderingContext.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y+rect.height); - aRenderingContext.DrawLine(rect.x, rect.y+rect.height, rect.x+rect.width, rect.y); - } - - NS_IF_RELEASE(content); - return NS_OK; } /** * */ -NS_IMETHODIMP nsFrame::HandleEvent(nsIPresContext& aPresContext, - nsGUIEvent* aEvent, - nsEventStatus& aEventStatus) +NS_IMETHODIMP +nsFrame::HandleEvent(nsIPresContext& aPresContext, + nsGUIEvent* aEvent, + nsEventStatus& aEventStatus) { if (nsEventStatus_eConsumeNoDefault == aEventStatus) { return NS_OK; diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 227745c8ce8..bb91c453e3c 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -142,7 +142,8 @@ public: NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus); diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index c9ac4754a71..826ad2f2e72 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -109,7 +109,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -148,7 +149,8 @@ public: */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); /** * @see nsIFrame::Reflow @@ -274,15 +276,18 @@ PRBool nsHTMLFrameOuterFrame::IsInline() NS_IMETHODIMP nsHTMLFrameOuterFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { //printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); if (nsnull != mFirstChild) { - mFirstChild->Paint(aPresContext, aRenderingContext, aDirtyRect); + mFirstChild->Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } if (IsInline()) { - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, + aDirtyRect, aWhichLayer); } else { return NS_OK; } @@ -582,8 +587,9 @@ nsHTMLFrameInnerFrame::SizeTo(nscoord aWidth, nscoord aHeight) NS_IMETHODIMP nsHTMLFrameInnerFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { //printf("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); return NS_OK; diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index ffa04d42060..f7352bb7627 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -81,7 +81,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -119,7 +120,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -476,10 +478,12 @@ nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, NS_IMETHODIMP nsHTMLFramesetFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { //printf("frameset paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, + aDirtyRect, aWhichLayer); } void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs) @@ -1486,8 +1490,12 @@ nsHTMLFramesetBorderFrame::Reflow(nsIPresContext& aPresContext, NS_METHOD nsHTMLFramesetBorderFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } //printf("border frame paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); nscolor WHITE = NS_RGB(255, 255, 255); nscolor bgColor = NS_RGB(200,200,200); @@ -1649,8 +1657,12 @@ nsHTMLFramesetBlankFrame::Reflow(nsIPresContext& aPresContext, NS_METHOD nsHTMLFramesetBlankFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } nscolor white = NS_RGB(255,255,255); aRenderingContext.SetColor (white); // XXX FillRect doesn't seem to work diff --git a/mozilla/layout/generic/nsFrameSetFrame.h b/mozilla/layout/generic/nsFrameSetFrame.h index 6dad7f3bb88..098eedbcfb5 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.h +++ b/mozilla/layout/generic/nsFrameSetFrame.h @@ -117,7 +117,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index 80f88e10f6c..d0024f878e5 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -48,58 +48,32 @@ static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); NS_IMETHODIMP nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Probe for a JS onPaint event handler - nsIHTMLContent* hc; - if (mContent && NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**)&hc)) { - nsHTMLValue val; - if (NS_CONTENT_ATTR_HAS_VALUE == - hc->GetAttribute(nsHTMLAtoms::onpaint, val)) { - nsEventStatus es; - nsresult rv; + if (eFramePaintLayer_Underlay == aWhichLayer) { + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); + if (disp->mVisible && mRect.width && mRect.height) { + // Paint our background and border + PRIntn skipSides = GetSkipSides(); + const nsStyleColor* color = (const nsStyleColor*) + mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* spacing = (const nsStyleSpacing*) + mStyleContext->GetStyleData(eStyleStruct_Spacing); - nsRect r(aDirtyRect); - nsPaintEvent event; - event.eventStructType = NS_PAINT_EVENT; - event.message = NS_PAINT; - event.point.x = 0; - event.point.y = 0; - event.time = 0; - event.widget = nsnull; - event.nativeMsg = nsnull; - event.renderingContext = &aRenderingContext; - event.rect = &r; - - rv = mContent->HandleDOMEvent(aPresContext, &event, nsnull, DOM_EVENT_INIT, es); - if (NS_OK == rv) { - } + nsRect rect(0, 0, mRect.width, mRect.height); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides); } - NS_RELEASE(hc); - } - - const nsStyleDisplay* disp = (const nsStyleDisplay*) - mStyleContext->GetStyleData(eStyleStruct_Display); - - if (disp->mVisible && mRect.width && mRect.height) { - // Paint our background and border - PRIntn skipSides = GetSkipSides(); - const nsStyleColor* color = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* spacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - - nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides); } // Now paint the kids. Note that child elements have the opportunity to // override the visibility property and display even if their parent is // hidden - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.h b/mozilla/layout/generic/nsHTMLContainerFrame.h index 80647d6407c..46953c32372 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.h +++ b/mozilla/layout/generic/nsHTMLContainerFrame.h @@ -31,7 +31,8 @@ class nsHTMLContainerFrame : public nsContainerFrame { public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext& aPresContext, nsIFrame* aFloatedFrame); nsAbsoluteFrame* CreateAbsolutePlaceholderFrame(nsIPresContext& aPresContext, diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 473732ca4c6..081562821be 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -112,6 +112,14 @@ typedef PRUint32 nsFrameState; //---------------------------------------------------------------------- +enum nsFramePaintLayer { + eFramePaintLayer_Underlay = 0, + eFramePaintLayer_Content = 1, + eFramePaintLayer_Overlay = 2, +}; + +//---------------------------------------------------------------------- + /** * A frame in the layout model. This interface is supported by all frame * objects. @@ -262,11 +270,14 @@ public: NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling) = 0; /** - * Painting + * Paint is responsible for painting the a frame. The aWhichLayer + * argument indicates which layer of painting should be done during + * the call. */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) = 0; + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) = 0; /** * Event handling of GUI events. diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 6d6dbb27fc0..f7d8122d7ef 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -648,7 +648,8 @@ nsImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext, NS_METHOD nsImageFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { if ((0 == mRect.width) || (0 == mRect.height)) { // Do not render when given a zero area. This avoids some useless @@ -657,38 +658,45 @@ nsImageFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); if (disp->mVisible) { // First paint background and borders - nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); nsIImage* image = mImageLoader.GetImage(); if (nsnull == image) { // No image yet, or image load failed. Draw the alt-text and an icon // indicating the status - DisplayAltFeedback(aPresContext, aRenderingContext, - mImageLoader.GetLoadImageFailed() ? NS_ICON_BROKEN_IMAGE : - NS_ICON_LOADING_IMAGE); + if (eFramePaintLayer_Underlay == aWhichLayer) { + DisplayAltFeedback(aPresContext, aRenderingContext, + mImageLoader.GetLoadImageFailed() + ? NS_ICON_BROKEN_IMAGE + : NS_ICON_LOADING_IMAGE); + } return NS_OK; } - // Now render the image into our inner area (the area without the - // borders and padding) - nsRect inner; - GetInnerArea(&aPresContext, inner); - if (mImageLoader.GetLoadImageFailed()) { - float p2t; - aPresContext.GetScaledPixelsToTwips(p2t); - inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t); - inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t); + if (eFramePaintLayer_Content == aWhichLayer) { + // Now render the image into our inner area (the area without the + // borders and padding) + nsRect inner; + GetInnerArea(&aPresContext, inner); + if (mImageLoader.GetLoadImageFailed()) { + float p2t; + aPresContext.GetScaledPixelsToTwips(p2t); + inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t); + inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t); + } + aRenderingContext.DrawImage(image, inner); } - aRenderingContext.DrawImage(image, inner); - if (GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { nsIImageMap* map = GetImageMap(); if (nsnull != map) { + nsRect inner; + GetInnerArea(&aPresContext, inner); PRBool clipState; aRenderingContext.SetColor(NS_RGB(0, 0, 0)); aRenderingContext.PushState(); diff --git a/mozilla/layout/generic/nsLeafFrame.cpp b/mozilla/layout/generic/nsLeafFrame.cpp index 4e03e7f5c51..054405e09ad 100644 --- a/mozilla/layout/generic/nsLeafFrame.cpp +++ b/mozilla/layout/generic/nsLeafFrame.cpp @@ -31,22 +31,23 @@ nsLeafFrame::~nsLeafFrame() NS_IMETHODIMP nsLeafFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - - if (disp->mVisible) { - const nsStyleColor* myColor = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* mySpacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - - nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *myColor, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *mySpacing, 0); + if (eFramePaintLayer_Underlay == aWhichLayer) { + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); + if (disp->mVisible) { + const nsStyleColor* myColor = (const nsStyleColor*) + mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* mySpacing = (const nsStyleSpacing*) + mStyleContext->GetStyleData(eStyleStruct_Spacing); + nsRect rect(0, 0, mRect.width, mRect.height); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myColor, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *mySpacing, 0); + } } return NS_OK; } diff --git a/mozilla/layout/generic/nsLeafFrame.h b/mozilla/layout/generic/nsLeafFrame.h index 3ceaa6c5e5b..4a85a84e1c0 100644 --- a/mozilla/layout/generic/nsLeafFrame.h +++ b/mozilla/layout/generic/nsLeafFrame.h @@ -32,7 +32,8 @@ public: // nsIFrame replacements NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index e9cc2541ebd..a86685081ba 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -147,7 +147,8 @@ public: nsDidReflowStatus aStatus); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Scrolled(nsIView *aView); //local methods @@ -550,25 +551,28 @@ nsObjectFrame::DidReflow(nsIPresContext& aPresContext, NS_IMETHODIMP nsObjectFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleFont* font = - (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font); + if (eFramePaintLayer_Content == aWhichLayer) { + const nsStyleFont* font = (const nsStyleFont*) + mStyleContext->GetStyleData(eStyleStruct_Font); - aRenderingContext.SetFont(font->mFont); - aRenderingContext.SetColor(NS_RGB(192, 192, 192)); - aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); - aRenderingContext.SetColor(NS_RGB(0, 0, 0)); - aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); - float p2t = aPresContext.GetPixelsToTwips(); - nscoord px3 = NSIntPixelsToTwips(3, p2t); - nsAutoString tmp; - nsIAtom* atom; - mContent->GetTag(atom); - if (nsnull != atom) { - atom->ToString(tmp); - NS_RELEASE(atom); - aRenderingContext.DrawString(tmp, px3, px3, 0); + aRenderingContext.SetFont(font->mFont); + aRenderingContext.SetColor(NS_RGB(192, 192, 192)); + aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); + aRenderingContext.SetColor(NS_RGB(0, 0, 0)); + aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); + float p2t = aPresContext.GetPixelsToTwips(); + nscoord px3 = NSIntPixelsToTwips(3, p2t); + nsAutoString tmp; + nsIAtom* atom; + mContent->GetTag(atom); + if (nsnull != atom) { + atom->ToString(tmp); + NS_RELEASE(atom); + aRenderingContext.DrawString(tmp, px3, px3, 0); + } } return NS_OK; } diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index 0a10618a22b..6221d32e403 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -70,9 +70,10 @@ nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, NS_IMETHODIMP nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { float p2t = aPresContext.GetPixelsToTwips(); aRenderingContext.SetColor(NS_RGB(0, 255, 255)); nscoord x = NSIntPixelsToTwips(-5, p2t); diff --git a/mozilla/layout/generic/nsPlaceholderFrame.h b/mozilla/layout/generic/nsPlaceholderFrame.h index dcd11465ae9..d339894715a 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.h +++ b/mozilla/layout/generic/nsPlaceholderFrame.h @@ -43,7 +43,8 @@ public: // nsIFrame overrides NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 0798ca87434..851e0c76992 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -194,34 +194,42 @@ nsSimplePageSequenceFrame::GetFrameName(nsString& aResult) const NS_IMETHODIMP nsSimplePageSequenceFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Paint a white background - aRenderingContext.SetColor(NS_RGB(255,255,255)); - aRenderingContext.FillRect(aDirtyRect); - // XXX Crop marks or hash marks would be nice. Use style info... - return nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + if (eFramePaintLayer_Underlay == aWhichLayer) { + // Paint a white background + aRenderingContext.SetColor(NS_RGB(255,255,255)); + aRenderingContext.FillRect(aDirtyRect); + // XXX Crop marks or hash marks would be nice. Use style info... + } + + return nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } void nsSimplePageSequenceFrame::PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame) + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer) { // Let the page paint nsContainerFrame::PaintChild(aPresContext, aRenderingContext, - aDirtyRect, aFrame); + aDirtyRect, aFrame, aWhichLayer); - // XXX Paint a one-pixel border around the page so it's easy to see where - // each page begins and ends when we're in print preview mode - nsRect pageBounds; - float p2t = aPresContext.GetPixelsToTwips(); + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX Paint a one-pixel border around the page so it's easy to see where + // each page begins and ends when we're in print preview mode + nsRect pageBounds; + float p2t = aPresContext.GetPixelsToTwips(); - aRenderingContext.SetColor(NS_RGB(0, 0, 0)); - aFrame->GetRect(pageBounds); - pageBounds.Inflate(NSToCoordRound(p2t), NSToCoordRound(p2t)); - aRenderingContext.DrawRect(pageBounds); + aRenderingContext.SetColor(NS_RGB(0, 0, 0)); + aFrame->GetRect(pageBounds); + pageBounds.Inflate(NSToCoordRound(p2t), NSToCoordRound(p2t)); + aRenderingContext.DrawRect(pageBounds); + } } //---------------------------------------------------------------------- diff --git a/mozilla/layout/generic/nsSimplePageSequence.h b/mozilla/layout/generic/nsSimplePageSequence.h index ce5a9b18f40..4295acb2d9b 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.h +++ b/mozilla/layout/generic/nsSimplePageSequence.h @@ -37,7 +37,8 @@ public: // nsIFrame NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); // nsIPageSequenceFrame NS_IMETHOD Print(nsIPresContext& aPresContext, @@ -51,7 +52,8 @@ protected: virtual void PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame); + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer); NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();} NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();} diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 12f4d708077..1381ee2349a 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -109,7 +109,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, @@ -509,8 +510,12 @@ TextFrame::ContentChanged(nsIPresContext* aPresContext, NS_IMETHODIMP TextFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } if ((0 != (mFlags & TEXT_BLINK_ON)) && gBlinkTextOff) { return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsBRFrame.cpp b/mozilla/layout/html/base/src/nsBRFrame.cpp index 0421a45e48e..13a0905d698 100644 --- a/mozilla/layout/html/base/src/nsBRFrame.cpp +++ b/mozilla/layout/html/base/src/nsBRFrame.cpp @@ -31,7 +31,8 @@ public: // nsIFrame NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); // nsIHTMLReflow NS_IMETHOD Reflow(nsIPresContext& aPresContext, @@ -61,9 +62,11 @@ BRFrame::~BRFrame() NS_METHOD BRFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && + nsIFrame::GetShowFrameBorders()) { float p2t = aPresContext.GetPixelsToTwips(); nscoord five = NSIntPixelsToTwips(5, p2t); aRenderingContext.SetColor(NS_RGB(0, 255, 255)); diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 32664d39768..d3bebeff9a0 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -3837,13 +3837,14 @@ nsBaseIBFrame::GetSkipSides() const NS_IMETHODIMP nsBaseIBFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); // Only paint the border and background if we're visible - if (disp->mVisible) { + if ((eFramePaintLayer_Underlay == aWhichLayer) && disp->mVisible) { PRIntn skipSides = GetSkipSides(); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); @@ -3869,20 +3870,25 @@ nsBaseIBFrame::Paint(nsIPresContext& aPresContext, // Child elements have the opportunity to override the visibility // property and display even if the parent is hidden - PaintFloaters(aPresContext, aRenderingContext, aDirtyRect); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintFloaters(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { PRBool clipState; aRenderingContext.PopState(clipState); } + + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX CSS2's outline handling goes here + } return NS_OK; } void nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { nsVoidArray* floaters = line->mFloaters; @@ -3893,15 +3899,16 @@ nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, for (i = 0; i < n; i++) { nsPlaceholderFrame* ph = (nsPlaceholderFrame*) floaters->ElementAt(i); PaintChild(aPresContext, aRenderingContext, aDirtyRect, - ph->GetAnchoredItem()); + ph->GetAnchoredItem(), aWhichLayer); } } } void nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { // If the line has outside children or if the line intersects the @@ -3911,7 +3918,8 @@ nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = line->mFirstChild; PRInt32 n = line->ChildCount(); while (--n >= 0) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, + aWhichLayer); kid->GetNextSibling(kid); } } @@ -4852,17 +4860,21 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) void nsBlockFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsnull != mBullet) { - // Paint outside bullets manually - const nsStyleList* list = (const nsStyleList*) - mStyleContext->GetStyleData(eStyleStruct_List); - if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet); + if (eFramePaintLayer_Content == aWhichLayer) { + if (nsnull != mBullet) { + // Paint outside bullets manually + const nsStyleList* list = (const nsStyleList*) + mStyleContext->GetStyleData(eStyleStruct_List); + if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { + PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet, + aWhichLayer); + } } } nsBlockFrameSuper::PaintChildren(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index 4e994e27cbf..ba2db75d568 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -62,7 +62,8 @@ public: nsIFrame*& aContinuingFrame) = 0; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const; NS_IMETHOD GetFrameName(nsString& aResult) const = 0; NS_IMETHOD VerifyTree() const; @@ -250,12 +251,15 @@ protected: //---------------------------------------- //XXX - void PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + virtual void PaintChildren(nsIPresContext& aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); + void PaintFloaters(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); nsLineBox* FindLineFor(nsIFrame* aFrame, PRBool& aIsFloaterResult); @@ -334,7 +338,8 @@ protected: // nsContainerFrame overrides virtual void PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); // nsBaseIBFrame overrides virtual void ComputeFinalSize(nsBlockReflowState& aState, diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 32664d39768..d3bebeff9a0 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -3837,13 +3837,14 @@ nsBaseIBFrame::GetSkipSides() const NS_IMETHODIMP nsBaseIBFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); // Only paint the border and background if we're visible - if (disp->mVisible) { + if ((eFramePaintLayer_Underlay == aWhichLayer) && disp->mVisible) { PRIntn skipSides = GetSkipSides(); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); @@ -3869,20 +3870,25 @@ nsBaseIBFrame::Paint(nsIPresContext& aPresContext, // Child elements have the opportunity to override the visibility // property and display even if the parent is hidden - PaintFloaters(aPresContext, aRenderingContext, aDirtyRect); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintFloaters(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { PRBool clipState; aRenderingContext.PopState(clipState); } + + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX CSS2's outline handling goes here + } return NS_OK; } void nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { nsVoidArray* floaters = line->mFloaters; @@ -3893,15 +3899,16 @@ nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, for (i = 0; i < n; i++) { nsPlaceholderFrame* ph = (nsPlaceholderFrame*) floaters->ElementAt(i); PaintChild(aPresContext, aRenderingContext, aDirtyRect, - ph->GetAnchoredItem()); + ph->GetAnchoredItem(), aWhichLayer); } } } void nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { // If the line has outside children or if the line intersects the @@ -3911,7 +3918,8 @@ nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = line->mFirstChild; PRInt32 n = line->ChildCount(); while (--n >= 0) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, + aWhichLayer); kid->GetNextSibling(kid); } } @@ -4852,17 +4860,21 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) void nsBlockFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsnull != mBullet) { - // Paint outside bullets manually - const nsStyleList* list = (const nsStyleList*) - mStyleContext->GetStyleData(eStyleStruct_List); - if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet); + if (eFramePaintLayer_Content == aWhichLayer) { + if (nsnull != mBullet) { + // Paint outside bullets manually + const nsStyleList* list = (const nsStyleList*) + mStyleContext->GetStyleData(eStyleStruct_List); + if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { + PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet, + aWhichLayer); + } } } nsBlockFrameSuper::PaintChildren(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 32664d39768..d3bebeff9a0 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -3837,13 +3837,14 @@ nsBaseIBFrame::GetSkipSides() const NS_IMETHODIMP nsBaseIBFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); // Only paint the border and background if we're visible - if (disp->mVisible) { + if ((eFramePaintLayer_Underlay == aWhichLayer) && disp->mVisible) { PRIntn skipSides = GetSkipSides(); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); @@ -3869,20 +3870,25 @@ nsBaseIBFrame::Paint(nsIPresContext& aPresContext, // Child elements have the opportunity to override the visibility // property and display even if the parent is hidden - PaintFloaters(aPresContext, aRenderingContext, aDirtyRect); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintFloaters(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { PRBool clipState; aRenderingContext.PopState(clipState); } + + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX CSS2's outline handling goes here + } return NS_OK; } void nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { nsVoidArray* floaters = line->mFloaters; @@ -3893,15 +3899,16 @@ nsBaseIBFrame::PaintFloaters(nsIPresContext& aPresContext, for (i = 0; i < n; i++) { nsPlaceholderFrame* ph = (nsPlaceholderFrame*) floaters->ElementAt(i); PaintChild(aPresContext, aRenderingContext, aDirtyRect, - ph->GetAnchoredItem()); + ph->GetAnchoredItem(), aWhichLayer); } } } void nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { for (nsLineBox* line = mLines; nsnull != line; line = line->mNext) { // If the line has outside children or if the line intersects the @@ -3911,7 +3918,8 @@ nsBaseIBFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = line->mFirstChild; PRInt32 n = line->ChildCount(); while (--n >= 0) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, + aWhichLayer); kid->GetNextSibling(kid); } } @@ -4852,17 +4860,21 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) void nsBlockFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsnull != mBullet) { - // Paint outside bullets manually - const nsStyleList* list = (const nsStyleList*) - mStyleContext->GetStyleData(eStyleStruct_List); - if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet); + if (eFramePaintLayer_Content == aWhichLayer) { + if (nsnull != mBullet) { + // Paint outside bullets manually + const nsStyleList* list = (const nsStyleList*) + mStyleContext->GetStyleData(eStyleStruct_List); + if (NS_STYLE_LIST_STYLE_POSITION_OUTSIDE == list->mListStylePosition) { + PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet, + aWhichLayer); + } } } nsBlockFrameSuper::PaintChildren(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/html/base/src/nsBodyFrame.cpp b/mozilla/layout/html/base/src/nsBodyFrame.cpp index 972a622e2af..543b7cf41ee 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.cpp +++ b/mozilla/layout/html/base/src/nsBodyFrame.cpp @@ -186,14 +186,16 @@ nsBodyFrame::BandData::ComputeAvailSpaceRect() NS_IMETHODIMP nsBodyFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { // Note: all absolutely positioned elements have views so we don't // need to worry about painting them nsresult rv = nsBlockFrame::Paint(aPresContext, aRenderingContext, - aDirtyRect); + aDirtyRect, aWhichLayer); - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && + nsIFrame::GetShowFrameBorders()) { // Render the bands in the spacemanager BandData band; nsISpaceManager* sm = mSpaceManager; diff --git a/mozilla/layout/html/base/src/nsBodyFrame.h b/mozilla/layout/html/base/src/nsBodyFrame.h index b62ef24a6e0..422917afac3 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.h +++ b/mozilla/layout/html/base/src/nsBodyFrame.h @@ -65,7 +65,8 @@ public: #ifdef NS_DEBUG NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); #endif NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext, diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index 764529c040f..2c00d394d0e 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -75,8 +75,13 @@ nsBulletFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const NS_METHOD nsBulletFrame::Paint(nsIPresContext& aCX, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } + const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); nscoord width; diff --git a/mozilla/layout/html/base/src/nsBulletFrame.h b/mozilla/layout/html/base/src/nsBulletFrame.h index 977239f1279..7ef2a6b236a 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.h +++ b/mozilla/layout/html/base/src/nsBulletFrame.h @@ -35,7 +35,8 @@ public: NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD Paint(nsIPresContext &aCX, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const; diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 5d8e22028d8..622274b7f8e 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -208,9 +208,10 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHODIMP nsContainerFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } @@ -223,7 +224,8 @@ nsContainerFrame::Paint(nsIPresContext& aPresContext, void nsContainerFrame::PaintChildren(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); @@ -242,7 +244,7 @@ nsContainerFrame::PaintChildren(nsIPresContext& aPresContext, nsIFrame* kid = mFirstChild; while (nsnull != kid) { - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid); + PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer); kid->GetNextSibling(kid); } @@ -256,7 +258,8 @@ void nsContainerFrame::PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame) + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer) { nsIView *pView; aFrame->GetView(pView); @@ -301,7 +304,7 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, aRenderingContext.Translate(kidRect.x, kidRect.y); // Paint the kid - aFrame->Paint(aPresContext, aRenderingContext, damageArea); + aFrame->Paint(aPresContext, aRenderingContext, damageArea, aWhichLayer); PRBool clipState; aRenderingContext.PopState(clipState); diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index fab2253768d..944b5012a3e 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -40,7 +40,8 @@ public: // Painting NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); /** * Find the correct child frame. @@ -92,14 +93,16 @@ protected: nsIAtom* aList, nsIFrame** aFrame); - virtual void PaintChildren(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + virtual void PaintChildren(nsIPresContext& aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); virtual void PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame); + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer); /** * Queries the child frame for the nsIHTMLReflow interface and if it's diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index bda5753b3a0..b60fc45e6c5 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -557,47 +557,49 @@ PRBool nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurn return result; } -NS_IMETHODIMP nsFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) +NS_IMETHODIMP +nsFrame::Paint(nsIPresContext& aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (DisplaySelection(aPresContext) == PR_FALSE) - return NS_OK; + if (eFramePaintLayer_Overlay == aWhichLayer) { + if (DisplaySelection(aPresContext) == PR_FALSE) + return NS_OK; - PRBool clearAfterPaint = PR_FALSE; + PRBool clearAfterPaint = PR_FALSE; - // Get Content - nsIContent * content; - GetContent(content); - PRInt32 n; - content->ChildCount(n); - if (n > 0) { + // Get Content + nsIContent* content; + nsresult rv = GetContent(content); + if (NS_FAILED(rv) || (nsnull == content)) { + return rv; + } + + PRInt32 n; + content->ChildCount(n); + if ((n == 0) && mSelected) { + nsRect rect; + GetRect(rect); + rect.width--; + rect.height--; + aRenderingContext.SetColor(NS_RGB(0,0,255)); + aRenderingContext.DrawRect(rect); + aRenderingContext.DrawLine(rect.x, rect.y, rect.XMost(), rect.YMost()); + aRenderingContext.DrawLine(rect.x, rect.YMost(), rect.XMost(), rect.y); + } NS_RELEASE(content); - return NS_OK; } - - if (content && mSelected) { - nsRect rect; - GetRect(rect); - rect.width--; - rect.height--; - aRenderingContext.SetColor(NS_RGB(0,0,255)); - aRenderingContext.DrawRect(rect); - aRenderingContext.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y+rect.height); - aRenderingContext.DrawLine(rect.x, rect.y+rect.height, rect.x+rect.width, rect.y); - } - - NS_IF_RELEASE(content); - return NS_OK; } /** * */ -NS_IMETHODIMP nsFrame::HandleEvent(nsIPresContext& aPresContext, - nsGUIEvent* aEvent, - nsEventStatus& aEventStatus) +NS_IMETHODIMP +nsFrame::HandleEvent(nsIPresContext& aPresContext, + nsGUIEvent* aEvent, + nsEventStatus& aEventStatus) { if (nsEventStatus_eConsumeNoDefault == aEventStatus) { return NS_OK; diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 227745c8ce8..bb91c453e3c 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -142,7 +142,8 @@ public: NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus); diff --git a/mozilla/layout/html/base/src/nsHRFrame.cpp b/mozilla/layout/html/base/src/nsHRFrame.cpp index ff2233111fd..2c8653e3b02 100644 --- a/mozilla/layout/html/base/src/nsHRFrame.cpp +++ b/mozilla/layout/html/base/src/nsHRFrame.cpp @@ -46,7 +46,8 @@ public: nsReflowStatus& aStatus); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); protected: virtual ~HRuleFrame(); @@ -80,11 +81,16 @@ HRuleFrame::~HRuleFrame() NS_METHOD HRuleFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } + const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - if (PR_FALSE == disp->mVisible) { + if (!disp->mVisible) { return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index 80f88e10f6c..d0024f878e5 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -48,58 +48,32 @@ static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); NS_IMETHODIMP nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Probe for a JS onPaint event handler - nsIHTMLContent* hc; - if (mContent && NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**)&hc)) { - nsHTMLValue val; - if (NS_CONTENT_ATTR_HAS_VALUE == - hc->GetAttribute(nsHTMLAtoms::onpaint, val)) { - nsEventStatus es; - nsresult rv; + if (eFramePaintLayer_Underlay == aWhichLayer) { + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); + if (disp->mVisible && mRect.width && mRect.height) { + // Paint our background and border + PRIntn skipSides = GetSkipSides(); + const nsStyleColor* color = (const nsStyleColor*) + mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* spacing = (const nsStyleSpacing*) + mStyleContext->GetStyleData(eStyleStruct_Spacing); - nsRect r(aDirtyRect); - nsPaintEvent event; - event.eventStructType = NS_PAINT_EVENT; - event.message = NS_PAINT; - event.point.x = 0; - event.point.y = 0; - event.time = 0; - event.widget = nsnull; - event.nativeMsg = nsnull; - event.renderingContext = &aRenderingContext; - event.rect = &r; - - rv = mContent->HandleDOMEvent(aPresContext, &event, nsnull, DOM_EVENT_INIT, es); - if (NS_OK == rv) { - } + nsRect rect(0, 0, mRect.width, mRect.height); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides); } - NS_RELEASE(hc); - } - - const nsStyleDisplay* disp = (const nsStyleDisplay*) - mStyleContext->GetStyleData(eStyleStruct_Display); - - if (disp->mVisible && mRect.width && mRect.height) { - // Paint our background and border - PRIntn skipSides = GetSkipSides(); - const nsStyleColor* color = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* spacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - - nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides); } // Now paint the kids. Note that child elements have the opportunity to // override the visibility property and display even if their parent is // hidden - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.h b/mozilla/layout/html/base/src/nsHTMLContainerFrame.h index 80647d6407c..46953c32372 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.h +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.h @@ -31,7 +31,8 @@ class nsHTMLContainerFrame : public nsContainerFrame { public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext& aPresContext, nsIFrame* aFloatedFrame); nsAbsoluteFrame* CreateAbsolutePlaceholderFrame(nsIPresContext& aPresContext, diff --git a/mozilla/layout/html/base/src/nsHTMLImage.h b/mozilla/layout/html/base/src/nsHTMLImage.h index de9fd79b763..0023ce9a07e 100644 --- a/mozilla/layout/html/base/src/nsHTMLImage.h +++ b/mozilla/layout/html/base/src/nsHTMLImage.h @@ -103,7 +103,8 @@ public: NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 6d6dbb27fc0..f7d8122d7ef 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -648,7 +648,8 @@ nsImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext, NS_METHOD nsImageFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { if ((0 == mRect.width) || (0 == mRect.height)) { // Do not render when given a zero area. This avoids some useless @@ -657,38 +658,45 @@ nsImageFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); if (disp->mVisible) { // First paint background and borders - nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); nsIImage* image = mImageLoader.GetImage(); if (nsnull == image) { // No image yet, or image load failed. Draw the alt-text and an icon // indicating the status - DisplayAltFeedback(aPresContext, aRenderingContext, - mImageLoader.GetLoadImageFailed() ? NS_ICON_BROKEN_IMAGE : - NS_ICON_LOADING_IMAGE); + if (eFramePaintLayer_Underlay == aWhichLayer) { + DisplayAltFeedback(aPresContext, aRenderingContext, + mImageLoader.GetLoadImageFailed() + ? NS_ICON_BROKEN_IMAGE + : NS_ICON_LOADING_IMAGE); + } return NS_OK; } - // Now render the image into our inner area (the area without the - // borders and padding) - nsRect inner; - GetInnerArea(&aPresContext, inner); - if (mImageLoader.GetLoadImageFailed()) { - float p2t; - aPresContext.GetScaledPixelsToTwips(p2t); - inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t); - inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t); + if (eFramePaintLayer_Content == aWhichLayer) { + // Now render the image into our inner area (the area without the + // borders and padding) + nsRect inner; + GetInnerArea(&aPresContext, inner); + if (mImageLoader.GetLoadImageFailed()) { + float p2t; + aPresContext.GetScaledPixelsToTwips(p2t); + inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t); + inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t); + } + aRenderingContext.DrawImage(image, inner); } - aRenderingContext.DrawImage(image, inner); - if (GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { nsIImageMap* map = GetImageMap(); if (nsnull != map) { + nsRect inner; + GetInnerArea(&aPresContext, inner); PRBool clipState; aRenderingContext.SetColor(NS_RGB(0, 0, 0)); aRenderingContext.PushState(); diff --git a/mozilla/layout/html/base/src/nsLeafFrame.cpp b/mozilla/layout/html/base/src/nsLeafFrame.cpp index 4e03e7f5c51..054405e09ad 100644 --- a/mozilla/layout/html/base/src/nsLeafFrame.cpp +++ b/mozilla/layout/html/base/src/nsLeafFrame.cpp @@ -31,22 +31,23 @@ nsLeafFrame::~nsLeafFrame() NS_IMETHODIMP nsLeafFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - - if (disp->mVisible) { - const nsStyleColor* myColor = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* mySpacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - - nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *myColor, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *mySpacing, 0); + if (eFramePaintLayer_Underlay == aWhichLayer) { + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); + if (disp->mVisible) { + const nsStyleColor* myColor = (const nsStyleColor*) + mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* mySpacing = (const nsStyleSpacing*) + mStyleContext->GetStyleData(eStyleStruct_Spacing); + nsRect rect(0, 0, mRect.width, mRect.height); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myColor, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *mySpacing, 0); + } } return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsLeafFrame.h b/mozilla/layout/html/base/src/nsLeafFrame.h index 3ceaa6c5e5b..4a85a84e1c0 100644 --- a/mozilla/layout/html/base/src/nsLeafFrame.h +++ b/mozilla/layout/html/base/src/nsLeafFrame.h @@ -32,7 +32,8 @@ public: // nsIFrame replacements NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index e9cc2541ebd..a86685081ba 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -147,7 +147,8 @@ public: nsDidReflowStatus aStatus); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Scrolled(nsIView *aView); //local methods @@ -550,25 +551,28 @@ nsObjectFrame::DidReflow(nsIPresContext& aPresContext, NS_IMETHODIMP nsObjectFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleFont* font = - (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font); + if (eFramePaintLayer_Content == aWhichLayer) { + const nsStyleFont* font = (const nsStyleFont*) + mStyleContext->GetStyleData(eStyleStruct_Font); - aRenderingContext.SetFont(font->mFont); - aRenderingContext.SetColor(NS_RGB(192, 192, 192)); - aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); - aRenderingContext.SetColor(NS_RGB(0, 0, 0)); - aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); - float p2t = aPresContext.GetPixelsToTwips(); - nscoord px3 = NSIntPixelsToTwips(3, p2t); - nsAutoString tmp; - nsIAtom* atom; - mContent->GetTag(atom); - if (nsnull != atom) { - atom->ToString(tmp); - NS_RELEASE(atom); - aRenderingContext.DrawString(tmp, px3, px3, 0); + aRenderingContext.SetFont(font->mFont); + aRenderingContext.SetColor(NS_RGB(192, 192, 192)); + aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); + aRenderingContext.SetColor(NS_RGB(0, 0, 0)); + aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); + float p2t = aPresContext.GetPixelsToTwips(); + nscoord px3 = NSIntPixelsToTwips(3, p2t); + nsAutoString tmp; + nsIAtom* atom; + mContent->GetTag(atom); + if (nsnull != atom) { + atom->ToString(tmp); + NS_RELEASE(atom); + aRenderingContext.DrawString(tmp, px3, px3, 0); + } } return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index 0a10618a22b..6221d32e403 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -70,9 +70,10 @@ nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, NS_IMETHODIMP nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { float p2t = aPresContext.GetPixelsToTwips(); aRenderingContext.SetColor(NS_RGB(0, 255, 255)); nscoord x = NSIntPixelsToTwips(-5, p2t); diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.h b/mozilla/layout/html/base/src/nsPlaceholderFrame.h index dcd11465ae9..d339894715a 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.h +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.h @@ -43,7 +43,8 @@ public: // nsIFrame overrides NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 5df96b23353..ae086de9a10 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -1191,9 +1191,10 @@ PresShell::FindFrameWithContent(nsIContent* aContent) //nsIViewObserver -NS_IMETHODIMP PresShell :: Paint(nsIView *aView, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) +NS_IMETHODIMP +PresShell::Paint(nsIView *aView, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect) { void* clientData; nsIFrame* frame; @@ -1205,7 +1206,12 @@ NS_IMETHODIMP PresShell :: Paint(nsIView *aView, frame = (nsIFrame *)clientData; if (nsnull != frame) { - rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect); + rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Underlay); + rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Content); + rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Overlay); #ifdef NS_DEBUG // Draw a border around the frame if (nsIFrame::GetShowFrameBorders()) { @@ -1219,9 +1225,10 @@ NS_IMETHODIMP PresShell :: Paint(nsIView *aView, return rv; } -NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView, - nsGUIEvent* aEvent, - nsEventStatus& aEventStatus) +NS_IMETHODIMP +PresShell::HandleEvent(nsIView *aView, + nsGUIEvent* aEvent, + nsEventStatus& aEventStatus) { void* clientData; nsIFrame* frame; @@ -1281,7 +1288,8 @@ NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView, return rv; } -NS_IMETHODIMP PresShell :: Scrolled(nsIView *aView) +NS_IMETHODIMP +PresShell::Scrolled(nsIView *aView) { void* clientData; nsIFrame* frame; @@ -1300,7 +1308,8 @@ NS_IMETHODIMP PresShell :: Scrolled(nsIView *aView) return rv; } -NS_IMETHODIMP PresShell :: ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight) +NS_IMETHODIMP +PresShell::ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight) { return ResizeReflow(aWidth, aHeight); } @@ -1311,8 +1320,6 @@ NS_IMETHODIMP PresShell :: ResizeReflow(nsIView *aView, nscoord aWidth, nscoord #include "nsIScrollableView.h" #include "nsIDeviceContext.h" #include "nsIURL.h" -//#include "nsICSSParser.h" -//#include "nsIStyleSheet.h" static NS_DEFINE_IID(kViewManagerCID, NS_VIEW_MANAGER_CID); static NS_DEFINE_IID(kIViewManagerIID, NS_IVIEWMANAGER_IID); diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index 92d407af5ad..943b13d2d61 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -66,7 +66,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const; @@ -452,18 +453,27 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, NS_IMETHODIMP nsScrollFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Paint our border only (no background) - const nsStyleSpacing* spacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + if (eFramePaintLayer_Underlay == aWhichLayer) { + // Only paint the border and background if we're visible + const nsStyleDisplay* disp = (const nsStyleDisplay*) + mStyleContext->GetStyleData(eStyleStruct_Display); + if (disp->mVisible) { + // Paint our border only (no background) + const nsStyleSpacing* spacing = (const nsStyleSpacing*) + mStyleContext->GetStyleData(eStyleStruct_Spacing); - nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, 0); + nsRect rect(0, 0, mRect.width, mRect.height); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, 0); + } + } // Paint our children - return nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } PRIntn diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 0798ca87434..851e0c76992 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -194,34 +194,42 @@ nsSimplePageSequenceFrame::GetFrameName(nsString& aResult) const NS_IMETHODIMP nsSimplePageSequenceFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Paint a white background - aRenderingContext.SetColor(NS_RGB(255,255,255)); - aRenderingContext.FillRect(aDirtyRect); - // XXX Crop marks or hash marks would be nice. Use style info... - return nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + if (eFramePaintLayer_Underlay == aWhichLayer) { + // Paint a white background + aRenderingContext.SetColor(NS_RGB(255,255,255)); + aRenderingContext.FillRect(aDirtyRect); + // XXX Crop marks or hash marks would be nice. Use style info... + } + + return nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } void nsSimplePageSequenceFrame::PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame) + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer) { // Let the page paint nsContainerFrame::PaintChild(aPresContext, aRenderingContext, - aDirtyRect, aFrame); + aDirtyRect, aFrame, aWhichLayer); - // XXX Paint a one-pixel border around the page so it's easy to see where - // each page begins and ends when we're in print preview mode - nsRect pageBounds; - float p2t = aPresContext.GetPixelsToTwips(); + if (eFramePaintLayer_Overlay == aWhichLayer) { + // XXX Paint a one-pixel border around the page so it's easy to see where + // each page begins and ends when we're in print preview mode + nsRect pageBounds; + float p2t = aPresContext.GetPixelsToTwips(); - aRenderingContext.SetColor(NS_RGB(0, 0, 0)); - aFrame->GetRect(pageBounds); - pageBounds.Inflate(NSToCoordRound(p2t), NSToCoordRound(p2t)); - aRenderingContext.DrawRect(pageBounds); + aRenderingContext.SetColor(NS_RGB(0, 0, 0)); + aFrame->GetRect(pageBounds); + pageBounds.Inflate(NSToCoordRound(p2t), NSToCoordRound(p2t)); + aRenderingContext.DrawRect(pageBounds); + } } //---------------------------------------------------------------------- diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.h b/mozilla/layout/html/base/src/nsSimplePageSequence.h index ce5a9b18f40..4295acb2d9b 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.h +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.h @@ -37,7 +37,8 @@ public: // nsIFrame NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); // nsIPageSequenceFrame NS_IMETHOD Print(nsIPresContext& aPresContext, @@ -51,7 +52,8 @@ protected: virtual void PaintChild(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, - nsIFrame* aFrame); + nsIFrame* aFrame, + nsFramePaintLayer aWhichLayer); NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();} NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();} diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 12f4d708077..1381ee2349a 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -109,7 +109,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, @@ -509,8 +510,12 @@ TextFrame::ContentChanged(nsIPresContext* aPresContext, NS_IMETHODIMP TextFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } if ((0 != (mFlags & TEXT_BLINK_ON)) && gBlinkTextOff) { return NS_OK; } diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index c9ac4754a71..826ad2f2e72 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -109,7 +109,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -148,7 +149,8 @@ public: */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); /** * @see nsIFrame::Reflow @@ -274,15 +276,18 @@ PRBool nsHTMLFrameOuterFrame::IsInline() NS_IMETHODIMP nsHTMLFrameOuterFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { //printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); if (nsnull != mFirstChild) { - mFirstChild->Paint(aPresContext, aRenderingContext, aDirtyRect); + mFirstChild->Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } if (IsInline()) { - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, + aDirtyRect, aWhichLayer); } else { return NS_OK; } @@ -582,8 +587,9 @@ nsHTMLFrameInnerFrame::SizeTo(nscoord aWidth, nscoord aHeight) NS_IMETHODIMP nsHTMLFrameInnerFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { //printf("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); return NS_OK; diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index ffa04d42060..f7352bb7627 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -81,7 +81,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -119,7 +120,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -476,10 +478,12 @@ nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, NS_IMETHODIMP nsHTMLFramesetFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { //printf("frameset paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, + aDirtyRect, aWhichLayer); } void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs) @@ -1486,8 +1490,12 @@ nsHTMLFramesetBorderFrame::Reflow(nsIPresContext& aPresContext, NS_METHOD nsHTMLFramesetBorderFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } //printf("border frame paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); nscolor WHITE = NS_RGB(255, 255, 255); nscolor bgColor = NS_RGB(200,200,200); @@ -1649,8 +1657,12 @@ nsHTMLFramesetBlankFrame::Reflow(nsIPresContext& aPresContext, NS_METHOD nsHTMLFramesetBlankFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { + if (eFramePaintLayer_Content != aWhichLayer) { + return NS_OK; + } nscolor white = NS_RGB(255,255,255); aRenderingContext.SetColor (white); // XXX FillRect doesn't seem to work diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.h b/mozilla/layout/html/document/src/nsFrameSetFrame.h index 6dad7f3bb88..098eedbcfb5 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.h +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.h @@ -117,7 +117,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp index 7d6fad4f583..6b7ddf5fe5a 100644 --- a/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp @@ -210,10 +210,12 @@ nsButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, NS_METHOD nsButtonControlFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintButton(aPresContext, aRenderingContext, aDirtyRect); - + if (eFramePaintLayer_Content == aWhichLayer) { + PaintButton(aPresContext, aRenderingContext, aDirtyRect); + } return NS_OK; } @@ -380,8 +382,8 @@ nsButtonControlFrame::GetFrameName(nsString& aResult) const void nsButtonControlFrame::PaintButton(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect) { nsString label; diff --git a/mozilla/layout/html/forms/src/nsButtonControlFrame.h b/mozilla/layout/html/forms/src/nsButtonControlFrame.h index e46093e9d20..c1439b21367 100644 --- a/mozilla/layout/html/forms/src/nsButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsButtonControlFrame.h @@ -25,8 +25,9 @@ class nsFileControlFrame; class nsButtonControlFrame : public nsFormControlFrame { public: NS_IMETHOD Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp index 4bccc2899dc..0362992c92a 100644 --- a/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp @@ -79,12 +79,13 @@ public: virtual void GetCurrentCheckState(PRBool* aState); virtual void PaintCheckBox(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect); NS_IMETHOD Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); //End of GFX-rendering methods protected: @@ -296,8 +297,8 @@ nsCheckboxControlFrame::Reset() void nsCheckboxControlFrame::PaintCheckBox(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect) { aRenderingContext.PushState(); @@ -326,11 +327,13 @@ nsCheckboxControlFrame::PaintCheckBox(nsIPresContext& aPresContext, NS_METHOD nsCheckboxControlFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintCheckBox(aPresContext, aRenderingContext, aDirtyRect); - + if (eFramePaintLayer_Content == aWhichLayer) { + PaintCheckBox(aPresContext, aRenderingContext, aDirtyRect); + } return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index 87df47b3fe6..37692d7eebf 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -70,7 +70,8 @@ public: NS_METHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("FieldSet", aResult); @@ -172,42 +173,45 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsFieldSetFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // Paint our background and border - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); + if (eFramePaintLayer_Underlay == aWhichLayer) { + // Paint our background and border + const nsStyleDisplay* disp = + (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - if (disp->mVisible && mRect.width && mRect.height) { - PRIntn skipSides = GetSkipSides(); - const nsStyleColor* color = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* spacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + if (disp->mVisible && mRect.width && mRect.height) { + PRIntn skipSides = GetSkipSides(); + const nsStyleColor* color = + (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* spacing = + (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - nsRect backgroundRect(0, 0, mRect.width, mRect.height); - // XXX our parent doesn't account for top and bottom margins yet, if we are inline - if (mInline) { - nsMargin margin; - spacing->CalcMarginFor(this, margin); - nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - margin.top - - margin.bottom - mTopBorderOffset); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); - } else { - nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - mTopBorderOffset); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); - } + nsRect backgroundRect(0, 0, mRect.width, mRect.height); + // XXX our parent doesn't account for top and bottom margins yet, if we are inline + if (mInline) { + nsMargin margin; + spacing->CalcMarginFor(this, margin); + nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - margin.top - + margin.bottom - mTopBorderOffset); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); + } else { + nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - mTopBorderOffset); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides, &mTopBorderGap); + } + } } - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { nsIView* view; GetView(view); if (nsnull != view) { diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index 814030fdeb6..5bfbf41062d 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -147,29 +147,19 @@ nsFormControlFrame::SetClickPoint(nscoord aX, nscoord aY) // they could be blended, and bordered, and so on... NS_METHOD nsFormControlFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - - if (disp->mVisible) { - // Make sure the widget is visible if it isn't currently visible -// if (PR_FALSE == mDidInit) { -// PostCreateWidget(&aPresContext); -// mDidInit = PR_TRUE; -// } - // Point borders/padding if any - return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); - } - return NS_OK; + return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); } void nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext, - const nsHTMLReflowState& aReflowState, - nsHTMLReflowMetrics& aDesiredLayoutSize, - nsSize& aDesiredWidgetSize) + const nsHTMLReflowState& aReflowState, + nsHTMLReflowMetrics& aDesiredLayoutSize, + nsSize& aDesiredWidgetSize) { // get the css size and let the frame use or override it nsSize styleSize; diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.h b/mozilla/layout/html/forms/src/nsFormControlFrame.h index 9e47311ef17..f022c1eb279 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.h @@ -111,7 +111,8 @@ public: */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 58cd203d85a..e7a55ec17ed 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -69,7 +69,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -526,10 +527,14 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - nsresult result = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); - if (NS_OK == result) { + nsresult result = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + if (NS_FAILED(result)) { + return result; + } + if (eFramePaintLayer_Overlay == aWhichLayer) { if (mGotFocus) { // draw dashed line to indicate selection, XXX don't calc rect every time const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); @@ -555,8 +560,8 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext, borderColors[i] = black; } nsCSSRendering::DrawDashedSides(0, aRenderingContext, borderStyles, borderColors, outside, - inside, PR_FALSE, nsnull); - } + inside, PR_FALSE, nsnull); + } } return result; } diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index 194377eb513..97836ae2574 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -72,7 +72,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, @@ -373,10 +374,11 @@ nsLabelFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsLabelFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.cpp b/mozilla/layout/html/forms/src/nsLegendFrame.cpp index 26e532917fa..69edf03313a 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLegendFrame.cpp @@ -111,9 +111,10 @@ nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_IMETHODIMP nsLegendFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.h b/mozilla/layout/html/forms/src/nsLegendFrame.h index b24f656cc71..84623cc2a74 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.h +++ b/mozilla/layout/html/forms/src/nsLegendFrame.h @@ -48,7 +48,8 @@ public: NS_METHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameName(nsString& aResult) const; diff --git a/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp index a5475344776..c440d3a4e09 100644 --- a/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp @@ -314,8 +314,8 @@ void nsRadioControlFrame::GetCurrentRadioState(PRBool *aState) void nsRadioControlFrame::PaintRadioButton(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect) { aRenderingContext.PushState(); @@ -350,10 +350,12 @@ nsRadioControlFrame::PaintRadioButton(nsIPresContext& aPresContext, NS_METHOD nsRadioControlFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintRadioButton(aPresContext, aRenderingContext, aDirtyRect); - + if (eFramePaintLayer_Content == aWhichLayer) { + PaintRadioButton(aPresContext, aRenderingContext, aDirtyRect); + } return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsRadioControlFrame.h b/mozilla/layout/html/forms/src/nsRadioControlFrame.h index fe41a30e769..d28e1b23fe8 100644 --- a/mozilla/layout/html/forms/src/nsRadioControlFrame.h +++ b/mozilla/layout/html/forms/src/nsRadioControlFrame.h @@ -62,8 +62,9 @@ public: virtual void GetCurrentRadioState(PRBool *aState); NS_IMETHOD Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); virtual void PaintRadioButton(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp b/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp index c72aa809188..209a474c693 100644 --- a/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp @@ -100,8 +100,9 @@ public: // Expect this code to repackaged and moved to a new location in the future. // NS_IMETHOD Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); virtual void PaintSelectControl(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -649,7 +650,8 @@ nsSelectControlFrame::PaintSelectControl(nsIPresContext& aPresContext, aRenderingContext.PushState(); - nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Content); /** * Resolve style for a pseudo frame within the given aParentContent & aParentContext. @@ -820,10 +822,12 @@ nsSelectControlFrame::PaintSelectControl(nsIPresContext& aPresContext, NS_METHOD nsSelectControlFrame::Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintSelectControl(aPresContext, aRenderingContext, aDirtyRect); - + if (eFramePaintLayer_Content == aWhichLayer) { + PaintSelectControl(aPresContext, aRenderingContext, aDirtyRect); + } return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index e02012c5906..4fcd5babd30 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -510,7 +510,8 @@ nsTextControlFrame::PaintTextControl(nsIPresContext& aPresContext, { aRenderingContext.PushState(); - nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect); + nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + eFramePaintLayer_Content); const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); @@ -654,9 +655,11 @@ nsTextControlFrame::PaintTextControl(nsIPresContext& aPresContext, NS_METHOD nsTextControlFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - PaintTextControl(aPresContext, aRenderingContext, aDirtyRect); - + if (eFramePaintLayer_Content == aWhichLayer) { + PaintTextControl(aPresContext, aRenderingContext, aDirtyRect); + } return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.h b/mozilla/layout/html/forms/src/nsTextControlFrame.h index 5f24f568eda..d57579b2faf 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.h @@ -68,8 +68,9 @@ public: // Expect this code to repackaged and moved to a new location in the future. // NS_IMETHOD Paint(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); virtual void PaintTextControl(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 548245b17ef..b169bae5418 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -50,47 +50,50 @@ static const PRBool gsDebugNT = PR_FALSE; NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); + if (eFramePaintLayer_Underlay == aWhichLayer) { + const nsStyleDisplay* disp = + (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - if (disp->mVisible) { - const nsStyleColor* myColor = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleSpacing* mySpacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - NS_ASSERTION(nsnull!=myColor, "bad style color"); - NS_ASSERTION(nsnull!=mySpacing, "bad style spacing"); + if (disp->mVisible) { + const nsStyleColor* myColor = + (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleSpacing* mySpacing = + (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + NS_ASSERTION(nsnull!=myColor, "bad style color"); + NS_ASSERTION(nsnull!=mySpacing, "bad style spacing"); - nsRect rect(0, 0, mRect.width, mRect.height); + nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *myColor, 0, 0); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myColor, 0, 0); - // empty cells do not render their border - PRBool renderBorder = PR_TRUE; - if (PR_TRUE==GetContentEmpty()) - { - const nsStyleTable* cellTableStyle; - GetStyleData(eStyleStruct_Table, ((const nsStyleStruct *&)cellTableStyle)); - if (NS_STYLE_TABLE_EMPTY_CELLS_HIDE==cellTableStyle->mEmptyCells) - renderBorder=PR_FALSE; - } - if (PR_TRUE==renderBorder) - { - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *mySpacing, 0); + // empty cells do not render their border + PRBool renderBorder = PR_TRUE; + if (PR_TRUE==GetContentEmpty()) + { + const nsStyleTable* cellTableStyle; + GetStyleData(eStyleStruct_Table, ((const nsStyleStruct *&)cellTableStyle)); + if (NS_STYLE_TABLE_EMPTY_CELLS_HIDE==cellTableStyle->mEmptyCells) + renderBorder=PR_FALSE; + } + if (PR_TRUE==renderBorder) + { + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *mySpacing, 0); + } } } // for debug... - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,128,128)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.h b/mozilla/layout/html/table/src/nsTableCellFrame.h index dce0738f811..b55917040cf 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.h +++ b/mozilla/layout/html/table/src/nsTableCellFrame.h @@ -53,7 +53,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp index 3cfe617d10f..6dc7a633a25 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp @@ -41,7 +41,8 @@ nsTableColFrame::nsTableColFrame() NS_METHOD nsTableColFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { if (gsDebug==PR_TRUE) printf("nsTableColFrame::Paint\n"); diff --git a/mozilla/layout/html/table/src/nsTableColFrame.h b/mozilla/layout/html/table/src/nsTableColFrame.h index ccbb1fee127..a2abcd9b423 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.h +++ b/mozilla/layout/html/table/src/nsTableColFrame.h @@ -43,7 +43,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 312820072ee..caebe072336 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -154,10 +154,11 @@ nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext, NS_METHOD nsTableColGroupFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { if (gsDebug==PR_TRUE) printf("nsTableColGroupFrame::Paint\n"); - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.h b/mozilla/layout/html/table/src/nsTableColGroupFrame.h index bb3759ef5b9..285dab9b036 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.h @@ -50,7 +50,8 @@ public: NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); /** reflow of a column group is a trivial matter of reflowing * the col group's children (columns), and setting this frame diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index ece78154fee..c566124db4d 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -1847,41 +1847,44 @@ nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex, /* SEC: TODO: adjust the rect for captions */ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer) { - // table paint code is concerned primarily with borders and bg color - const nsStyleDisplay* disp = - (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); + if (eFramePaintLayer_Underlay == aWhichLayer) { + // table paint code is concerned primarily with borders and bg color + const nsStyleDisplay* disp = + (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); - if (disp->mVisible) { - const nsStyleSpacing* spacing = - (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); - const nsStyleColor* color = - (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - const nsStyleTable* tableStyle = - (const nsStyleTable*)mStyleContext->GetStyleData(eStyleStruct_Table); + if (disp->mVisible) { + const nsStyleSpacing* spacing = + (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + const nsStyleColor* color = + (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); + const nsStyleTable* tableStyle = + (const nsStyleTable*)mStyleContext->GetStyleData(eStyleStruct_Table); - nsRect rect(0, 0, mRect.width, mRect.height); - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *color, 0, 0); - PRIntn skipSides = GetSkipSides(); - if (NS_STYLE_BORDER_SEPARATE==tableStyle->mBorderCollapse) - { - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, - aDirtyRect, rect, *spacing, skipSides); - } - else - { + nsRect rect(0, 0, mRect.width, mRect.height); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *color, 0, 0); + PRIntn skipSides = GetSkipSides(); + if (NS_STYLE_BORDER_SEPARATE==tableStyle->mBorderCollapse) + { + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *spacing, skipSides); + } + else + { + } } } // for debug... - if (nsIFrame::GetShowFrameBorders()) { + if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,128,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } - PaintChildren(aPresContext, aRenderingContext, aDirtyRect); + PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 839db62cb7c..075b7bb9586 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -126,7 +126,8 @@ public: /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer); /** inner tables are reflowed in two steps. *
diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
index d3dfea5b8db..6107eaceea9 100644
--- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
@@ -114,15 +114,16 @@ NS_IMETHODIMP nsTableOuterFrame::SetInitialChildList(nsIPresContext& aPresContex
 
 NS_METHOD nsTableOuterFrame::Paint(nsIPresContext& aPresContext,
                                    nsIRenderingContext& aRenderingContext,
-                                   const nsRect& aDirtyRect)
+                                   const nsRect& aDirtyRect,
+                                   nsFramePaintLayer aWhichLayer)
 {
   // for debug...
-  if (nsIFrame::GetShowFrameBorders()) {
+  if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) {
     aRenderingContext.SetColor(NS_RGB(255,0,0));
     aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
   }
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.h b/mozilla/layout/html/table/src/nsTableOuterFrame.h
index 49d2c105940..cfb3a40fff6 100644
--- a/mozilla/layout/html/table/src/nsTableOuterFrame.h
+++ b/mozilla/layout/html/table/src/nsTableOuterFrame.h
@@ -55,7 +55,8 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   NS_IMETHOD Reflow(nsIPresContext&          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
index 8f86c62e8f3..fea7aa075e1 100644
--- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
@@ -203,10 +203,10 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext,
           nsHTMLReflowState kidReflowState(aPresContext, cellFrame,
                                            aReflowState, nsSize(cellFrameSize.width, cellHeight),
                                            eReflowReason_Resize);
-          nsReflowStatus status;
           //XXX: the following reflow is necessary for any content of the cell
           //     whose height is a percent of the cell's height (maybe indirectly.)
           //     But some content crashes when this reflow is issued, to be investigated
+          //XXX nsReflowStatus status;
           //ReflowChild(cellFrame, aPresContext, desiredSize, kidReflowState, status);
           ((nsTableCellFrame *)cellFrame)->VerticallyAlignChild();
         }
@@ -252,7 +252,8 @@ void nsTableRowFrame::SetMaxChildHeight(nscoord aChildHeight, nscoord aTopMargin
 
 NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext,
                                  nsIRenderingContext& aRenderingContext,
-                                 const nsRect& aDirtyRect)
+                                 const nsRect& aDirtyRect,
+                                 nsFramePaintLayer aWhichLayer)
 {
   /*
   const nsStyleColor* myColor =
@@ -264,7 +265,7 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext,
   }
   */
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
@@ -285,8 +286,9 @@ nsTableRowFrame::GetSkipSides() const
   * we don't want to clip our children, so a cell can do a rowspan
   */
 void nsTableRowFrame::PaintChildren(nsIPresContext&      aPresContext,
-                                     nsIRenderingContext& aRenderingContext,
-                                     const nsRect&        aDirtyRect)
+                                    nsIRenderingContext& aRenderingContext,
+                                    const nsRect&        aDirtyRect,
+                                    nsFramePaintLayer aWhichLayer)
 {
   nsIFrame* kid = mFirstChild;
   while (nsnull != kid) {
@@ -306,8 +308,10 @@ void nsTableRowFrame::PaintChildren(nsIPresContext&      aPresContext,
                              damageArea.width, damageArea.height);
         aRenderingContext.PushState();
         aRenderingContext.Translate(kidRect.x, kidRect.y);
-        kid->Paint(aPresContext, aRenderingContext, kidDamageArea);
-        if (nsIFrame::GetShowFrameBorders()) {
+        kid->Paint(aPresContext, aRenderingContext, kidDamageArea,
+                   aWhichLayer);
+        if ((eFramePaintLayer_Overlay == aWhichLayer) &&
+            GetShowFrameBorders()) {
           aRenderingContext.SetColor(NS_RGB(255,0,0));
           aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
         }
diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.h b/mozilla/layout/html/table/src/nsTableRowFrame.h
index 9d330242001..31ad26f8a60 100644
--- a/mozilla/layout/html/table/src/nsTableRowFrame.h
+++ b/mozilla/layout/html/table/src/nsTableRowFrame.h
@@ -60,7 +60,8 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext&      aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect&        aDirtyRect);
+                   const nsRect&        aDirtyRect,
+                   nsFramePaintLayer    aWhichLayer);
 
 
   /** ask all children to paint themselves, without clipping (for cells with rowspan>1)
@@ -68,7 +69,8 @@ public:
     */
   virtual void PaintChildren(nsIPresContext&      aPresContext,
                              nsIRenderingContext& aRenderingContext,
-                             const nsRect&        aDirtyRect);
+                             const nsRect&        aDirtyRect,
+                             nsFramePaintLayer    aWhichLayer);
 
   /** calls Reflow for all of its child cells.
     * Cells with rowspan=1 are all set to the same height and stacked horizontally.
diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
index f793cf6fb34..377ce57f202 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
@@ -148,7 +148,8 @@ nsTableRowGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
 
 NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext& aPresContext,
                                       nsIRenderingContext& aRenderingContext,
-                                      const nsRect&        aDirtyRect)
+                                      const nsRect&        aDirtyRect,
+                                      nsFramePaintLayer aWhichLayer)
 {
 
   // for debug...
@@ -159,7 +160,7 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext& aPresContext,
   }
   */
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
@@ -183,7 +184,8 @@ nsTableRowGroupFrame::GetSkipSides() const
   */
 void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
                                          nsIRenderingContext& aRenderingContext,
-                                         const nsRect&        aDirtyRect)
+                                         const nsRect&        aDirtyRect,
+                                         nsFramePaintLayer    aWhichLayer)
 {
   nsIFrame* kid = mFirstChild;
   while (nsnull != kid) {
@@ -200,8 +202,8 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
                            damageArea.width, damageArea.height);
       aRenderingContext.PushState();
       aRenderingContext.Translate(kidRect.x, kidRect.y);
-      kid->Paint(aPresContext, aRenderingContext, kidDamageArea);
-      if (nsIFrame::GetShowFrameBorders()) {
+      kid->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer);
+      if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) {
         aRenderingContext.SetColor(NS_RGB(255,0,0));
         aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
       }
diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h
index 520e22e7791..4b659f547ad 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h
@@ -57,14 +57,16 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   /** ask all children to paint themselves, without clipping (for cells with rowspan>1)
     * @see nsIFrame::Paint 
     */
   virtual void PaintChildren(nsIPresContext&      aPresContext,
                              nsIRenderingContext& aRenderingContext,
-                             const nsRect&        aDirtyRect);
+                             const nsRect&        aDirtyRect,
+                             nsFramePaintLayer    aWhichLayer);
 
   /**
    * Find the correct descendant frame.
diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp
index 548245b17ef..b169bae5418 100644
--- a/mozilla/layout/tables/nsTableCellFrame.cpp
+++ b/mozilla/layout/tables/nsTableCellFrame.cpp
@@ -50,47 +50,50 @@ static const PRBool gsDebugNT = PR_FALSE;
 
 NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
                                   nsIRenderingContext& aRenderingContext,
-                                  const nsRect& aDirtyRect)
+                                  const nsRect& aDirtyRect,
+                                  nsFramePaintLayer aWhichLayer)
 {
-  const nsStyleDisplay* disp =
-    (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
+  if (eFramePaintLayer_Underlay == aWhichLayer) {
+    const nsStyleDisplay* disp =
+      (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
 
-  if (disp->mVisible) {
-    const nsStyleColor* myColor =
-      (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
-    const nsStyleSpacing* mySpacing =
-      (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
-    NS_ASSERTION(nsnull!=myColor, "bad style color");
-    NS_ASSERTION(nsnull!=mySpacing, "bad style spacing");
+    if (disp->mVisible) {
+      const nsStyleColor* myColor =
+        (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
+      const nsStyleSpacing* mySpacing =
+        (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
+      NS_ASSERTION(nsnull!=myColor, "bad style color");
+      NS_ASSERTION(nsnull!=mySpacing, "bad style spacing");
 
-    nsRect  rect(0, 0, mRect.width, mRect.height);
+      nsRect  rect(0, 0, mRect.width, mRect.height);
 
-    nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
-                                    aDirtyRect, rect, *myColor, 0, 0);
+      nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
+                                      aDirtyRect, rect, *myColor, 0, 0);
     
-    // empty cells do not render their border
-    PRBool renderBorder = PR_TRUE;
-    if (PR_TRUE==GetContentEmpty())
-    {
-      const nsStyleTable* cellTableStyle;
-      GetStyleData(eStyleStruct_Table, ((const nsStyleStruct *&)cellTableStyle)); 
-      if (NS_STYLE_TABLE_EMPTY_CELLS_HIDE==cellTableStyle->mEmptyCells)
-        renderBorder=PR_FALSE;
-    }
-    if (PR_TRUE==renderBorder)
-    {
-      nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
-                                  aDirtyRect, rect, *mySpacing, 0);
+      // empty cells do not render their border
+      PRBool renderBorder = PR_TRUE;
+      if (PR_TRUE==GetContentEmpty())
+      {
+        const nsStyleTable* cellTableStyle;
+        GetStyleData(eStyleStruct_Table, ((const nsStyleStruct *&)cellTableStyle)); 
+        if (NS_STYLE_TABLE_EMPTY_CELLS_HIDE==cellTableStyle->mEmptyCells)
+          renderBorder=PR_FALSE;
+      }
+      if (PR_TRUE==renderBorder)
+      {
+        nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
+                                    aDirtyRect, rect, *mySpacing, 0);
+      }
     }
   }
 
   // for debug...
-  if (nsIFrame::GetShowFrameBorders()) {
+  if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) {
     aRenderingContext.SetColor(NS_RGB(0,128,128));
     aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
   }
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h
index dce0738f811..b55917040cf 100644
--- a/mozilla/layout/tables/nsTableCellFrame.h
+++ b/mozilla/layout/tables/nsTableCellFrame.h
@@ -53,7 +53,8 @@ public:
 
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   NS_IMETHOD Reflow(nsIPresContext&      aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp
index 3cfe617d10f..6dc7a633a25 100644
--- a/mozilla/layout/tables/nsTableColFrame.cpp
+++ b/mozilla/layout/tables/nsTableColFrame.cpp
@@ -41,7 +41,8 @@ nsTableColFrame::nsTableColFrame()
 
 NS_METHOD nsTableColFrame::Paint(nsIPresContext& aPresContext,
                                  nsIRenderingContext& aRenderingContext,
-                                 const nsRect& aDirtyRect)
+                                 const nsRect& aDirtyRect,
+                                 nsFramePaintLayer aWhichLayer)
 {
   if (gsDebug==PR_TRUE)
     printf("nsTableColFrame::Paint\n");
diff --git a/mozilla/layout/tables/nsTableColFrame.h b/mozilla/layout/tables/nsTableColFrame.h
index ccbb1fee127..a2abcd9b423 100644
--- a/mozilla/layout/tables/nsTableColFrame.h
+++ b/mozilla/layout/tables/nsTableColFrame.h
@@ -43,7 +43,8 @@ public:
 
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   NS_IMETHOD Reflow(nsIPresContext&          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp
index 312820072ee..caebe072336 100644
--- a/mozilla/layout/tables/nsTableColGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp
@@ -154,10 +154,11 @@ nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
 
 NS_METHOD nsTableColGroupFrame::Paint(nsIPresContext& aPresContext,
                                       nsIRenderingContext& aRenderingContext,
-                                      const nsRect&        aDirtyRect)
+                                      const nsRect&        aDirtyRect,
+                                      nsFramePaintLayer aWhichLayer)
 {
   if (gsDebug==PR_TRUE) printf("nsTableColGroupFrame::Paint\n");
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
diff --git a/mozilla/layout/tables/nsTableColGroupFrame.h b/mozilla/layout/tables/nsTableColGroupFrame.h
index bb3759ef5b9..285dab9b036 100644
--- a/mozilla/layout/tables/nsTableColGroupFrame.h
+++ b/mozilla/layout/tables/nsTableColGroupFrame.h
@@ -50,7 +50,8 @@ public:
 
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   /** reflow of a column group is a trivial matter of reflowing
     * the col group's children (columns), and setting this frame
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index ece78154fee..c566124db4d 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -1847,41 +1847,44 @@ nsTableFrame::GetAdditionalChildListName(PRInt32   aIndex,
 /* SEC: TODO: adjust the rect for captions */
 NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext,
                               nsIRenderingContext& aRenderingContext,
-                              const nsRect& aDirtyRect)
+                              const nsRect& aDirtyRect,
+                              nsFramePaintLayer aWhichLayer)
 {
-  // table paint code is concerned primarily with borders and bg color
-  const nsStyleDisplay* disp =
-    (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
+  if (eFramePaintLayer_Underlay == aWhichLayer) {
+    // table paint code is concerned primarily with borders and bg color
+    const nsStyleDisplay* disp =
+      (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
 
-  if (disp->mVisible) {
-    const nsStyleSpacing* spacing =
-      (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
-    const nsStyleColor* color =
-      (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
-    const nsStyleTable* tableStyle =
-      (const nsStyleTable*)mStyleContext->GetStyleData(eStyleStruct_Table);
+    if (disp->mVisible) {
+      const nsStyleSpacing* spacing =
+        (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
+      const nsStyleColor* color =
+        (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
+      const nsStyleTable* tableStyle =
+        (const nsStyleTable*)mStyleContext->GetStyleData(eStyleStruct_Table);
 
-    nsRect  rect(0, 0, mRect.width, mRect.height);
-    nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
-                                    aDirtyRect, rect, *color, 0, 0);
-    PRIntn skipSides = GetSkipSides();
-    if (NS_STYLE_BORDER_SEPARATE==tableStyle->mBorderCollapse)
-    {
-      nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
-                                  aDirtyRect, rect, *spacing, skipSides);
-    }
-    else
-    {
+      nsRect  rect(0, 0, mRect.width, mRect.height);
+      nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
+                                      aDirtyRect, rect, *color, 0, 0);
+      PRIntn skipSides = GetSkipSides();
+      if (NS_STYLE_BORDER_SEPARATE==tableStyle->mBorderCollapse)
+      {
+        nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
+                                    aDirtyRect, rect, *spacing, skipSides);
+      }
+      else
+      {
+      }
     }
   }
 
   // for debug...
-  if (nsIFrame::GetShowFrameBorders()) {
+  if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) {
     aRenderingContext.SetColor(NS_RGB(0,128,0));
     aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
   }
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h
index 839db62cb7c..075b7bb9586 100644
--- a/mozilla/layout/tables/nsTableFrame.h
+++ b/mozilla/layout/tables/nsTableFrame.h
@@ -126,7 +126,8 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   /** inner tables are reflowed in two steps.
     * 
diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp
index d3dfea5b8db..6107eaceea9 100644
--- a/mozilla/layout/tables/nsTableOuterFrame.cpp
+++ b/mozilla/layout/tables/nsTableOuterFrame.cpp
@@ -114,15 +114,16 @@ NS_IMETHODIMP nsTableOuterFrame::SetInitialChildList(nsIPresContext& aPresContex
 
 NS_METHOD nsTableOuterFrame::Paint(nsIPresContext& aPresContext,
                                    nsIRenderingContext& aRenderingContext,
-                                   const nsRect& aDirtyRect)
+                                   const nsRect& aDirtyRect,
+                                   nsFramePaintLayer aWhichLayer)
 {
   // for debug...
-  if (nsIFrame::GetShowFrameBorders()) {
+  if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) {
     aRenderingContext.SetColor(NS_RGB(255,0,0));
     aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
   }
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h
index 49d2c105940..cfb3a40fff6 100644
--- a/mozilla/layout/tables/nsTableOuterFrame.h
+++ b/mozilla/layout/tables/nsTableOuterFrame.h
@@ -55,7 +55,8 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   NS_IMETHOD Reflow(nsIPresContext&          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp
index 8f86c62e8f3..fea7aa075e1 100644
--- a/mozilla/layout/tables/nsTableRowFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowFrame.cpp
@@ -203,10 +203,10 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext,
           nsHTMLReflowState kidReflowState(aPresContext, cellFrame,
                                            aReflowState, nsSize(cellFrameSize.width, cellHeight),
                                            eReflowReason_Resize);
-          nsReflowStatus status;
           //XXX: the following reflow is necessary for any content of the cell
           //     whose height is a percent of the cell's height (maybe indirectly.)
           //     But some content crashes when this reflow is issued, to be investigated
+          //XXX nsReflowStatus status;
           //ReflowChild(cellFrame, aPresContext, desiredSize, kidReflowState, status);
           ((nsTableCellFrame *)cellFrame)->VerticallyAlignChild();
         }
@@ -252,7 +252,8 @@ void nsTableRowFrame::SetMaxChildHeight(nscoord aChildHeight, nscoord aTopMargin
 
 NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext,
                                  nsIRenderingContext& aRenderingContext,
-                                 const nsRect& aDirtyRect)
+                                 const nsRect& aDirtyRect,
+                                 nsFramePaintLayer aWhichLayer)
 {
   /*
   const nsStyleColor* myColor =
@@ -264,7 +265,7 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext,
   }
   */
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
@@ -285,8 +286,9 @@ nsTableRowFrame::GetSkipSides() const
   * we don't want to clip our children, so a cell can do a rowspan
   */
 void nsTableRowFrame::PaintChildren(nsIPresContext&      aPresContext,
-                                     nsIRenderingContext& aRenderingContext,
-                                     const nsRect&        aDirtyRect)
+                                    nsIRenderingContext& aRenderingContext,
+                                    const nsRect&        aDirtyRect,
+                                    nsFramePaintLayer aWhichLayer)
 {
   nsIFrame* kid = mFirstChild;
   while (nsnull != kid) {
@@ -306,8 +308,10 @@ void nsTableRowFrame::PaintChildren(nsIPresContext&      aPresContext,
                              damageArea.width, damageArea.height);
         aRenderingContext.PushState();
         aRenderingContext.Translate(kidRect.x, kidRect.y);
-        kid->Paint(aPresContext, aRenderingContext, kidDamageArea);
-        if (nsIFrame::GetShowFrameBorders()) {
+        kid->Paint(aPresContext, aRenderingContext, kidDamageArea,
+                   aWhichLayer);
+        if ((eFramePaintLayer_Overlay == aWhichLayer) &&
+            GetShowFrameBorders()) {
           aRenderingContext.SetColor(NS_RGB(255,0,0));
           aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
         }
diff --git a/mozilla/layout/tables/nsTableRowFrame.h b/mozilla/layout/tables/nsTableRowFrame.h
index 9d330242001..31ad26f8a60 100644
--- a/mozilla/layout/tables/nsTableRowFrame.h
+++ b/mozilla/layout/tables/nsTableRowFrame.h
@@ -60,7 +60,8 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext&      aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect&        aDirtyRect);
+                   const nsRect&        aDirtyRect,
+                   nsFramePaintLayer    aWhichLayer);
 
 
   /** ask all children to paint themselves, without clipping (for cells with rowspan>1)
@@ -68,7 +69,8 @@ public:
     */
   virtual void PaintChildren(nsIPresContext&      aPresContext,
                              nsIRenderingContext& aRenderingContext,
-                             const nsRect&        aDirtyRect);
+                             const nsRect&        aDirtyRect,
+                             nsFramePaintLayer    aWhichLayer);
 
   /** calls Reflow for all of its child cells.
     * Cells with rowspan=1 are all set to the same height and stacked horizontally.
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
index f793cf6fb34..377ce57f202 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
@@ -148,7 +148,8 @@ nsTableRowGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
 
 NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext& aPresContext,
                                       nsIRenderingContext& aRenderingContext,
-                                      const nsRect&        aDirtyRect)
+                                      const nsRect&        aDirtyRect,
+                                      nsFramePaintLayer aWhichLayer)
 {
 
   // for debug...
@@ -159,7 +160,7 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext& aPresContext,
   }
   */
 
-  PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
+  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
   return NS_OK;
 }
 
@@ -183,7 +184,8 @@ nsTableRowGroupFrame::GetSkipSides() const
   */
 void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
                                          nsIRenderingContext& aRenderingContext,
-                                         const nsRect&        aDirtyRect)
+                                         const nsRect&        aDirtyRect,
+                                         nsFramePaintLayer    aWhichLayer)
 {
   nsIFrame* kid = mFirstChild;
   while (nsnull != kid) {
@@ -200,8 +202,8 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
                            damageArea.width, damageArea.height);
       aRenderingContext.PushState();
       aRenderingContext.Translate(kidRect.x, kidRect.y);
-      kid->Paint(aPresContext, aRenderingContext, kidDamageArea);
-      if (nsIFrame::GetShowFrameBorders()) {
+      kid->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer);
+      if ((eFramePaintLayer_Overlay == aWhichLayer) && GetShowFrameBorders()) {
         aRenderingContext.SetColor(NS_RGB(255,0,0));
         aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
       }
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h
index 520e22e7791..4b659f547ad 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.h
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.h
@@ -57,14 +57,16 @@ public:
   /** @see nsIFrame::Paint */
   NS_IMETHOD Paint(nsIPresContext& aPresContext,
                    nsIRenderingContext& aRenderingContext,
-                   const nsRect& aDirtyRect);
+                   const nsRect& aDirtyRect,
+                   nsFramePaintLayer aWhichLayer);
 
   /** ask all children to paint themselves, without clipping (for cells with rowspan>1)
     * @see nsIFrame::Paint 
     */
   virtual void PaintChildren(nsIPresContext&      aPresContext,
                              nsIRenderingContext& aRenderingContext,
-                             const nsRect&        aDirtyRect);
+                             const nsRect&        aDirtyRect,
+                             nsFramePaintLayer    aWhichLayer);
 
   /**
    * Find the correct descendant frame.