This commit is contained in:
kipp%netscape.com 1998-12-18 15:54:23 +00:00
Родитель bff632482d
Коммит c29e5116c7
110 изменённых файлов: 1152 добавлений и 853 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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.

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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));

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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.

Просмотреть файл

@ -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();

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);
}
}
//----------------------------------------------------------------------

Просмотреть файл

@ -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();}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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));

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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();

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}
}
//----------------------------------------------------------------------

Просмотреть файл

@ -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();}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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");

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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.
* <pre>

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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");

Просмотреть файл

@ -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,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше