Bug 562698 - Part a: Pass Elements to nsIMutationObserver::AttributeChanged and nsCSSFrameConstructor::AttributeChanged; r=bzbarsky, a=dbaron

This commit is contained in:
Ms2ger 2010-08-24 09:05:56 +02:00
parent f78fc8c036
commit 27271a8a8f
27 changed files with 176 additions and 133 deletions

View File

@ -73,10 +73,13 @@
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIWebNavigation.h" #include "nsIWebNavigation.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "mozilla/dom/Element.h"
#ifdef MOZ_XUL #ifdef MOZ_XUL
#include "nsIXULDocument.h" #include "nsIXULDocument.h"
#endif #endif
namespace dom = mozilla::dom;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Static member initialization // Static member initialization
@ -905,15 +908,16 @@ nsDocAccessible::AttributeWillChange(nsIDocument *aDocument,
} }
void void
nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, nsDocAccessible::AttributeChanged(nsIDocument *aDocument,
dom::Element* aElement,
PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
AttributeChangedImpl(aContent, aNameSpaceID, aAttribute); AttributeChangedImpl(aElement, aNameSpaceID, aAttribute);
// If it was the focused node, cache the new state // If it was the focused node, cache the new state
if (aContent == gLastFocusedNode) { if (aElement == gLastFocusedNode) {
nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aContent); nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aElement);
if (focusedAccessible) if (focusedAccessible)
gLastFocusedAccessiblesState = nsAccUtils::State(focusedAccessible); gLastFocusedAccessiblesState = nsAccUtils::State(focusedAccessible);
} }

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved. * the Initial Developer. All Rights Reserved.
* *
* Contributor(s): * Contributor(s):
* Ms2ger <ms2ger@gmail.com>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"), * either of the GNU General Public License Version 2 or later (the "GPL"),
@ -34,8 +35,9 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifndef nsIMutationObserver_h___
#define nsIMutationObserver_h___ #ifndef nsIMutationObserver_h
#define nsIMutationObserver_h
#include "nsISupports.h" #include "nsISupports.h"
@ -44,6 +46,12 @@ class nsIContent;
class nsIDocument; class nsIDocument;
class nsINode; class nsINode;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
#define NS_IMUTATION_OBSERVER_IID \ #define NS_IMUTATION_OBSERVER_IID \
{ 0x85eea794, 0xed8e, 0x4e1b, \ { 0x85eea794, 0xed8e, 0x4e1b, \
{ 0xa1, 0x28, 0xd0, 0x93, 0x00, 0xae, 0x51, 0xaa } } { 0xa1, 0x28, 0xd0, 0x93, 0x00, 0xae, 0x51, 0xaa } }
@ -181,7 +189,7 @@ public:
* Notification that an attribute of an element has changed. * Notification that an attribute of an element has changed.
* *
* @param aDocument The owner-document of aContent. Can be null. * @param aDocument The owner-document of aContent. Can be null.
* @param aContent The element whose attribute changed * @param aElement The element whose attribute changed
* @param aNameSpaceID The namespace id of the changed attribute * @param aNameSpaceID The namespace id of the changed attribute
* @param aAttribute The name of the changed attribute * @param aAttribute The name of the changed attribute
* @param aModType Whether or not the attribute was added, changed, or * @param aModType Whether or not the attribute was added, changed, or
@ -195,7 +203,7 @@ public:
* the stack. * the stack.
*/ */
virtual void AttributeChanged(nsIDocument* aDocument, virtual void AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, mozilla::dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) = 0; PRInt32 aModType) = 0;
@ -333,7 +341,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \ #define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \
virtual void AttributeChanged(nsIDocument* aDocument, \ virtual void AttributeChanged(nsIDocument* aDocument, \
nsIContent* aContent, \ mozilla::dom::Element* aElement, \
PRInt32 aNameSpaceID, \ PRInt32 aNameSpaceID, \
nsIAtom* aAttribute, \ nsIAtom* aAttribute, \
PRInt32 aModType); PRInt32 aModType);
@ -403,7 +411,7 @@ _class::AttributeWillChange(nsIDocument* aDocument, \
} \ } \
void \ void \
_class::AttributeChanged(nsIDocument* aDocument, \ _class::AttributeChanged(nsIDocument* aDocument, \
nsIContent* aContent, \ mozilla::dom::Element* aElement, \
PRInt32 aNameSpaceID, \ PRInt32 aNameSpaceID, \
nsIAtom* aAttribute, \ nsIAtom* aAttribute, \
PRInt32 aModType) \ PRInt32 aModType) \
@ -437,4 +445,4 @@ _class::ParentChainChanged(nsIContent *aContent) \
} }
#endif /* nsIMutationObserver_h___ */ #endif /* nsIMutationObserver_h */

