Use a stub implementation of nsIDocumentObserver for implementors of nsIDocumentObserver in the layout library. b=232351 r=jst sr=peterv

This commit is contained in:
dbaron%dbaron.org 2004-01-28 21:04:33 +00:00
parent d3c174d282
commit 96079e83a3
19 changed files with 244 additions and 262 deletions

View File

@ -60,7 +60,10 @@ REQUIRES = xpcom \
prefetch \
$(NULL)
EXPORTS = nsStyleSet.h
EXPORTS = \
nsStubDocumentObserver.h \
nsStyleSet.h \
$(NULL)
CPPSRCS = \
nsAttrAndChildArray.cpp \
@ -95,6 +98,7 @@ CPPSRCS = \
nsRange.cpp \
nsRuleNode.cpp \
nsSelection.cpp \
nsStubDocumentObserver.cpp \
nsStyleContext.cpp \
nsStyleSet.cpp \
nsSyncLoadService.cpp \

View File

@ -509,34 +509,6 @@ nsContentList::NamedItem(const nsAString& aName, nsIDOMNode** aReturn)
return NS_OK;
}
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsContentList)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsContentList)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsContentList)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsContentList)
void
nsContentList::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
}
void
nsContentList::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
}
void
nsContentList::ContentChanged(nsIDocument* aDocument, nsIContent* aContent,
nsISupports* aSubContent)
{
}
void
nsContentList::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType)
{
}
void
nsContentList::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
PRInt32 aNewIndexInContainer)

View File

@ -43,7 +43,7 @@
#include "nsString.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMNodeList.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIContentList.h"
#include "nsIAtom.h"
@ -152,7 +152,7 @@ protected:
class nsContentList : public nsBaseContentList,
protected nsContentListKey,
public nsIDOMHTMLCollection,
public nsIDocumentObserver,
public nsStubDocumentObserver,
public nsIContentList
{
public:
@ -179,7 +179,16 @@ public:
virtual PRInt32 IndexOf(nsIContent *aContent, PRBool aDoFlush);
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
virtual void ContentReplaced(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aOldChild, nsIContent* aNewChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
virtual void DocumentWillBeDestroyed(nsIDocument *aDocument);
// Other public methods
nsContentListKey* GetKey() {

View File

@ -235,23 +235,6 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
return NS_OK;
}
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsDOMStyleSheetList)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsDOMStyleSheetList)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsDOMStyleSheetList)
NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(nsDOMStyleSheetList)
void
nsDOMStyleSheetList::BeginUpdate(nsIDocument* aDocument,
nsUpdateType aUpdateType)
{
}
void
nsDOMStyleSheetList::EndUpdate(nsIDocument* aDocument,
nsUpdateType aUpdateType)
{
}
void
nsDOMStyleSheetList::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
@ -285,35 +268,6 @@ nsDOMStyleSheetList::StyleSheetRemoved(nsIDocument *aDocument,
}
}
void
nsDOMStyleSheetList::StyleSheetApplicableStateChanged(nsIDocument* aDocument,
nsIStyleSheet* aStyleSheet,
PRBool aApplicable)
{
}
void
nsDOMStyleSheetList::StyleRuleChanged(nsIDocument* aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aOldStyleRule,
nsIStyleRule* aNewStyleRule)
{
}
void
nsDOMStyleSheetList::StyleRuleAdded(nsIDocument* aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule)
{
}
void
nsDOMStyleSheetList::StyleRuleRemoved(nsIDocument* aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule)
{
}
class nsDOMImplementation : public nsIDOMDOMImplementation,
public nsIPrivateDOMImplementation

View File

@ -53,7 +53,7 @@
#include "nsIDOMDocumentStyle.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMStyleSheetList.h"
@ -144,7 +144,7 @@ protected:
class nsDOMStyleSheetList : public nsIDOMStyleSheetList,
public nsIDocumentObserver
public nsStubDocumentObserver
{
public:
nsDOMStyleSheetList(nsIDocument *aDocument);
@ -154,7 +154,12 @@ public:
NS_DECL_NSIDOMSTYLESHEETLIST
NS_DECL_NSIDOCUMENTOBSERVER
// nsIDocumentObserver
virtual void DocumentWillBeDestroyed(nsIDocument *aDocument);
virtual void StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet);
virtual void StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet);
protected:
PRInt32 mLength;

