From 3bfeb7864155ae6e9bec68b7b95ac1651fb7d873 Mon Sep 17 00:00:00 2001 From: "mats.palmgren@bredband.net" Date: Sun, 22 Jul 2007 07:43:23 -0700 Subject: [PATCH] Remove nsDirectionalFrame::QueryInterface(), add GetFrameName(), and some other minor cleanup. b=385921 r+sr=dbaron --- layout/base/nsBidiPresUtils.cpp | 10 ++++------ layout/generic/nsBidiFrames.cpp | 28 +++++----------------------- layout/generic/nsBidiFrames.h | 22 ++++++++++------------ 3 files changed, 19 insertions(+), 41 deletions(-) diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index a24b0095a0f..312336fd5bc 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -592,18 +592,16 @@ nsBidiPresUtils::CreateBlockBuffer(nsPresContext* aPresContext) } else if (nsGkAtoms::brFrame == frameType) { // break frame // Append line separator - mBuffer.Append( (PRUnichar) kLineSeparator); + mBuffer.Append(kLineSeparator); } else if (nsGkAtoms::directionalFrame == frameType) { - nsDirectionalFrame* dirFrame; - frame->QueryInterface(NS_GET_IID(nsDirectionalFrame), - (void**) &dirFrame); - mBuffer.Append(dirFrame->GetChar() ); + nsDirectionalFrame* dirFrame = static_cast(frame); + mBuffer.Append(dirFrame->GetChar()); } else { // not text frame // See the Unicode Bidi Algorithm: // "...inline objects (such as graphics) are treated as if they are ... U+FFFC" - mBuffer.Append( (PRUnichar) kObjectSubstitute); + mBuffer.Append(kObjectSubstitute); } } // XXX: TODO: Handle preformatted text ('\n') diff --git a/layout/generic/nsBidiFrames.cpp b/layout/generic/nsBidiFrames.cpp index 1ec7efdb438..e6c237b67c9 100644 --- a/layout/generic/nsBidiFrames.cpp +++ b/layout/generic/nsBidiFrames.cpp @@ -51,37 +51,19 @@ nsDirectionalFrame::~nsDirectionalFrame() { } -PRUnichar -nsDirectionalFrame::GetChar(void) const -{ - return mChar; -} - -/** - * Get the "type" of the frame - * - * @see nsGkAtoms::directionalFrame - */ nsIAtom* nsDirectionalFrame::GetType() const { - return nsGkAtoms::directionalFrame; + return nsGkAtoms::directionalFrame; } +#ifdef NS_DEBUG NS_IMETHODIMP -nsDirectionalFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +nsDirectionalFrame::GetFrameName(nsAString& aResult) const { - nsresult rv = NS_NOINTERFACE; - - if (!aInstancePtr) { - rv = NS_ERROR_NULL_POINTER; - } - else if (aIID.Equals(NS_GET_IID(nsDirectionalFrame) ) ) { - *aInstancePtr = (void*) this; - rv = NS_OK; - } - return rv; + return MakeFrameName(NS_LITERAL_STRING("Directional"), aResult); } +#endif nsIFrame* NS_NewDirectionalFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUnichar aChar) diff --git a/layout/generic/nsBidiFrames.h b/layout/generic/nsBidiFrames.h index 5423ff92cdb..35e225b5525 100644 --- a/layout/generic/nsBidiFrames.h +++ b/layout/generic/nsBidiFrames.h @@ -44,11 +44,6 @@ #include "nsFrame.h" -// IID for the nsDirectionalFrame interface -// {90D69900-67AF-11d4-BA59-006008CD3717} -#define NS_DIRECTIONAL_FRAME_IID \ -{ 0x90d69900, 0x67af, 0x11d4, { 0xba, 0x59, 0x00, 0x60, 0x08, 0xcd, 0x37, 0x17 } } - class nsDirectionalFrame : public nsFrame { protected: @@ -57,20 +52,23 @@ protected: public: nsDirectionalFrame(nsStyleContext* aContext, PRUnichar aChar); - NS_DECLARE_STATIC_IID_ACCESSOR(NS_DIRECTIONAL_FRAME_IID) - - NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - + /** + * Get the "type" of the frame + * + * @see nsGkAtoms::directionalFrame + */ virtual nsIAtom* GetType() const; - PRUnichar GetChar(void) const; + PRUnichar GetChar() const { return mChar; } + +#ifdef NS_DEBUG + NS_IMETHOD GetFrameName(nsAString& aResult) const; +#endif private: PRUnichar mChar; }; -NS_DEFINE_STATIC_IID_ACCESSOR(nsDirectionalFrame, NS_DIRECTIONAL_FRAME_IID) #endif /* nsBidiFrames_h___ */ #endif /* IBMBIDI */ -