зеркало из https://github.com/mozilla/gecko-dev.git
Bug 343288: Move IsInDoc() and GetCurrentDoc() to nsINode. r/sr=jst
This commit is contained in:
Родитель
6ed87b1766
Коммит
afe85d0237
|
@ -46,8 +46,8 @@ class nsDOMAttributeMap;
|
|||
class nsIContent;
|
||||
|
||||
#define NS_IATTRIBUTE_IID \
|
||||
{ 0x5a3fa236, 0x9249, 0x4949, \
|
||||
{ 0x86, 0xb4, 0x98, 0xc1, 0x86, 0xb3, 0xe5, 0x50 } }
|
||||
{ 0x68b13198, 0x6d81, 0x4ab6, \
|
||||
{ 0xb9, 0x98, 0xd0, 0xa4, 0x55, 0x82, 0x5f, 0xb1 } }
|
||||
|
||||
class nsIAttribute : public nsINode
|
||||
{
|
||||
|
|
|
@ -91,8 +91,8 @@ class nsIDocumentObserver;
|
|||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xd14c81b1, 0x029e, 0x4c01, \
|
||||
{ 0x8f, 0xfc, 0x42, 0xc1, 0xe1, 0x34, 0x0f, 0xe4 } }
|
||||
{ 0x63f0c69a, 0x255a, 0x432f, \
|
||||
{ 0xa7, 0xe4, 0xaf, 0x81, 0x10, 0x56, 0x28, 0xef } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -114,6 +114,7 @@ public:
|
|||
mNodeInfoManager(nsnull),
|
||||
mPartID(0)
|
||||
{
|
||||
mParentPtrBits |= PARENT_BIT_INDOCUMENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ class nsIMutationObserver;
|
|||
|
||||
// IID for the nsINode interface
|
||||
#define NS_INODE_IID \
|
||||
{ 0x7b23c37c, 0x18e6, 0x4d80, \
|
||||
{ 0xbc, 0x95, 0xb3, 0x7b, 0x3b, 0x89, 0x7a, 0xe0 } }
|
||||
{ 0x59693a45, 0x7cb2, 0x41d6, \
|
||||
{ 0xaf, 0xe3, 0xa7, 0xc7, 0x6f, 0xe0, 0x54, 0xf0 } }
|
||||
|
||||
// hack to make egcs / gcc 2.95.2 happy
|
||||
class nsINode_base : public nsIDOMGCParticipant {
|
||||
|
@ -192,10 +192,6 @@ public:
|
|||
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const = 0;
|
||||
|
||||
/**
|
||||
* Do we need a GetCurrentDoc of some sort? I don't think we do...
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the "owner document" of this node. Note that this is not the same
|
||||
* as the DOM ownerDocument -- that's null for Document nodes, whereas for a
|
||||
* nsIDocument GetOwnerDocument returns the document itself. For nsIContent
|
||||
|
@ -206,6 +202,27 @@ public:
|
|||
return mNodeInfo->GetDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the content has an ancestor that is a document.
|
||||
*
|
||||
* @return whether this content is in a document tree
|
||||
*/
|
||||
PRBool IsInDoc() const
|
||||
{
|
||||
return mParentPtrBits & PARENT_BIT_INDOCUMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the document that this content is currently in, if any. This will be
|
||||
* null if the content has no ancestor that is a document.
|
||||
*
|
||||
* @return the current document
|
||||
*/
|
||||
nsIDocument *GetCurrentDoc() const
|
||||
{
|
||||
return IsInDoc() ? GetOwnerDoc() : nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a content node at a particular index. This method handles calling
|
||||
* BindToTree on the child appropriately.
|
||||
|
|
|
@ -45,8 +45,8 @@ class nsTextFragment;
|
|||
// IID for the nsITextContent interface
|
||||
// e4ef843f-1061-45e6-9c81-30eac2673f41
|
||||
#define NS_ITEXT_CONTENT_IID \
|
||||
{ 0x013da2a1, 0x6267, 0x4667, \
|
||||
{ 0x9a, 0x63, 0xc9, 0xd3, 0x02, 0xf7, 0x55, 0x8d } }
|
||||
{ 0x2a5789f8, 0xbbec, 0x4340, \
|
||||
{ 0xa2, 0xc4, 0x54, 0xbb, 0xd0, 0x90, 0x64, 0x60 } }
|
||||
|
||||
/**
|
||||
* Interface for textual content. This interface is used to provide
|
||||
|
|
|
@ -415,9 +415,7 @@ nsContentList::Item(PRUint32 aIndex, PRBool aDoFlush)
|
|||
{
|
||||
if (mRootNode && aDoFlush) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
// Ideally we should call GetCurrentDoc here, i think, but that doesn't
|
||||
// live on nsINode
|
||||
nsIDocument* doc = mRootNode->GetOwnerDoc();
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
if (doc) {
|
||||
// Flush pending content changes Bug 4891.
|
||||
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||
|
@ -855,9 +853,7 @@ nsContentList::BringSelfUpToDate(PRBool aDoFlush)
|
|||
{
|
||||
if (mRootNode && aDoFlush) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
// Ideally we should call GetCurrentDoc here, i think, but that doesn't
|
||||
// live on nsINode
|
||||
nsIDocument* doc = mRootNode->GetOwnerDoc();
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
if (doc) {
|
||||
// Flush pending content changes Bug 4891.
|
||||
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||
|
|
Загрузка…
Ссылка в новой задаче