View File

@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsStubDocumentObserver.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsStubDocumentObserver.h"
NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsStubDocumentObserver)
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsStubDocumentObserver)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsStubDocumentObserver)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsStubDocumentObserver)
NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(nsStubDocumentObserver)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsStubDocumentObserver)

View File

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsStubDocumentObserver.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsStubDocumentObserver_h_
#define nsStubDocumentObserver_h_
#include "nsIDocumentObserver.h"
/**
* nsStubDocumentObserver is an implementation of the
* nsIDocumentObserver interface (except for the methods on nsISupports)
* that is intended to be used within the content/layout library. All
* methods do nothing.
*
* There are two advantages to inheriting from nsStubDocumentObserver
* rather than directly from nsIDocumentObserver:
* 1. smaller compiled code size (since there's no need for the code
* for the empty virtual function implementations for every
* nsIDocumentObserver implementation)
* 2. the performance of document's loop over observers benefits from
* the fact that more of the functions called are the same (which
* can reduce instruction cache misses and perhaps improve branch
* prediction)
*/
class nsStubDocumentObserver : public nsIDocumentObserver {
NS_DECL_NSIDOCUMENTOBSERVER
};
#endif /* !defined(nsStubDocumentObserver_h_) */

View File

@ -90,7 +90,7 @@
#include "nsIHttpChannel.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIHTMLDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIDOMHTMLMapElement.h"
@ -207,7 +207,7 @@ class HTMLContentSink : public nsContentSink,
#ifdef DEBUG
public nsIDebugDumpContent,
#endif
public nsIDocumentObserver
public nsStubDocumentObserver
{
public:
friend class SinkContext;
@ -268,7 +268,8 @@ public:
NS_DECL_NSITIMERCALLBACK
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType);
virtual void EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType);
#ifdef DEBUG
// nsIDebugDumpContent
@ -4200,12 +4201,6 @@ HTMLContentSink::UpdateAllContexts()
mCurrentContext->UpdateChildCounts();
}
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(HTMLContentSink)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(HTMLContentSink)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(HTMLContentSink)
NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(HTMLContentSink)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(HTMLContentSink)
void
HTMLContentSink::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
@ -4225,7 +4220,6 @@ HTMLContentSink::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
void
HTMLContentSink::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
// If we're in a script and we didn't do the notification,
// something else in the script processing caused the
// notification to occur. Update our notion of how much
@ -4236,11 +4230,6 @@ HTMLContentSink::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
}
}
void
HTMLContentSink::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
}
void
HTMLContentSink::PreEvaluateScript()
{

View File

@ -64,7 +64,7 @@
#include "nsITextContent.h"
#include "nsIStreamListener.h"
#include "nsIStyleRuleSupplier.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIXBLBinding.h"
#include "nsIXBLDocumentInfo.h"
@ -294,7 +294,9 @@ SetOrRemoveObject(PLDHashTable& table, nsISupports* aKey, nsISupports* aValue)
////////////////////////////////////////////////////////////////////////
class nsBindingManager : public nsIBindingManager, public nsIStyleRuleSupplier, public nsIDocumentObserver
class nsBindingManager : public nsIBindingManager,
public nsIStyleRuleSupplier,
public nsStubDocumentObserver
{
NS_DECL_ISUPPORTS
@ -362,7 +364,18 @@ public:
RuleProcessorData* aData);
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
// XXXldb Is there really no need to implement |ContentReplaced|?
protected:
nsresult GetXBLChildNodesInternal(nsIContent* aContent,
@ -1318,31 +1331,9 @@ nsBindingManager::GetNestedInsertionPoint(nsIContent* aParent, nsIContent* aChil
return NS_OK;
}
NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsBindingManager)
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsBindingManager)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsBindingManager)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsBindingManager)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsBindingManager)
void
nsBindingManager::ContentChanged(nsIDocument* aDoc,
nsIContent* aContent,
nsISupports* aSubContent)
{
}
void
nsBindingManager::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
}
void
nsBindingManager::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer)
{
// XXX This is hacked and not quite correct. See below.
@ -1427,21 +1418,11 @@ nsBindingManager::ContentInserted(nsIDocument* aDocument,
}
}
void
nsBindingManager::ContentReplaced(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer)
{
}
void
nsBindingManager::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer)
{
if (aIndexInContainer == -1 || !mContentListTable.ops)
// It's anonymous.

View File

@ -209,10 +209,6 @@ nsXMLPrettyPrinter::MaybeUnhook(nsIContent* aContent)
}
// nsIDocumentObserver implementation
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsXMLPrettyPrinter)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsXMLPrettyPrinter)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsXMLPrettyPrinter)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsXMLPrettyPrinter)
void
nsXMLPrettyPrinter::BeginUpdate(nsIDocument* aDocument,
@ -247,15 +243,6 @@ nsXMLPrettyPrinter::EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType)
}
}
void
nsXMLPrettyPrinter::ContentChanged(nsIDocument* aDocument,
nsIContent *aContent,
nsISupports *aSubContent)
{
}
void
nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent,

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -38,18 +39,37 @@
#ifndef nsXMLPrettyPrinter_h__
#define nsXMLPrettyPrinter_h__
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIDocument.h"
#include "nsCOMPtr.h"
class nsXMLPrettyPrinter : public nsIDocumentObserver
class nsXMLPrettyPrinter : public nsStubDocumentObserver
{
public:
nsXMLPrettyPrinter();
virtual ~nsXMLPrettyPrinter();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOCUMENTOBSERVER
// nsIDocumentObserver
virtual void BeginUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType);
virtual void EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType);
virtual void AttributeChanged(nsIDocument* aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType);
virtual void ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer, nsIContent* aChild,
PRInt32 aIndexInContainer);
virtual void ContentReplaced(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aOldChild, nsIContent* aNewChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
virtual void DocumentWillBeDestroyed(nsIDocument* aDocument);
/**
* This will prettyprint the document if the document is loaded in a

View File

@ -282,30 +282,6 @@ nsXULTemplateBuilder::RemoveListener(nsIXULBuilderListener* aListener)
// nsIDocumentOberver interface
//
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsXULTemplateBuilder)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsXULTemplateBuilder)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsXULTemplateBuilder)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsXULTemplateBuilder)
void
nsXULTemplateBuilder::BeginUpdate(nsIDocument *aDocument,
nsUpdateType aUpdateType)
{
}
void
nsXULTemplateBuilder::EndUpdate(nsIDocument *aDocument,
nsUpdateType aUpdateType)
{
}
void
nsXULTemplateBuilder::ContentChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsISupports* aSubContent)
{
}
void
nsXULTemplateBuilder::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
@ -320,38 +296,6 @@ nsXULTemplateBuilder::AttributeChanged(nsIDocument *aDocument,
Rebuild();
}
void
nsXULTemplateBuilder::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer)
{
}
void
nsXULTemplateBuilder::ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer)
{
}
void
nsXULTemplateBuilder::ContentReplaced(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer)
{
}
void
nsXULTemplateBuilder::ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer)
{
}
void
nsXULTemplateBuilder::DocumentWillBeDestroyed(nsIDocument *aDocument)
{

View File

@ -43,7 +43,7 @@
#ifndef nsXULTemplateBuilder_h__
#define nsXULTemplateBuilder_h__
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIScriptSecurityManager.h"
#include "nsISecurityCheckedComponent.h"
#include "nsIRDFCompositeDataSource.h"
@ -78,7 +78,7 @@ class nsIRDFCompositeDataSource;
*/
class nsXULTemplateBuilder : public nsIXULTemplateBuilder,
public nsISecurityCheckedComponent,
public nsIDocumentObserver,
public nsStubDocumentObserver,
public nsIRDFObserver
{
public:
@ -97,7 +97,10 @@ public:
NS_DECL_NSISECURITYCHECKEDCOMPONENT
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType);
virtual void DocumentWillBeDestroyed(nsIDocument *aDocument);
// nsIRDFObserver interface
NS_DECL_NSIRDFOBSERVER

View File

@ -1005,22 +1005,13 @@ nsImageMap::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC)
}
}
NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsImageMap)
PRBool
nsImageMap::IsAncestorOf(nsIContent* aContent,
nsIContent* aAncestorContent)
{
nsCOMPtr<nsIContent> parent = aContent->GetParent();
if (parent) {
return parent == aAncestorContent ||
IsAncestorOf(parent, aAncestorContent);
}
for (nsIContent *a = aContent->GetParent(); a; a = a->GetParent())
if (a == aAncestorContent)
return PR_TRUE;
return PR_FALSE;
}

