diff --git a/layout/base/src/nsFrame.cpp b/layout/base/src/nsFrame.cpp index 47b801aa498..2ac7ea1f0c0 100644 --- a/layout/base/src/nsFrame.cpp +++ b/layout/base/src/nsFrame.cpp @@ -31,6 +31,7 @@ #include "prlog.h" #include "prprf.h" #include +#include "nsIPtr.h" #define DO_SELECTION 0 @@ -40,6 +41,9 @@ #include "nsIDeviceContext.h" #include "nsIPresShell.h" +NS_DEF_PTR(nsIView); +NS_DEF_PTR(nsIViewManager); + // Kludged Content stuff nsIFrame * fFrameArray[1024]; nsIContent * fContentArray[1024]; @@ -1255,6 +1259,26 @@ NS_METHOD nsFrame::GetWindow(nsIWidget*& aWindow) const 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 NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const diff --git a/layout/base/src/nsFrame.h b/layout/base/src/nsFrame.h index 2225e433e44..044d2bb4766 100644 --- a/layout/base/src/nsFrame.h +++ b/layout/base/src/nsFrame.h @@ -77,6 +77,7 @@ public: nsIContent* aContent, nsIFrame* aParent); + // nsISupports NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // Overloaded new operator. Initializes the memory to 0 @@ -84,6 +85,7 @@ public: NS_IMETHOD DeleteFrame(); + // nsIFrame NS_IMETHOD GetContent(nsIContent*& aContent) const; NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const; @@ -131,7 +133,7 @@ public: NS_IMETHOD GetFrameState(nsFrameState& aResult); NS_IMETHOD SetFrameState(nsFrameState aNewState); - // Resize reflow methods + // Reflow methods NS_IMETHOD WillReflow(nsIPresContext& aPresContext); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); @@ -208,6 +210,10 @@ public: NS_IMETHOD GetNextSibling(nsIFrame*& aNextSibling) const; 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 NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; NS_IMETHOD ListTag(FILE* out = stdout) const;