зеркало из https://github.com/mozilla/gecko-dev.git
assorted work to expose nav html dtd to the editor
This commit is contained in:
Родитель
0cb63afd29
Коммит
2ec53e1f90
|
@ -499,6 +499,11 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
|
|||
mPresShell->GetPresContext(getter_AddRefs(context));
|
||||
context->SetLinkHandler(0);
|
||||
|
||||
// Set up the DTD
|
||||
// XXX - in the long run we want to get this from the document, but there
|
||||
// is no way to do that right now. So we leave it null here and set
|
||||
// up a nav html dtd in nsHTMLEditor::Init
|
||||
|
||||
// Init mEditProperty
|
||||
nsresult result = NS_NewEditProperty(getter_AddRefs(mEditProperty));
|
||||
if (NS_FAILED(result)) { return result; }
|
||||
|
@ -3302,6 +3307,29 @@ nsEditor::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEditor::CanContainTag(nsIDOMNode* aParent, const nsString &aTag)
|
||||
{
|
||||
// if we don't have a dtd then assume we can insert whatever want
|
||||
if (!mDTD) return PR_TRUE;
|
||||
|
||||
PRInt32 childTagEnum, parentTagEnum;
|
||||
nsString parentStringTag;
|
||||
nsString non_const_aTag(aTag);
|
||||
nsresult res = mDTD->StringTagToIntTag(non_const_aTag,&childTagEnum);
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> parentElement = do_QueryInterface(aParent);
|
||||
if (!parentElement) return PR_FALSE;
|
||||
|
||||
parentElement->GetTagName(parentStringTag);
|
||||
res = mDTD->StringTagToIntTag(parentStringTag,&parentTagEnum);
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
|
||||
return mDTD->CanContain(parentTagEnum, childTagEnum);
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIDTD.h"
|
||||
|
||||
class nsIEditActionListener;
|
||||
class nsIDOMCharacterData;
|
||||
|
@ -100,6 +101,7 @@ private:
|
|||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
protected:
|
||||
nsIDOMDocument * mDoc;
|
||||
nsCOMPtr<nsIDTD> mDTD;
|
||||
// Services are not nsCOMPtr friendly
|
||||
nsIPref* mPrefs;
|
||||
|
||||
|
@ -559,6 +561,9 @@ public:
|
|||
/** returns PR_TRUE if aNode is of the type implied by aTag */
|
||||
static PRBool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag);
|
||||
|
||||
/** returns PR_TRUE if aParent can contain a child of type aTag */
|
||||
PRBool CanContainTag(nsIDOMNode* aParent, const nsString &aTag);
|
||||
|
||||
/** returns PR_TRUE if aNode is an editable node */
|
||||
PRBool IsEditable(nsIDOMNode *aNode);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "nsHTMLEditRules.h"
|
||||
#include "nsEditor.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsTextEditor.h"
|
||||
#include "PlaceholderTxn.h"
|
||||
#include "InsertTextTxn.h"
|
||||
|
@ -747,9 +748,16 @@ nsHTMLEditRules::WillIndent(nsIDOMSelection *aSelection, PRBool *aCancel)
|
|||
if (!curQuote || transitionList[i])
|
||||
{
|
||||
nsAutoString quoteType("blockquote");
|
||||
res = mEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curQuote is now the correct thing to put curNode in
|
||||
if (mEditor->CanContainTag(curParent,quoteType))
|
||||
{
|
||||
res = mEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curQuote is now the correct thing to put curNode in
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("trying to put a blockquote in a bad place\n");
|
||||
}
|
||||
}
|
||||
|
||||
// tuck the node into the end of the active blockquote
|
||||
|
|
|
@ -63,6 +63,12 @@ const unsigned char nbsp = 160;
|
|||
#include "nsJSEditorLog.h"
|
||||
#endif // ENABLE_JS_EDITOR_LOG
|
||||
|
||||
// HACK - CID for NavDTD until we can get at dtd via the document
|
||||
// {a6cf9107-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_CNAVDTD_CID \
|
||||
{ 0xa6cf9107, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
static NS_DEFINE_CID(kCNavDTDCID, NS_CNAVDTD_CID);
|
||||
|
||||
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
|
||||
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
|
||||
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
|
||||
|
@ -129,7 +135,16 @@ NS_IMETHODIMP nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
|||
nsresult res=NS_ERROR_NULL_POINTER;
|
||||
if ((nsnull!=aDoc) && (nsnull!=aPresShell))
|
||||
{
|
||||
return nsTextEditor::Init(aDoc, aPresShell);
|
||||
res = nsTextEditor::Init(aDoc, aPresShell);
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
// Set up a DTD XXX XXX
|
||||
// HACK: This should have happened in a document specific way
|
||||
// in nsEditor::Init(), but we dont' have a way to do that yet
|
||||
res = nsComponentManager::CreateInstance(kCNavDTDCID, nsnull,
|
||||
nsIDTD::GetIID(), getter_AddRefs(mDTD));
|
||||
if (!mDTD) res = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -2233,12 +2248,6 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::CanContainElement(nsIDOMNode* aParent, nsIDOMElement* aElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
||||
{
|
||||
|
@ -2752,55 +2761,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
|
|||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLEditor::CanContainTag(nsIDOMNode* aParent, const nsString &aTag)
|
||||
{
|
||||
if (!aParent) return PR_FALSE;
|
||||
|
||||
static nsAutoString ulTag = "ul";
|
||||
static nsAutoString olTag = "ol";
|
||||
static nsAutoString liTag = "li";
|
||||
static nsAutoString bodyTag = "body";
|
||||
static nsAutoString tdTag = "td";
|
||||
static nsAutoString thTag = "th";
|
||||
static nsAutoString bqTag = "blockquote";
|
||||
|
||||
nsCOMPtr<nsIAtom> pTagAtom = GetTag(aParent);
|
||||
nsAutoString pTag;
|
||||
pTagAtom->ToString(pTag);
|
||||
|
||||
// flesh this out...
|
||||
// for now, only lists and blockquotes are using this funct
|
||||
|
||||
if (aTag.EqualsIgnoreCase(ulTag) ||
|
||||
aTag.EqualsIgnoreCase(olTag) )
|
||||
{
|
||||
if (pTag.EqualsIgnoreCase(bodyTag) ||
|
||||
pTag.EqualsIgnoreCase(tdTag) ||
|
||||
pTag.EqualsIgnoreCase(thTag) ||
|
||||
pTag.EqualsIgnoreCase(ulTag) ||
|
||||
pTag.EqualsIgnoreCase(olTag) ||
|
||||
pTag.EqualsIgnoreCase(liTag) ||
|
||||
pTag.EqualsIgnoreCase(bqTag) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (aTag.EqualsIgnoreCase(bqTag) )
|
||||
{
|
||||
if (pTag.EqualsIgnoreCase(bodyTag) ||
|
||||
pTag.EqualsIgnoreCase(tdTag) ||
|
||||
pTag.EqualsIgnoreCase(thTag) ||
|
||||
pTag.EqualsIgnoreCase(liTag) ||
|
||||
pTag.EqualsIgnoreCase(bqTag) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
|
||||
{
|
||||
|
|
|
@ -155,7 +155,6 @@ public:
|
|||
// This should replace InsertLink and InsertImage once it is working
|
||||
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CanContainElement(nsIDOMNode* aParent, nsIDOMElement* aElement);
|
||||
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection);
|
||||
NS_IMETHOD SaveHLineSettings(nsIDOMElement* aElement);
|
||||
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
|
||||
|
@ -185,10 +184,9 @@ public:
|
|||
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
|
||||
NS_IMETHOD JoinTableCells(PRBool aCellToRight);
|
||||
|
||||
// Data members
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
// rules initialization
|
||||
|
||||
virtual void InitRules();
|
||||
|
@ -216,8 +214,6 @@ protected:
|
|||
|
||||
NS_IMETHOD RemoveParentFromBlockContent(const nsString &aParentTag, nsIDOMRange *aRange);
|
||||
|
||||
PRBool CanContainTag(nsIDOMNode* aParent, const nsString &aTag);
|
||||
|
||||
NS_IMETHOD IsRootTag(nsString &aTag, PRBool &aIsTag);
|
||||
|
||||
NS_IMETHOD IsSubordinateBlock(nsString &aTag, PRBool &aIsTag);
|
||||
|
|
|
@ -499,6 +499,11 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
|
|||
mPresShell->GetPresContext(getter_AddRefs(context));
|
||||
context->SetLinkHandler(0);
|
||||
|
||||
// Set up the DTD
|
||||
// XXX - in the long run we want to get this from the document, but there
|
||||
// is no way to do that right now. So we leave it null here and set
|
||||
// up a nav html dtd in nsHTMLEditor::Init
|
||||
|
||||
// Init mEditProperty
|
||||
nsresult result = NS_NewEditProperty(getter_AddRefs(mEditProperty));
|
||||
if (NS_FAILED(result)) { return result; }
|
||||
|
@ -3302,6 +3307,29 @@ nsEditor::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEditor::CanContainTag(nsIDOMNode* aParent, const nsString &aTag)
|
||||
{
|
||||
// if we don't have a dtd then assume we can insert whatever want
|
||||
if (!mDTD) return PR_TRUE;
|
||||
|
||||
PRInt32 childTagEnum, parentTagEnum;
|
||||
nsString parentStringTag;
|
||||
nsString non_const_aTag(aTag);
|
||||
nsresult res = mDTD->StringTagToIntTag(non_const_aTag,&childTagEnum);
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> parentElement = do_QueryInterface(aParent);
|
||||
if (!parentElement) return PR_FALSE;
|
||||
|
||||
parentElement->GetTagName(parentStringTag);
|
||||
res = mDTD->StringTagToIntTag(parentStringTag,&parentTagEnum);
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
|
||||
return mDTD->CanContain(parentTagEnum, childTagEnum);
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIDTD.h"
|
||||
|
||||
class nsIEditActionListener;
|
||||
class nsIDOMCharacterData;
|
||||
|
@ -100,6 +101,7 @@ private:
|
|||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
protected:
|
||||
nsIDOMDocument * mDoc;
|
||||
nsCOMPtr<nsIDTD> mDTD;
|
||||
// Services are not nsCOMPtr friendly
|
||||
nsIPref* mPrefs;
|
||||
|
||||
|
@ -559,6 +561,9 @@ public:
|
|||
/** returns PR_TRUE if aNode is of the type implied by aTag */
|
||||
static PRBool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag);
|
||||
|
||||
/** returns PR_TRUE if aParent can contain a child of type aTag */
|
||||
PRBool CanContainTag(nsIDOMNode* aParent, const nsString &aTag);
|
||||
|
||||
/** returns PR_TRUE if aNode is an editable node */
|
||||
PRBool IsEditable(nsIDOMNode *aNode);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "nsHTMLEditRules.h"
|
||||
#include "nsEditor.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsTextEditor.h"
|
||||
#include "PlaceholderTxn.h"
|
||||
#include "InsertTextTxn.h"
|
||||
|
@ -747,9 +748,16 @@ nsHTMLEditRules::WillIndent(nsIDOMSelection *aSelection, PRBool *aCancel)
|
|||
if (!curQuote || transitionList[i])
|
||||
{
|
||||
nsAutoString quoteType("blockquote");
|
||||
res = mEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curQuote is now the correct thing to put curNode in
|
||||
if (mEditor->CanContainTag(curParent,quoteType))
|
||||
{
|
||||
res = mEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curQuote is now the correct thing to put curNode in
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("trying to put a blockquote in a bad place\n");
|
||||
}
|
||||
}
|
||||
|
||||
// tuck the node into the end of the active blockquote
|
||||
|
|
|
@ -63,6 +63,12 @@ const unsigned char nbsp = 160;
|
|||
#include "nsJSEditorLog.h"
|
||||
#endif // ENABLE_JS_EDITOR_LOG
|
||||
|
||||
// HACK - CID for NavDTD until we can get at dtd via the document
|
||||
// {a6cf9107-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_CNAVDTD_CID \
|
||||
{ 0xa6cf9107, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
static NS_DEFINE_CID(kCNavDTDCID, NS_CNAVDTD_CID);
|
||||
|
||||
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
|
||||
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
|
||||
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
|
||||
|
@ -129,7 +135,16 @@ NS_IMETHODIMP nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
|||
nsresult res=NS_ERROR_NULL_POINTER;
|
||||
if ((nsnull!=aDoc) && (nsnull!=aPresShell))
|
||||
{
|
||||
return nsTextEditor::Init(aDoc, aPresShell);
|
||||
res = nsTextEditor::Init(aDoc, aPresShell);
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
// Set up a DTD XXX XXX
|
||||
// HACK: This should have happened in a document specific way
|
||||
// in nsEditor::Init(), but we dont' have a way to do that yet
|
||||
res = nsComponentManager::CreateInstance(kCNavDTDCID, nsnull,
|
||||
nsIDTD::GetIID(), getter_AddRefs(mDTD));
|
||||
if (!mDTD) res = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -2233,12 +2248,6 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::CanContainElement(nsIDOMNode* aParent, nsIDOMElement* aElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
||||
{
|
||||
|
@ -2752,55 +2761,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
|
|||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLEditor::CanContainTag(nsIDOMNode* aParent, const nsString &aTag)
|
||||
{
|
||||
if (!aParent) return PR_FALSE;
|
||||
|
||||
static nsAutoString ulTag = "ul";
|
||||
static nsAutoString olTag = "ol";
|
||||
static nsAutoString liTag = "li";
|
||||
static nsAutoString bodyTag = "body";
|
||||
static nsAutoString tdTag = "td";
|
||||
static nsAutoString thTag = "th";
|
||||
static nsAutoString bqTag = "blockquote";
|
||||
|
||||
nsCOMPtr<nsIAtom> pTagAtom = GetTag(aParent);
|
||||
nsAutoString pTag;
|
||||
pTagAtom->ToString(pTag);
|
||||
|
||||
// flesh this out...
|
||||
// for now, only lists and blockquotes are using this funct
|
||||
|
||||
if (aTag.EqualsIgnoreCase(ulTag) ||
|
||||
aTag.EqualsIgnoreCase(olTag) )
|
||||
{
|
||||
if (pTag.EqualsIgnoreCase(bodyTag) ||
|
||||
pTag.EqualsIgnoreCase(tdTag) ||
|
||||
pTag.EqualsIgnoreCase(thTag) ||
|
||||
pTag.EqualsIgnoreCase(ulTag) ||
|
||||
pTag.EqualsIgnoreCase(olTag) ||
|
||||
pTag.EqualsIgnoreCase(liTag) ||
|
||||
pTag.EqualsIgnoreCase(bqTag) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (aTag.EqualsIgnoreCase(bqTag) )
|
||||
{
|
||||
if (pTag.EqualsIgnoreCase(bodyTag) ||
|
||||
pTag.EqualsIgnoreCase(tdTag) ||
|
||||
pTag.EqualsIgnoreCase(thTag) ||
|
||||
pTag.EqualsIgnoreCase(liTag) ||
|
||||
pTag.EqualsIgnoreCase(bqTag) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
|
||||
{
|
||||
|
|
|
@ -155,7 +155,6 @@ public:
|
|||
// This should replace InsertLink and InsertImage once it is working
|
||||
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CanContainElement(nsIDOMNode* aParent, nsIDOMElement* aElement);
|
||||
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection);
|
||||
NS_IMETHOD SaveHLineSettings(nsIDOMElement* aElement);
|
||||
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
|
||||
|
@ -185,10 +184,9 @@ public:
|
|||
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
|
||||
NS_IMETHOD JoinTableCells(PRBool aCellToRight);
|
||||
|
||||
// Data members
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
// rules initialization
|
||||
|
||||
virtual void InitRules();
|
||||
|
@ -216,8 +214,6 @@ protected:
|
|||
|
||||
NS_IMETHOD RemoveParentFromBlockContent(const nsString &aParentTag, nsIDOMRange *aRange);
|
||||
|
||||
PRBool CanContainTag(nsIDOMNode* aParent, const nsString &aTag);
|
||||
|
||||
NS_IMETHOD IsRootTag(nsString &aTag, PRBool &aIsTag);
|
||||
|
||||
NS_IMETHOD IsSubordinateBlock(nsString &aTag, PRBool &aIsTag);
|
||||
|
|
|
@ -1778,6 +1778,16 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
|
|||
return gHTMLElements[aParent].CanContain((eHTMLTags)aChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CNavDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
*aIntTag = nsHTMLTags::LookupTag(aTag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called to determine whether or not
|
||||
* the necessary intermediate tags should be propagated
|
||||
|
|
|
@ -369,6 +369,12 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
|
|||
*/
|
||||
virtual PRInt32 GetTopmostIndexOf(eHTMLTags aTagSet[],PRInt32 aCount) const;
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
|
||||
/**
|
||||
* The following methods are use to create and manage
|
||||
|
|
|
@ -306,6 +306,15 @@ PRBool COtherDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP COtherDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return CNavDTD::StringTagToIntTag(aTag, aIntTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag can contain newlines. Most do not.
|
||||
|
|
|
@ -121,6 +121,12 @@ class COtherDTD : public CNavDTD {
|
|||
*/
|
||||
virtual PRBool CanOmit(eHTMLTags aParent,eHTMLTags aChild)const;
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag)const;
|
||||
|
||||
/**
|
||||
* This method gets called when a start token has been consumed and needs
|
||||
* to be handled (possibly added to content model via sink).
|
||||
|
|
|
@ -370,6 +370,15 @@ PRBool CRtfDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CRtfDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
|
|
|
@ -337,6 +337,13 @@ class CRtfDTD : public nsIDTD {
|
|||
* @return ptr to recycler (or null)
|
||||
*/
|
||||
virtual nsITokenRecycler* GetTokenRecycler(void);
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -199,6 +199,14 @@ class nsIDTD : public nsISupports {
|
|||
* @return
|
||||
*/
|
||||
virtual PRBool Verify(nsString& aURLRef,nsIParser* aParser)=0;
|
||||
|
||||
/* XXX Temporary measure, pending further work by RickG */
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const =0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -37,5 +37,8 @@
|
|||
#define NS_WELLFORMEDDTD_CID \
|
||||
{ 0xe6fd9941, 0x899d, 0x11d2, { 0x8e, 0xae, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {a6cf9107-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_CNAVDTD_CID \
|
||||
{ 0xa6cf9107, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsParser.h"
|
||||
#include "nsParserNode.h"
|
||||
#include "nsWellFormedDTD.h"
|
||||
#include "CNavDTD.h"
|
||||
|
||||
#include "nsHTMLTags.h"
|
||||
#include "nsHTMLEntities.h"
|
||||
|
@ -36,6 +37,7 @@ static NS_DEFINE_IID(kCParser, NS_PARSER_IID);
|
|||
static NS_DEFINE_IID(kCParserNode, NS_PARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kLoggingSinkCID, NS_LOGGING_SINK_IID);
|
||||
static NS_DEFINE_CID(kWellFormedDTDCID, NS_WELLFORMEDDTD_CID);
|
||||
static NS_DEFINE_CID(kCNavDTDCID, NS_CNAVDTD_CID);
|
||||
|
||||
class nsParserFactory : public nsIFactory
|
||||
{
|
||||
|
@ -151,6 +153,12 @@ nsresult nsParserFactory::CreateInstance(nsISupports *aOuter,
|
|||
return rv;
|
||||
}
|
||||
}
|
||||
else if (mClassID.Equals(kCNavDTDCID)) {
|
||||
nsresult rv = NS_NewNavHTMLDTD((nsIDTD**) &inst);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -296,6 +296,16 @@ PRBool CValidDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CValidDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -230,6 +230,13 @@ class CValidDTD : public nsIDTD {
|
|||
* @return ptr to recycler (or null)
|
||||
*/
|
||||
virtual nsITokenRecycler* GetTokenRecycler(void);
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -544,6 +544,15 @@ PRBool CViewSourceHTML::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CViewSourceHTML::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -214,6 +214,12 @@ class CViewSourceHTML: public nsIDTD {
|
|||
*/
|
||||
virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const;
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -397,6 +397,15 @@ PRBool CWellFormedDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CWellFormedDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -1778,6 +1778,16 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
|
|||
return gHTMLElements[aParent].CanContain((eHTMLTags)aChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CNavDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
*aIntTag = nsHTMLTags::LookupTag(aTag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called to determine whether or not
|
||||
* the necessary intermediate tags should be propagated
|
||||
|
|
|
@ -369,6 +369,12 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
|
|||
*/
|
||||
virtual PRInt32 GetTopmostIndexOf(eHTMLTags aTagSet[],PRInt32 aCount) const;
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
|
||||
/**
|
||||
* The following methods are use to create and manage
|
||||
|
|
|
@ -306,6 +306,15 @@ PRBool COtherDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP COtherDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return CNavDTD::StringTagToIntTag(aTag, aIntTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag can contain newlines. Most do not.
|
||||
|
|
|
@ -121,6 +121,12 @@ class COtherDTD : public CNavDTD {
|
|||
*/
|
||||
virtual PRBool CanOmit(eHTMLTags aParent,eHTMLTags aChild)const;
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag)const;
|
||||
|
||||
/**
|
||||
* This method gets called when a start token has been consumed and needs
|
||||
* to be handled (possibly added to content model via sink).
|
||||
|
|
|
@ -370,6 +370,15 @@ PRBool CRtfDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CRtfDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
|
|
|
@ -337,6 +337,13 @@ class CRtfDTD : public nsIDTD {
|
|||
* @return ptr to recycler (or null)
|
||||
*/
|
||||
virtual nsITokenRecycler* GetTokenRecycler(void);
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -199,6 +199,14 @@ class nsIDTD : public nsISupports {
|
|||
* @return
|
||||
*/
|
||||
virtual PRBool Verify(nsString& aURLRef,nsIParser* aParser)=0;
|
||||
|
||||
/* XXX Temporary measure, pending further work by RickG */
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const =0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -37,5 +37,8 @@
|
|||
#define NS_WELLFORMEDDTD_CID \
|
||||
{ 0xe6fd9941, 0x899d, 0x11d2, { 0x8e, 0xae, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {a6cf9107-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_CNAVDTD_CID \
|
||||
{ 0xa6cf9107, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsParser.h"
|
||||
#include "nsParserNode.h"
|
||||
#include "nsWellFormedDTD.h"
|
||||
#include "CNavDTD.h"
|
||||
|
||||
#include "nsHTMLTags.h"
|
||||
#include "nsHTMLEntities.h"
|
||||
|
@ -36,6 +37,7 @@ static NS_DEFINE_IID(kCParser, NS_PARSER_IID);
|
|||
static NS_DEFINE_IID(kCParserNode, NS_PARSER_NODE_IID);
|
||||
static NS_DEFINE_IID(kLoggingSinkCID, NS_LOGGING_SINK_IID);
|
||||
static NS_DEFINE_CID(kWellFormedDTDCID, NS_WELLFORMEDDTD_CID);
|
||||
static NS_DEFINE_CID(kCNavDTDCID, NS_CNAVDTD_CID);
|
||||
|
||||
class nsParserFactory : public nsIFactory
|
||||
{
|
||||
|
@ -151,6 +153,12 @@ nsresult nsParserFactory::CreateInstance(nsISupports *aOuter,
|
|||
return rv;
|
||||
}
|
||||
}
|
||||
else if (mClassID.Equals(kCNavDTDCID)) {
|
||||
nsresult rv = NS_NewNavHTMLDTD((nsIDTD**) &inst);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -296,6 +296,16 @@ PRBool CValidDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CValidDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -230,6 +230,13 @@ class CValidDTD : public nsIDTD {
|
|||
* @return ptr to recycler (or null)
|
||||
*/
|
||||
virtual nsITokenRecycler* GetTokenRecycler(void);
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -544,6 +544,15 @@ PRBool CViewSourceHTML::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CViewSourceHTML::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -214,6 +214,12 @@ class CViewSourceHTML: public nsIDTD {
|
|||
*/
|
||||
virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const;
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
|
@ -397,6 +397,15 @@ PRBool CWellFormedDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give rest of world access to our tag enums, so that CanContain(), etc,
|
||||
* become useful.
|
||||
*/
|
||||
NS_IMETHODIMP CWellFormedDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called to determine whether a given
|
||||
* tag is itself a container
|
||||
|
|
Загрузка…
Ссылка в новой задаче