Added member function Invalidate()

This commit is contained in:
troy 1998-06-02 05:28:11 +00:00
Родитель 652077015d
Коммит f88c0a816c
2 изменённых файлов: 31 добавлений и 1 удалений

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

@ -31,6 +31,7 @@
#include "prlog.h" #include "prlog.h"
#include "prprf.h" #include "prprf.h"
#include <stdarg.h> #include <stdarg.h>
#include "nsIPtr.h"
#define DO_SELECTION 0 #define DO_SELECTION 0
@ -40,6 +41,9 @@
#include "nsIDeviceContext.h" #include "nsIDeviceContext.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
NS_DEF_PTR(nsIView);
NS_DEF_PTR(nsIViewManager);
// Kludged Content stuff // Kludged Content stuff
nsIFrame * fFrameArray[1024]; nsIFrame * fFrameArray[1024];
nsIContent * fContentArray[1024]; nsIContent * fContentArray[1024];
@ -1255,6 +1259,26 @@ NS_METHOD nsFrame::GetWindow(nsIWidget*& aWindow) const
return NS_OK; return NS_OK;
} }
void nsFrame::Invalidate(const nsRect& aDamageRect) const
{
nsIViewManagerPtr viewManager;
if (nsnull != mView) {
viewManager = mView->GetViewManager();
viewManager->UpdateView(mView, aDamageRect, 0);
} else {
nsRect rect(aDamageRect);
nsPoint offset;
nsIViewPtr view;
GetOffsetFromView(offset, view.AssignRef());
NS_ASSERTION(nsnull != view, "no view");
rect += offset;
viewManager = view->GetViewManager();
viewManager->UpdateView(view, rect, 0);
}
}
// Style sizing methods // Style sizing methods
NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const

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

@ -77,6 +77,7 @@ public:
nsIContent* aContent, nsIContent* aContent,
nsIFrame* aParent); nsIFrame* aParent);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// Overloaded new operator. Initializes the memory to 0 // Overloaded new operator. Initializes the memory to 0
@ -84,6 +85,7 @@ public:
NS_IMETHOD DeleteFrame(); NS_IMETHOD DeleteFrame();
// nsIFrame
NS_IMETHOD GetContent(nsIContent*& aContent) const; NS_IMETHOD GetContent(nsIContent*& aContent) const;
NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const; NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const;
@ -131,7 +133,7 @@ public:
NS_IMETHOD GetFrameState(nsFrameState& aResult); NS_IMETHOD GetFrameState(nsFrameState& aResult);
NS_IMETHOD SetFrameState(nsFrameState aNewState); NS_IMETHOD SetFrameState(nsFrameState aNewState);
// Resize reflow methods // Reflow methods
NS_IMETHOD WillReflow(nsIPresContext& aPresContext); NS_IMETHOD WillReflow(nsIPresContext& aPresContext);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext, NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus); nsDidReflowStatus aStatus);
@ -208,6 +210,10 @@ public:
NS_IMETHOD GetNextSibling(nsIFrame*& aNextSibling) const; NS_IMETHOD GetNextSibling(nsIFrame*& aNextSibling) const;
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling); NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling);
// Invalidate part of the frame by asking the view manager to repaint.
// aDamageRect is in the frame's local coordinate space
void Invalidate(const nsRect& aDamageRect) const;
// Debugging // Debugging
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
NS_IMETHOD ListTag(FILE* out = stdout) const; NS_IMETHOD ListTag(FILE* out = stdout) const;