View File

@ -605,39 +605,38 @@ nsContentList::GetNamedItem(const nsAString& aName, nsWrapperCache **aCache,
} }
void void
nsContentList::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
NS_PRECONDITION(aContent, "Must have a content node to work with"); NS_PRECONDITION(aElement, "Must have a content node to work with");
NS_PRECONDITION(aContent->IsElement(), "Should be an element");
if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY || if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY ||
!MayContainRelevantNodes(aContent->GetNodeParent()) || !MayContainRelevantNodes(aElement->GetNodeParent()) ||
!nsContentUtils::IsInSameAnonymousTree(mRootNode, aContent)) { !nsContentUtils::IsInSameAnonymousTree(mRootNode, aElement)) {
// Either we're already dirty or this notification doesn't affect // Either we're already dirty or this notification doesn't affect
// whether we might match aContent. // whether we might match aElement.
return; return;
} }
if (Match(aContent->AsElement())) { if (Match(aElement)) {
if (mElements.IndexOf(aContent) == -1) { if (mElements.IndexOf(aElement) == -1) {
// We match aContent now, and it's not in our list already. Just dirty // We match aElement now, and it's not in our list already. Just dirty
// ourselves; this is simpler than trying to figure out where to insert // ourselves; this is simpler than trying to figure out where to insert
// aContent. // aElement.
SetDirty(); SetDirty();
} }
} else { } else {
// We no longer match aContent. Remove it from our list. If it's // We no longer match aElement. Remove it from our list. If it's
// already not there, this is a no-op (though a potentially // already not there, this is a no-op (though a potentially
// expensive one). Either way, no change of mState is required // expensive one). Either way, no change of mState is required
// here. // here.
mElements.RemoveObject(aContent); mElements.RemoveObject(aElement);
} }
} }
void void
nsContentList::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer, nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aFirstNewContent, nsIContent* aFirstNewContent,
PRInt32 aNewIndexInContainer) PRInt32 aNewIndexInContainer)
{ {

View File

@ -41,7 +41,7 @@
#include "nsDOMAttribute.h" #include "nsDOMAttribute.h"
#include "nsGenericElement.h" #include "nsGenericElement.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsContentCreatorFunctions.h" #include "nsContentCreatorFunctions.h"
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsDOMError.h" #include "nsDOMError.h"
@ -60,6 +60,8 @@
#include "mozAutoDocUpdate.h" #include "mozAutoDocUpdate.h"
#include "nsMutationEvent.h" #include "nsMutationEvent.h"
using namespace mozilla::dom;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
PRBool nsDOMAttribute::sInitialized; PRBool nsDOMAttribute::sInitialized;
@ -746,13 +748,13 @@ nsDOMAttribute::EnsureChildState()
void void
nsDOMAttribute::AttributeChanged(nsIDocument* aDocument, nsDOMAttribute::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
nsIContent* content = GetContentInternal(); nsIContent* content = GetContentInternal();
if (aContent != content) { if (aElement != content) {
return; return;
} }

View File

@ -122,9 +122,10 @@ nsNodeUtils::AttributeChanged(nsIContent* aContent,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
nsIDocument* doc = aContent->GetOwnerDoc(); Element* aElement = aContent->AsElement();
IMPL_MUTATION_NOTIFICATION(AttributeChanged, aContent, nsIDocument* doc = aElement->GetOwnerDoc();
(doc, aContent, aNameSpaceID, aAttribute, IMPL_MUTATION_NOTIFICATION(AttributeChanged, aElement,
(doc, aElement, aNameSpaceID, aAttribute,
aModType)); aModType));
} }

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsScriptElement.h" #include "nsScriptElement.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
@ -47,6 +47,8 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
using namespace mozilla::dom;
NS_IMETHODIMP NS_IMETHODIMP
nsScriptElement::ScriptAvailable(nsresult aResult, nsScriptElement::ScriptAvailable(nsresult aResult,
nsIScriptElement *aElement, nsIScriptElement *aElement,
@ -118,7 +120,7 @@ nsScriptElement::CharacterDataChanged(nsIDocument *aDocument,
void void
nsScriptElement::AttributeChanged(nsIDocument* aDocument, nsScriptElement::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)

View File

@ -49,6 +49,7 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
using namespace mozilla::dom;
/** /**
* class used to implement attr() generated content * class used to implement attr() generated content
@ -337,13 +338,13 @@ nsAttributeTextNode::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
void void
nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument, nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
if (aNameSpaceID == mNameSpaceID && aAttribute == mAttrName && if (aNameSpaceID == mNameSpaceID && aAttribute == mAttrName &&
aContent == mGrandparent) { aElement == mGrandparent) {
// Since UpdateText notifies, do it when it's safe to run script. Note // Since UpdateText notifies, do it when it's safe to run script. Note
// that if we get unbound while the event is up that's ok -- we'll just // that if we get unbound while the event is up that's ok -- we'll just
// have no grandparent when it fires, and will do nothing. // have no grandparent when it fires, and will do nothing.

View File

@ -49,6 +49,8 @@
#include "nsINodeInfo.h" #include "nsINodeInfo.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
using namespace mozilla::dom;
PRBool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument, PRBool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument,
nsXMLEventsManager * aManager, nsXMLEventsManager * aManager,
nsIContent * aContent) nsIContent * aContent)
@ -334,7 +336,7 @@ nsXMLEventsManager::EndLoad(nsIDocument* aDocument)
void void
nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument, nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
@ -348,23 +350,23 @@ nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
aAttribute == nsGkAtoms::observer || aAttribute == nsGkAtoms::observer ||
aAttribute == nsGkAtoms::phase || aAttribute == nsGkAtoms::phase ||
aAttribute == nsGkAtoms::propagate)) { aAttribute == nsGkAtoms::propagate)) {
RemoveListener(aContent); RemoveListener(aElement);
AddXMLEventsContent(aContent); AddXMLEventsContent(aElement);
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent); nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aElement);
} }
else { else {
if (aContent->NodeInfo()->Equals(nsGkAtoms::listener, if (aElement->NodeInfo()->Equals(nsGkAtoms::listener,
kNameSpaceID_XMLEvents)) { kNameSpaceID_XMLEvents)) {
RemoveListener(aContent); RemoveListener(aElement);
AddXMLEventsContent(aContent); AddXMLEventsContent(aElement);
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent); nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aElement);
} }
else if (aContent->GetIDAttributeName() == aAttribute) { else if (aElement->GetIDAttributeName() == aAttribute) {
if (aModType == nsIDOMMutationEvent::REMOVAL) if (aModType == nsIDOMMutationEvent::REMOVAL)
mListeners.Enumerate(EnumAndSetIncomplete, aContent); mListeners.Enumerate(EnumAndSetIncomplete, aElement);
else if (aModType == nsIDOMMutationEvent::MODIFICATION) { else if (aModType == nsIDOMMutationEvent::MODIFICATION) {
//Remove possible listener //Remove possible listener
mListeners.Enumerate(EnumAndSetIncomplete, aContent); mListeners.Enumerate(EnumAndSetIncomplete, aElement);
//Add new listeners //Add new listeners
AddListeners(aDocument); AddListeners(aDocument);
} }

View File

@ -41,6 +41,8 @@
#include "nsSVGPathElement.h" #include "nsSVGPathElement.h"
#include "nsSVGAnimateMotionElement.h" #include "nsSVGAnimateMotionElement.h"
using namespace mozilla::dom;
nsSVGElement::StringInfo nsSVGMpathElement::sStringInfo[1] = nsSVGElement::StringInfo nsSVGMpathElement::sStringInfo[1] =
{ {
{ &nsGkAtoms::href, kNameSpaceID_XLink }, { &nsGkAtoms::href, kNameSpaceID_XLink },
@ -196,10 +198,10 @@ nsSVGMpathElement::GetStringInfo()
// nsIMutationObserver methods // nsIMutationObserver methods
void void
nsSVGMpathElement::AttributeChanged(nsIDocument *aDocument, nsSVGMpathElement::AttributeChanged(nsIDocument* aDocument,
nsIContent *aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom *aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
if (aNameSpaceID == kNameSpaceID_None) { if (aNameSpaceID == kNameSpaceID_None) {

View File

@ -42,6 +42,9 @@
#include "nsIDOMSVGSymbolElement.h" #include "nsIDOMSVGSymbolElement.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::dom;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// implementation // implementation
@ -194,13 +197,13 @@ nsSVGUseElement::CharacterDataChanged(nsIDocument *aDocument,
} }
void void
nsSVGUseElement::AttributeChanged(nsIDocument *aDocument, nsSVGUseElement::AttributeChanged(nsIDocument* aDocument,
nsIContent *aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom *aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) { if (nsContentUtils::IsInSameAnonymousTree(this, aElement)) {
TriggerReclone(); TriggerReclone();
} }
} }

View File

@ -51,10 +51,12 @@
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsIDOMDocumentFragment.h" #include "nsIDOMDocumentFragment.h"
#include "nsBindingManager.h" #include "nsBindingManager.h"
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter, NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter,
nsIDocumentObserver, nsIDocumentObserver,
nsIMutationObserver) nsIMutationObserver)
@ -235,12 +237,12 @@ nsXMLPrettyPrinter::EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType)
void void
nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument, nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
MaybeUnhook(aContent); MaybeUnhook(aElement);
} }
void void

View File

@ -40,7 +40,7 @@
#include "txExprResult.h" #include "txExprResult.h"
#include "txNodeSet.h" #include "txNodeSet.h"
#include "nsDOMError.h" #include "nsDOMError.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsIAttribute.h" #include "nsIAttribute.h"
#include "nsIDOMClassInfo.h" #include "nsIDOMClassInfo.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
@ -49,6 +49,8 @@
#include "txXPathTreeWalker.h" #include "txXPathTreeWalker.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
using namespace mozilla::dom;
nsXPathResult::nsXPathResult() : mDocument(nsnull), nsXPathResult::nsXPathResult() : mDocument(nsnull),
mCurrentPos(0), mCurrentPos(0),
mResultType(ANY_TYPE), mResultType(ANY_TYPE),
@ -248,12 +250,12 @@ nsXPathResult::CharacterDataChanged(nsIDocument* aDocument,
void void
nsXPathResult::AttributeChanged(nsIDocument* aDocument, nsXPathResult::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
Invalidate(aContent); Invalidate(aElement);
} }
void void

View File

@ -40,7 +40,7 @@
#include "nsContentCID.h" #include "nsContentCID.h"
#include "nsDOMError.h" #include "nsDOMError.h"
#include "nsIChannel.h" #include "nsIChannel.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMText.h" #include "nsIDOMText.h"
#include "nsIDocument.h" #include "nsIDocument.h"
@ -68,6 +68,8 @@
#include "nsIErrorService.h" #include "nsIErrorService.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
using namespace mozilla::dom;
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID); static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
/** /**
@ -1228,7 +1230,7 @@ txMozillaXSLTProcessor::CharacterDataChanged(nsIDocument* aDocument,
void void
txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument, txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)

View File

@ -994,7 +994,7 @@ nsXULDocument::AttributeWillChange(nsIDocument* aDocument,
void void
nsXULDocument::AttributeChanged(nsIDocument* aDocument, nsXULDocument::AttributeChanged(nsIDocument* aDocument,
nsIContent* aElementContent, PRInt32 aNameSpaceID, Element* aElement, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType) nsIAtom* aAttribute, PRInt32 aModType)
{ {
NS_ASSERTION(aDocument == this, "unexpected doc"); NS_ASSERTION(aDocument == this, "unexpected doc");
@ -1002,9 +1002,6 @@ nsXULDocument::AttributeChanged(nsIDocument* aDocument,
// Might not need this, but be safe for now. // Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
// XXXbz once we change AttributeChanged to take Element, we can nix this line
Element* aElement = aElementContent->AsElement();
// XXXbz check aNameSpaceID, dammit! // XXXbz check aNameSpaceID, dammit!
// See if we need to update our ref map. // See if we need to update our ref map.
if (aAttribute == nsGkAtoms::ref || if (aAttribute == nsGkAtoms::ref ||

View File

@ -71,6 +71,8 @@
#include "pldhash.h" #include "pldhash.h"
#include "rdf.h" #include "rdf.h"
using namespace mozilla::dom;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// Return values for EnsureElementHasGenericChild() // Return values for EnsureElementHasGenericChild()
@ -1557,7 +1559,7 @@ nsXULContentBuilder::GetResultForContent(nsIDOMElement* aElement,
void void
nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument, nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
@ -1567,14 +1569,14 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
// Handle "open" and "close" cases. We do this handling before // Handle "open" and "close" cases. We do this handling before
// we've notified the observer, so that content is already created // we've notified the observer, so that content is already created
// for the frame system to walk. // for the frame system to walk.
if ((aContent->GetNameSpaceID() == kNameSpaceID_XUL) && if (aElement->GetNameSpaceID() == kNameSpaceID_XUL &&
(aAttribute == nsGkAtoms::open)) { aAttribute == nsGkAtoms::open) {
// We're on a XUL tag, and an ``open'' attribute changed. // We're on a XUL tag, and an ``open'' attribute changed.
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open, if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
nsGkAtoms::_true, eCaseMatters)) nsGkAtoms::_true, eCaseMatters))
OpenContainer(aContent); OpenContainer(aElement);
else else
CloseContainer(aContent); CloseContainer(aElement);
} }
if ((aNameSpaceID == kNameSpaceID_XUL) && if ((aNameSpaceID == kNameSpaceID_XUL) &&
@ -1585,7 +1587,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
mSortState.initialized = PR_FALSE; mSortState.initialized = PR_FALSE;
// Pass along to the generic template builder. // Pass along to the generic template builder.
nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, nsXULTemplateBuilder::AttributeChanged(aDocument, aElement, aNameSpaceID,
aAttribute, aModType); aAttribute, aModType);
} }

View File

@ -108,6 +108,8 @@
#include "nsXULTemplateQueryProcessorXML.h" #include "nsXULTemplateQueryProcessorXML.h"
#include "nsXULTemplateQueryProcessorStorage.h" #include "nsXULTemplateQueryProcessorStorage.h"
using namespace mozilla::dom;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID); static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
@ -1115,12 +1117,12 @@ nsXULTemplateBuilder::Observe(nsISupports* aSubject,
void void
nsXULTemplateBuilder::AttributeChanged(nsIDocument* aDocument, nsXULTemplateBuilder::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
if (aContent == mRoot && aNameSpaceID == kNameSpaceID_None) { if (aElement == mRoot && aNameSpaceID == kNameSpaceID_None) {
// Check for a change to the 'ref' attribute on an atom, in which // Check for a change to the 'ref' attribute on an atom, in which
// case we may need to nuke and rebuild the entire content model // case we may need to nuke and rebuild the entire content model
// beneath the element. // beneath the element.

View File

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
* /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * The contents of this file are subject to the Mozilla Public License Version
@ -57,6 +56,8 @@
#include "nsDocShellEditorData.h" #include "nsDocShellEditorData.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
namespace dom = mozilla::dom;
// Hardcode this to time out unused content viewers after 30 minutes // Hardcode this to time out unused content viewers after 30 minutes
#define CONTENT_VIEWER_TIMEOUT_SECONDS 30*60 #define CONTENT_VIEWER_TIMEOUT_SECONDS 30*60
@ -823,7 +824,7 @@ nsSHEntry::AttributeWillChange(nsIDocument* aDocument,
void void
nsSHEntry::AttributeChanged(nsIDocument* aDocument, nsSHEntry::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)

View File

@ -8135,12 +8135,11 @@ nsCSSFrameConstructor::AttributeWillChange(nsIContent* aContent,
} }
void void
nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent, nsCSSFrameConstructor::AttributeChanged(Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
Element* aElement = aContent->AsElement();
// Hold onto the PresShell to prevent ourselves from being destroyed. // Hold onto the PresShell to prevent ourselves from being destroyed.
// XXXbz how, exactly, would this attribute change cause us to be // XXXbz how, exactly, would this attribute change cause us to be
// destroyed from inside this function? // destroyed from inside this function?

View File

@ -263,10 +263,10 @@ public:
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType); PRInt32 aModType);
void AttributeChanged(nsIContent* aContent, void AttributeChanged(Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType); PRInt32 aModType);
void BeginUpdate(); void BeginUpdate();
void EndUpdate(); void EndUpdate();

View File

@ -4949,7 +4949,7 @@ PresShell::AttributeWillChange(nsIDocument* aDocument,
void void
PresShell::AttributeChanged(nsIDocument* aDocument, PresShell::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
@ -4962,7 +4962,7 @@ PresShell::AttributeChanged(nsIDocument* aDocument,
// squelch any other inappropriate notifications as well. // squelch any other inappropriate notifications as well.
if (mDidInitialReflow) { if (mDidInitialReflow) {
nsAutoCauseReflowNotifier crNotifier(this); nsAutoCauseReflowNotifier crNotifier(this);
mFrameConstructor->AttributeChanged(aContent, aNameSpaceID, mFrameConstructor->AttributeChanged(aElement, aNameSpaceID,
aAttribute, aModType); aAttribute, aModType);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
} }

View File

@ -48,7 +48,7 @@
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsTextFragment.h" #include "nsTextFragment.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLMapElement.h" #include "nsIDOMHTMLMapElement.h"
#include "nsIDOMHTMLAreaElement.h" #include "nsIDOMHTMLAreaElement.h"
@ -68,6 +68,8 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
namespace dom = mozilla::dom;
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
class Area { class Area {
@ -918,23 +920,23 @@ nsImageMap::MaybeUpdateAreas(nsIContent *aContent)
} }
void void
nsImageMap::AttributeChanged(nsIDocument* aDocument, nsImageMap::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
// If the parent of the changing content node is our map then update // If the parent of the changing content node is our map then update
// the map. But only do this if the node is an HTML <area> or <a> // the map. But only do this if the node is an HTML <area> or <a>
// and the attribute that's changing is "shape" or "coords" -- those // and the attribute that's changing is "shape" or "coords" -- those
// are the only cases we care about. // are the only cases we care about.
if ((aContent->NodeInfo()->Equals(nsGkAtoms::area) || if ((aElement->NodeInfo()->Equals(nsGkAtoms::area) ||
aContent->NodeInfo()->Equals(nsGkAtoms::a)) && aElement->NodeInfo()->Equals(nsGkAtoms::a)) &&
aContent->IsHTML() && aElement->IsHTML() &&
aNameSpaceID == kNameSpaceID_None && aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::shape || (aAttribute == nsGkAtoms::shape ||
aAttribute == nsGkAtoms::coords)) { aAttribute == nsGkAtoms::coords)) {
MaybeUpdateAreas(aContent->GetParent()); MaybeUpdateAreas(aElement->GetParent());
} }
} }

View File

@ -63,6 +63,8 @@
#include "nsIAccessibilityService.h" #include "nsIAccessibilityService.h"
#endif #endif
namespace dom = mozilla::dom;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// inDOMViewNode // inDOMViewNode
@ -682,7 +684,7 @@ inDOMView::NodeWillBeDestroyed(const nsINode* aNode)
} }
void void
inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement,
PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
@ -697,8 +699,8 @@ inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
// get the dom attribute node, if there is any // get the dom attribute node, if there is any
nsCOMPtr<nsIDOMNode> content(do_QueryInterface(aContent)); nsCOMPtr<nsIDOMNode> content(do_QueryInterface(aElement));
nsCOMPtr<nsIDOMElement> el(do_QueryInterface(aContent)); nsCOMPtr<nsIDOMElement> el(do_QueryInterface(aElement));
nsCOMPtr<nsIDOMAttr> domAttr; nsCOMPtr<nsIDOMAttr> domAttr;
nsDependentAtomString attrStr(aAttribute); nsDependentAtomString attrStr(aAttribute);
if (aNameSpaceID) { if (aNameSpaceID) {

View File

@ -186,10 +186,10 @@ nsSVGRenderingObserver::InvalidateViaReferencedElement()
} }
void void
nsSVGRenderingObserver::AttributeChanged(nsIDocument *aDocument, nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument,
nsIContent *aContent, dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom *aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
// An attribute belonging to the element that we are observing *or one of its // An attribute belonging to the element that we are observing *or one of its

View File

@ -53,6 +53,8 @@
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsSVGMatrix.h" #include "nsSVGMatrix.h"
namespace dom = mozilla::dom;
class nsSVGMutationObserver : public nsStubMutationObserver class nsSVGMutationObserver : public nsStubMutationObserver
{ {
public: public:
@ -81,17 +83,17 @@ static nsSVGMutationObserver sSVGMutationObserver;
// nsIMutationObserver methods // nsIMutationObserver methods
void void
nsSVGMutationObserver::AttributeChanged(nsIDocument *aDocument, nsSVGMutationObserver::AttributeChanged(nsIDocument* aDocument,
nsIContent *aContent, dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom *aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
if (aNameSpaceID != kNameSpaceID_XML || aAttribute != nsGkAtoms::space) { if (aNameSpaceID != kNameSpaceID_XML || aAttribute != nsGkAtoms::space) {
return; return;
} }
nsIFrame* frame = aContent->GetPrimaryFrame(); nsIFrame* frame = aElement->GetPrimaryFrame();
if (!frame) { if (!frame) {
return; return;
} }

View File

@ -49,6 +49,9 @@
#include "nsIXULSortService.h" #include "nsIXULSortService.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsTreeBodyFrame.h" #include "nsTreeBodyFrame.h"
#include "mozilla/dom/Element.h"
namespace dom = mozilla::dom;
#define NS_ENSURE_NATIVE_COLUMN(_col) \ #define NS_ENSURE_NATIVE_COLUMN(_col) \
nsRefPtr<nsTreeColumn> col = nsTreeBodyFrame::GetColumnImpl(_col); \ nsRefPtr<nsTreeColumn> col = nsTreeBodyFrame::GetColumnImpl(_col); \
@ -836,25 +839,25 @@ nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
} }
void void
nsTreeContentView::AttributeChanged(nsIDocument *aDocument, nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
// Lots of codepaths under here that do all sorts of stuff, so be safe. // Lots of codepaths under here that do all sorts of stuff, so be safe.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
// Make sure this notification concerns us. // Make sure this notification concerns us.
// First check the tag to see if it's one that we care about. // First check the tag to see if it's one that we care about.
nsIAtom *tag = aContent->Tag(); nsIAtom* tag = aElement->Tag();
if (mBoxObject && (aContent == mRoot || aContent == mBody)) { if (mBoxObject && (aElement == mRoot || aElement == mBody)) {
mBoxObject->ClearStyleAndImageCaches(); mBoxObject->ClearStyleAndImageCaches();
mBoxObject->Invalidate(); mBoxObject->Invalidate();
} }
if (aContent->IsXUL()) { if (aElement->IsXUL()) {
if (tag != nsGkAtoms::treecol && if (tag != nsGkAtoms::treecol &&
tag != nsGkAtoms::treeitem && tag != nsGkAtoms::treeitem &&
tag != nsGkAtoms::treeseparator && tag != nsGkAtoms::treeseparator &&
@ -862,7 +865,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
tag != nsGkAtoms::treecell) tag != nsGkAtoms::treecell)
return; return;
// We don't consider XUL nodes under non-XUL nodes. // We don't consider XUL nodes under non-XUL nodes.
if (!aContent->GetParent()->IsXUL()) if (!aElement->GetParent()->IsXUL())
return; return;
} }
else { else {
@ -872,7 +875,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
// If we have a legal tag, go up to the tree/select and make sure // If we have a legal tag, go up to the tree/select and make sure
// that it's ours. // that it's ours.
for (nsIContent* element = aContent; element != mBody; element = element->GetParent()) { for (nsIContent* element = aElement; element != mBody; element = element->GetParent()) {
if (!element) if (!element)
return; // this is not for us return; // this is not for us
nsIAtom *parentTag = element->Tag(); nsIAtom *parentTag = element->Tag();
@ -884,11 +887,11 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
// Handle changes of the hidden attribute. // Handle changes of the hidden attribute.
if (aAttribute == nsGkAtoms::hidden && if (aAttribute == nsGkAtoms::hidden &&
(tag == nsGkAtoms::treeitem || tag == nsGkAtoms::treeseparator)) { (tag == nsGkAtoms::treeitem || tag == nsGkAtoms::treeseparator)) {
PRBool hidden = aContent->AttrValueIs(kNameSpaceID_None, PRBool hidden = aElement->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::hidden, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters); nsGkAtoms::_true, eCaseMatters);
PRInt32 index = FindContent(aContent); PRInt32 index = FindContent(aElement);
if (hidden && index >= 0) { if (hidden && index >= 0) {
// Hide this row along with its children. // Hide this row along with its children.
PRInt32 count = RemoveRow(index); PRInt32 count = RemoveRow(index);
@ -897,9 +900,9 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
} }
else if (!hidden && index < 0) { else if (!hidden && index < 0) {
// Show this row along with its children. // Show this row along with its children.
nsCOMPtr<nsIContent> parent = aContent->GetParent(); nsCOMPtr<nsIContent> parent = aElement->GetParent();
if (parent) { if (parent) {
InsertRowFor(parent, aContent); InsertRowFor(parent, aElement);
} }
} }
@ -912,7 +915,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
nsCOMPtr<nsITreeColumns> cols; nsCOMPtr<nsITreeColumns> cols;
mBoxObject->GetColumns(getter_AddRefs(cols)); mBoxObject->GetColumns(getter_AddRefs(cols));
if (cols) { if (cols) {
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aContent); nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aElement);
nsCOMPtr<nsITreeColumn> col; nsCOMPtr<nsITreeColumn> col;
cols->GetColumnFor(element, getter_AddRefs(col)); cols->GetColumnFor(element, getter_AddRefs(col));
mBoxObject->InvalidateColumn(col); mBoxObject->InvalidateColumn(col);
@ -921,12 +924,12 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
} }
} }
else if (tag == nsGkAtoms::treeitem) { else if (tag == nsGkAtoms::treeitem) {
PRInt32 index = FindContent(aContent); PRInt32 index = FindContent(aElement);
if (index >= 0) { if (index >= 0) {
Row* row = mRows[index]; Row* row = mRows[index];
if (aAttribute == nsGkAtoms::container) { if (aAttribute == nsGkAtoms::container) {
PRBool isContainer = PRBool isContainer =
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container, aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
nsGkAtoms::_true, eCaseMatters); nsGkAtoms::_true, eCaseMatters);
row->SetContainer(isContainer); row->SetContainer(isContainer);
if (mBoxObject) if (mBoxObject)
@ -934,7 +937,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
} }
else if (aAttribute == nsGkAtoms::open) { else if (aAttribute == nsGkAtoms::open) {
PRBool isOpen = PRBool isOpen =
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open, aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
nsGkAtoms::_true, eCaseMatters); nsGkAtoms::_true, eCaseMatters);
PRBool wasOpen = row->IsOpen(); PRBool wasOpen = row->IsOpen();
if (! isOpen && wasOpen) if (! isOpen && wasOpen)
@ -944,7 +947,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
} }
else if (aAttribute == nsGkAtoms::empty) { else if (aAttribute == nsGkAtoms::empty) {
PRBool isEmpty = PRBool isEmpty =
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::empty, aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::empty,
nsGkAtoms::_true, eCaseMatters); nsGkAtoms::_true, eCaseMatters);
row->SetEmpty(isEmpty); row->SetEmpty(isEmpty);
if (mBoxObject) if (mBoxObject)
@ -953,7 +956,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
} }
} }
else if (tag == nsGkAtoms::treeseparator) { else if (tag == nsGkAtoms::treeseparator) {
PRInt32 index = FindContent(aContent); PRInt32 index = FindContent(aElement);
if (index >= 0) { if (index >= 0) {
if (aAttribute == nsGkAtoms::properties && mBoxObject) { if (aAttribute == nsGkAtoms::properties && mBoxObject) {
mBoxObject->InvalidateRow(index); mBoxObject->InvalidateRow(index);
@ -962,7 +965,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
} }
else if (tag == nsGkAtoms::treerow) { else if (tag == nsGkAtoms::treerow) {
if (aAttribute == nsGkAtoms::properties) { if (aAttribute == nsGkAtoms::properties) {
nsCOMPtr<nsIContent> parent = aContent->GetParent(); nsCOMPtr<nsIContent> parent = aElement->GetParent();
if (parent) { if (parent) {
PRInt32 index = FindContent(parent); PRInt32 index = FindContent(parent);
if (index >= 0 && mBoxObject) { if (index >= 0 && mBoxObject) {
@ -978,7 +981,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
aAttribute == nsGkAtoms::src || aAttribute == nsGkAtoms::src ||
aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::value ||
aAttribute == nsGkAtoms::label) { aAttribute == nsGkAtoms::label) {
nsIContent* parent = aContent->GetParent(); nsIContent* parent = aElement->GetParent();
if (parent) { if (parent) {
nsCOMPtr<nsIContent> grandParent = parent->GetParent(); nsCOMPtr<nsIContent> grandParent = parent->GetParent();
if (grandParent && grandParent->IsXUL()) { if (grandParent && grandParent->IsXUL()) {

View File

@ -61,6 +61,7 @@ void ObserveContentInserted(nsIDocument *aDocument, nsIContent *aChild, PRInt32
class nsChangeObserver class nsChangeObserver
{ {
public: public:
// XXX use dom::Element
virtual void ObserveAttributeChanged(nsIDocument* aDocument, virtual void ObserveAttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
nsIAtom* aAttribute)=0; nsIAtom* aAttribute)=0;

View File

@ -53,7 +53,7 @@
#include "nsHashtable.h" #include "nsHashtable.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
@ -61,6 +61,8 @@
#include "nsINode.h" #include "nsINode.h"
namespace dom = mozilla::dom;
NS_IMPL_ISUPPORTS1(nsMenuGroupOwnerX, nsIMutationObserver) NS_IMPL_ISUPPORTS1(nsMenuGroupOwnerX, nsIMutationObserver)
@ -145,16 +147,16 @@ void nsMenuGroupOwnerX::AttributeWillChange(nsIDocument* aDocument,
} }
void nsMenuGroupOwnerX::AttributeChanged(nsIDocument * aDocument, void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
nsIContent * aContent, dom::Element* aElement,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom * aAttribute, nsIAtom* aAttribute,
PRInt32 aModType) PRInt32 aModType)
{ {
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aContent); nsChangeObserver* obs = LookupContentChangeObserver(aElement);
if (obs) if (obs)
obs->ObserveAttributeChanged(aDocument, aContent, aAttribute); obs->ObserveAttributeChanged(aDocument, aElement, aAttribute);
} }