Remove nsDirectionalFrame::QueryInterface(), add GetFrameName(), and some other minor cleanup. b=385921 r+sr=dbaron

This commit is contained in:
mats.palmgren@bredband.net 2007-07-22 07:43:23 -07:00
parent a2e1cce21c
commit d6eb0045a2
3 changed files with 19 additions and 41 deletions

View File

@ -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<nsDirectionalFrame*>(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')

View File

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

View File

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