View File

@ -40,7 +40,7 @@
#include "nsISupports.h"
#include "nsCoord.h"
#include "nsVoidArray.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOMFocusListener.h"
#include "nsIFrame.h"
#include "nsIImageMap.h"
@ -54,7 +54,7 @@ class nsIURI;
class nsString;
class nsIDOMEvent;
class nsImageMap : public nsIDocumentObserver, public nsIDOMFocusListener,
class nsImageMap : public nsStubDocumentObserver, public nsIDOMFocusListener,
public nsIImageMap
{
public:
@ -94,7 +94,20 @@ public:
NS_DECL_ISUPPORTS
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void ContentChanged(nsIDocument* aDocument, nsIContent* aContent,
nsISupports* aSubContent);
virtual void AttributeChanged(nsIDocument* aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType);
virtual void ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
virtual void ContentReplaced(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aOldChild, nsIContent* aNewChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
//nsIDOMFocusListener
NS_IMETHOD Focus(nsIDOMEvent* aEvent);

View File

@ -1005,22 +1005,13 @@ nsImageMap::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC)
}
}
NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsImageMap)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsImageMap)
PRBool
nsImageMap::IsAncestorOf(nsIContent* aContent,
nsIContent* aAncestorContent)
{
nsCOMPtr<nsIContent> parent = aContent->GetParent();
if (parent) {
return parent == aAncestorContent ||
IsAncestorOf(parent, aAncestorContent);
}
for (nsIContent *a = aContent->GetParent(); a; a = a->GetParent())
if (a == aAncestorContent)
return PR_TRUE;
return PR_FALSE;
}

View File

@ -40,7 +40,7 @@
#include "nsISupports.h"
#include "nsCoord.h"
#include "nsVoidArray.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOMFocusListener.h"
#include "nsIFrame.h"
#include "nsIImageMap.h"
@ -54,7 +54,7 @@ class nsIURI;
class nsString;
class nsIDOMEvent;
class nsImageMap : public nsIDocumentObserver, public nsIDOMFocusListener,
class nsImageMap : public nsStubDocumentObserver, public nsIDOMFocusListener,
public nsIImageMap
{
public:
@ -94,7 +94,20 @@ public:
NS_DECL_ISUPPORTS
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void ContentChanged(nsIDocument* aDocument, nsIContent* aContent,
nsISupports* aSubContent);
virtual void AttributeChanged(nsIDocument* aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType);
virtual void ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
virtual void ContentReplaced(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aOldChild, nsIContent* aNewChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
//nsIDOMFocusListener
NS_IMETHOD Focus(nsIDOMEvent* aEvent);

View File

@ -684,27 +684,6 @@ nsTreeContentView::GetIndexOfItem(nsIDOMElement* aItem, PRInt32* _retval)
return NS_OK;
}
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsTreeContentView)
NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(nsTreeContentView)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsTreeContentView)
void
nsTreeContentView::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
}
void
nsTreeContentView::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
}
void
nsTreeContentView::ContentChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsISupports* aSubContent)
{
}
void
nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1,

View File

@ -45,7 +45,7 @@
#include "nsVoidArray.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDocumentObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsITreeView.h"
#include "nsITreeBoxObject.h"
#include "nsITreeSelection.h"
@ -57,8 +57,8 @@ class Property;
nsresult NS_NewTreeContentView(nsITreeContentView** aResult);
class nsTreeContentView : public nsITreeView,
public nsITreeContentView,
public nsIDocumentObserver
public nsITreeContentView,
public nsStubDocumentObserver
{
public:
nsTreeContentView(void);
@ -74,7 +74,27 @@ class nsTreeContentView : public nsITreeView,
NS_DECL_NSITREECONTENTVIEW
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
virtual void ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1,
nsIContent* aContent2,
PRInt32 aStateMask);
virtual void AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType);
virtual void ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
virtual void ContentReplaced(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aOldChild, nsIContent* aNewChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer);
virtual void DocumentWillBeDestroyed(nsIDocument *aDocument);
protected:
// Recursive methods which deal with serializing of nested content.