mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 562698 - Part a: Pass Elements to nsIMutationObserver::AttributeChanged and nsCSSFrameConstructor::AttributeChanged; r=bzbarsky, a=dbaron
This commit is contained in:
parent
f78fc8c036
commit
27271a8a8f
@ -73,10 +73,13 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIXULDocument.h"
|
||||
#endif
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static member initialization
|
||||
|
||||
@ -905,15 +908,16 @@ nsDocAccessible::AttributeWillChange(nsIDocument *aDocument,
|
||||
}
|
||||
|
||||
void
|
||||
nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
|
||||
nsDocAccessible::AttributeChanged(nsIDocument *aDocument,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
AttributeChangedImpl(aContent, aNameSpaceID, aAttribute);
|
||||
AttributeChangedImpl(aElement, aNameSpaceID, aAttribute);
|
||||
|
||||
// If it was the focused node, cache the new state
|
||||
if (aContent == gLastFocusedNode) {
|
||||
nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aContent);
|
||||
if (aElement == gLastFocusedNode) {
|
||||
nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aElement);
|
||||
if (focusedAccessible)
|
||||
gLastFocusedAccessiblesState = nsAccUtils::State(focusedAccessible);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ms2ger <ms2ger@gmail.com>
|
||||
*
|
||||
* 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"),
|
||||
@ -34,8 +35,9 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsIMutationObserver_h___
|
||||
#define nsIMutationObserver_h___
|
||||
|
||||
#ifndef nsIMutationObserver_h
|
||||
#define nsIMutationObserver_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
@ -44,6 +46,12 @@ class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsINode;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IMUTATION_OBSERVER_IID \
|
||||
{ 0x85eea794, 0xed8e, 0x4e1b, \
|
||||
{ 0xa1, 0x28, 0xd0, 0x93, 0x00, 0xae, 0x51, 0xaa } }
|
||||
@ -181,7 +189,7 @@ public:
|
||||
* Notification that an attribute of an element has changed.
|
||||
*
|
||||
* @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 aAttribute The name of the changed attribute
|
||||
* @param aModType Whether or not the attribute was added, changed, or
|
||||
@ -195,7 +203,7 @@ public:
|
||||
* the stack.
|
||||
*/
|
||||
virtual void AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
mozilla::dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType) = 0;
|
||||
@ -333,7 +341,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
|
||||
|
||||
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \
|
||||
virtual void AttributeChanged(nsIDocument* aDocument, \
|
||||
nsIContent* aContent, \
|
||||
mozilla::dom::Element* aElement, \
|
||||
PRInt32 aNameSpaceID, \
|
||||
nsIAtom* aAttribute, \
|
||||
PRInt32 aModType);
|
||||
@ -403,7 +411,7 @@ _class::AttributeWillChange(nsIDocument* aDocument, \
|
||||
} \
|
||||
void \
|
||||
_class::AttributeChanged(nsIDocument* aDocument, \
|
||||
nsIContent* aContent, \
|
||||
mozilla::dom::Element* aElement, \
|
||||
PRInt32 aNameSpaceID, \
|
||||
nsIAtom* aAttribute, \
|
||||
PRInt32 aModType) \
|
||||
@ -437,4 +445,4 @@ _class::ParentChainChanged(nsIContent *aContent) \
|
||||
}
|
||||
|
||||
|
||||
#endif /* nsIMutationObserver_h___ */
|
||||
#endif /* nsIMutationObserver_h */
|
||||
|
@ -605,39 +605,38 @@ nsContentList::GetNamedItem(const nsAString& aName, nsWrapperCache **aCache,
|
||||
}
|
||||
|
||||
void
|
||||
nsContentList::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
|
||||
nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "Must have a content node to work with");
|
||||
NS_PRECONDITION(aContent->IsElement(), "Should be an element");
|
||||
NS_PRECONDITION(aElement, "Must have a content node to work with");
|
||||
|
||||
if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY ||
|
||||
!MayContainRelevantNodes(aContent->GetNodeParent()) ||
|
||||
!nsContentUtils::IsInSameAnonymousTree(mRootNode, aContent)) {
|
||||
!MayContainRelevantNodes(aElement->GetNodeParent()) ||
|
||||
!nsContentUtils::IsInSameAnonymousTree(mRootNode, aElement)) {
|
||||
// Either we're already dirty or this notification doesn't affect
|
||||
// whether we might match aContent.
|
||||
// whether we might match aElement.
|
||||
return;
|
||||
}
|
||||
|
||||
if (Match(aContent->AsElement())) {
|
||||
if (mElements.IndexOf(aContent) == -1) {
|
||||
// We match aContent now, and it's not in our list already. Just dirty
|
||||
if (Match(aElement)) {
|
||||
if (mElements.IndexOf(aElement) == -1) {
|
||||
// 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
|
||||
// aContent.
|
||||
// aElement.
|
||||
SetDirty();
|
||||
}
|
||||
} 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
|
||||
// expensive one). Either way, no change of mState is required
|
||||
// here.
|
||||
mElements.RemoveObject(aContent);
|
||||
mElements.RemoveObject(aElement);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContentList::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
|
||||
nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "nsDOMAttribute.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsDOMError.h"
|
||||
@ -60,6 +60,8 @@
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsMutationEvent.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
PRBool nsDOMAttribute::sInitialized;
|
||||
|
||||
@ -746,13 +748,13 @@ nsDOMAttribute::EnsureChildState()
|
||||
|
||||
void
|
||||
nsDOMAttribute::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsIContent* content = GetContentInternal();
|
||||
if (aContent != content) {
|
||||
if (aElement != content) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,9 +122,10 @@ nsNodeUtils::AttributeChanged(nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsIDocument* doc = aContent->GetOwnerDoc();
|
||||
IMPL_MUTATION_NOTIFICATION(AttributeChanged, aContent,
|
||||
(doc, aContent, aNameSpaceID, aAttribute,
|
||||
Element* aElement = aContent->AsElement();
|
||||
nsIDocument* doc = aElement->GetOwnerDoc();
|
||||
IMPL_MUTATION_NOTIFICATION(AttributeChanged, aElement,
|
||||
(doc, aElement, aNameSpaceID, aAttribute,
|
||||
aModType));
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsScriptElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
@ -47,6 +47,8 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptElement::ScriptAvailable(nsresult aResult,
|
||||
nsIScriptElement *aElement,
|
||||
@ -118,7 +120,7 @@ nsScriptElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||
|
||||
void
|
||||
nsScriptElement::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
/**
|
||||
* class used to implement attr() generated content
|
||||
@ -337,13 +338,13 @@ nsAttributeTextNode::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
||||
|
||||
void
|
||||
nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
if (aNameSpaceID == mNameSpaceID && aAttribute == mAttrName &&
|
||||
aContent == mGrandparent) {
|
||||
aElement == mGrandparent) {
|
||||
// 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
|
||||
// have no grandparent when it fires, and will do nothing.
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include "nsINodeInfo.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
PRBool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument,
|
||||
nsXMLEventsManager * aManager,
|
||||
nsIContent * aContent)
|
||||
@ -334,7 +336,7 @@ nsXMLEventsManager::EndLoad(nsIDocument* aDocument)
|
||||
|
||||
void
|
||||
nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
@ -348,23 +350,23 @@ nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
|
||||
aAttribute == nsGkAtoms::observer ||
|
||||
aAttribute == nsGkAtoms::phase ||
|
||||
aAttribute == nsGkAtoms::propagate)) {
|
||||
RemoveListener(aContent);
|
||||
AddXMLEventsContent(aContent);
|
||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
|
||||
RemoveListener(aElement);
|
||||
AddXMLEventsContent(aElement);
|
||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aElement);
|
||||
}
|
||||
else {
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::listener,
|
||||
if (aElement->NodeInfo()->Equals(nsGkAtoms::listener,
|
||||
kNameSpaceID_XMLEvents)) {
|
||||
RemoveListener(aContent);
|
||||
AddXMLEventsContent(aContent);
|
||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
|
||||
RemoveListener(aElement);
|
||||
AddXMLEventsContent(aElement);
|
||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aElement);
|
||||
}
|
||||
else if (aContent->GetIDAttributeName() == aAttribute) {
|
||||
else if (aElement->GetIDAttributeName() == aAttribute) {
|
||||
if (aModType == nsIDOMMutationEvent::REMOVAL)
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aContent);
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aElement);
|
||||
else if (aModType == nsIDOMMutationEvent::MODIFICATION) {
|
||||
//Remove possible listener
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aContent);
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aElement);
|
||||
//Add new listeners
|
||||
AddListeners(aDocument);
|
||||
}
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "nsSVGPathElement.h"
|
||||
#include "nsSVGAnimateMotionElement.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsSVGElement::StringInfo nsSVGMpathElement::sStringInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::href, kNameSpaceID_XLink },
|
||||
@ -196,10 +198,10 @@ nsSVGMpathElement::GetStringInfo()
|
||||
// nsIMutationObserver methods
|
||||
|
||||
void
|
||||
nsSVGMpathElement::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent *aContent,
|
||||
nsSVGMpathElement::AttributeChanged(nsIDocument* aDocument,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom *aAttribute,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
|
@ -42,6 +42,9 @@
|
||||
#include "nsIDOMSVGSymbolElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// implementation
|
||||
@ -194,13 +197,13 @@ nsSVGUseElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGUseElement::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent *aContent,
|
||||
nsSVGUseElement::AttributeChanged(nsIDocument* aDocument,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom *aAttribute,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
|
||||
if (nsContentUtils::IsInSameAnonymousTree(this, aElement)) {
|
||||
TriggerReclone();
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +51,12 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsBindingManager.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter,
|
||||
nsIDocumentObserver,
|
||||
nsIMutationObserver)
|
||||
@ -235,12 +237,12 @@ nsXMLPrettyPrinter::EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType)
|
||||
|
||||
void
|
||||
nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
MaybeUnhook(aContent);
|
||||
MaybeUnhook(aElement);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "txExprResult.h"
|
||||
#include "txNodeSet.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIAttribute.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMNode.h"
|
||||
@ -49,6 +49,8 @@
|
||||
#include "txXPathTreeWalker.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsXPathResult::nsXPathResult() : mDocument(nsnull),
|
||||
mCurrentPos(0),
|
||||
mResultType(ANY_TYPE),
|
||||
@ -248,12 +250,12 @@ nsXPathResult::CharacterDataChanged(nsIDocument* aDocument,
|
||||
|
||||
void
|
||||
nsXPathResult::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
Invalidate(aContent);
|
||||
Invalidate(aElement);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "nsContentCID.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -68,6 +68,8 @@
|
||||
#include "nsIErrorService.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
|
||||
/**
|
||||
@ -1228,7 +1230,7 @@ txMozillaXSLTProcessor::CharacterDataChanged(nsIDocument* aDocument,
|
||||
|
||||
void
|
||||
txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
|
@ -994,7 +994,7 @@ nsXULDocument::AttributeWillChange(nsIDocument* aDocument,
|
||||
|
||||
void
|
||||
nsXULDocument::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aElementContent, PRInt32 aNameSpaceID,
|
||||
Element* aElement, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute, PRInt32 aModType)
|
||||
{
|
||||
NS_ASSERTION(aDocument == this, "unexpected doc");
|
||||
@ -1002,9 +1002,6 @@ nsXULDocument::AttributeChanged(nsIDocument* aDocument,
|
||||
// Might not need this, but be safe for now.
|
||||
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!
|
||||
// See if we need to update our ref map.
|
||||
if (aAttribute == nsGkAtoms::ref ||
|
||||
|
@ -71,6 +71,8 @@
|
||||
#include "pldhash.h"
|
||||
#include "rdf.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// Return values for EnsureElementHasGenericChild()
|
||||
@ -1557,7 +1559,7 @@ nsXULContentBuilder::GetResultForContent(nsIDOMElement* aElement,
|
||||
|
||||
void
|
||||
nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
@ -1567,14 +1569,14 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
|
||||
// Handle "open" and "close" cases. We do this handling before
|
||||
// we've notified the observer, so that content is already created
|
||||
// for the frame system to walk.
|
||||
if ((aContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(aAttribute == nsGkAtoms::open)) {
|
||||
if (aElement->GetNameSpaceID() == kNameSpaceID_XUL &&
|
||||
aAttribute == nsGkAtoms::open) {
|
||||
// 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))
|
||||
OpenContainer(aContent);
|
||||
OpenContainer(aElement);
|
||||
else
|
||||
CloseContainer(aContent);
|
||||
CloseContainer(aElement);
|
||||
}
|
||||
|
||||
if ((aNameSpaceID == kNameSpaceID_XUL) &&
|
||||
@ -1585,7 +1587,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
|
||||
mSortState.initialized = PR_FALSE;
|
||||
|
||||
// Pass along to the generic template builder.
|
||||
nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID,
|
||||
nsXULTemplateBuilder::AttributeChanged(aDocument, aElement, aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,8 @@
|
||||
#include "nsXULTemplateQueryProcessorXML.h"
|
||||
#include "nsXULTemplateQueryProcessorStorage.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
|
||||
@ -1115,12 +1117,12 @@ nsXULTemplateBuilder::Observe(nsISupports* aSubject,
|
||||
|
||||
void
|
||||
nsXULTemplateBuilder::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
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
|
||||
// case we may need to nuke and rebuild the entire content model
|
||||
// beneath the element.
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* -*- Mode: C++; tab-width: 4; 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
|
||||
@ -57,6 +56,8 @@
|
||||
#include "nsDocShellEditorData.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
// Hardcode this to time out unused content viewers after 30 minutes
|
||||
#define CONTENT_VIEWER_TIMEOUT_SECONDS 30*60
|
||||
|
||||
@ -823,7 +824,7 @@ nsSHEntry::AttributeWillChange(nsIDocument* aDocument,
|
||||
|
||||
void
|
||||
nsSHEntry::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
|
@ -8135,12 +8135,11 @@ nsCSSFrameConstructor::AttributeWillChange(nsIContent* aContent,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent,
|
||||
nsCSSFrameConstructor::AttributeChanged(Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
Element* aElement = aContent->AsElement();
|
||||
// Hold onto the PresShell to prevent ourselves from being destroyed.
|
||||
// XXXbz how, exactly, would this attribute change cause us to be
|
||||
// destroyed from inside this function?
|
||||
|
@ -263,7 +263,7 @@ public:
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
void AttributeChanged(nsIContent* aContent,
|
||||
void AttributeChanged(Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
|
@ -4949,7 +4949,7 @@ PresShell::AttributeWillChange(nsIDocument* aDocument,
|
||||
|
||||
void
|
||||
PresShell::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
@ -4962,7 +4962,7 @@ PresShell::AttributeChanged(nsIDocument* aDocument,
|
||||
// squelch any other inappropriate notifications as well.
|
||||
if (mDidInitialReflow) {
|
||||
nsAutoCauseReflowNotifier crNotifier(this);
|
||||
mFrameConstructor->AttributeChanged(aContent, aNameSpaceID,
|
||||
mFrameConstructor->AttributeChanged(aElement, aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
VERIFY_STYLE_TREE;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
@ -68,6 +68,8 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
class Area {
|
||||
@ -919,7 +921,7 @@ nsImageMap::MaybeUpdateAreas(nsIContent *aContent)
|
||||
|
||||
void
|
||||
nsImageMap::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
@ -928,13 +930,13 @@ nsImageMap::AttributeChanged(nsIDocument* aDocument,
|
||||
// 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
|
||||
// are the only cases we care about.
|
||||
if ((aContent->NodeInfo()->Equals(nsGkAtoms::area) ||
|
||||
aContent->NodeInfo()->Equals(nsGkAtoms::a)) &&
|
||||
aContent->IsHTML() &&
|
||||
if ((aElement->NodeInfo()->Equals(nsGkAtoms::area) ||
|
||||
aElement->NodeInfo()->Equals(nsGkAtoms::a)) &&
|
||||
aElement->IsHTML() &&
|
||||
aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::shape ||
|
||||
aAttribute == nsGkAtoms::coords)) {
|
||||
MaybeUpdateAreas(aContent->GetParent());
|
||||
MaybeUpdateAreas(aElement->GetParent());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,8 @@
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// inDOMViewNode
|
||||
|
||||
@ -682,7 +684,7 @@ inDOMView::NodeWillBeDestroyed(const nsINode* aNode)
|
||||
}
|
||||
|
||||
void
|
||||
inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
|
||||
inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
@ -697,8 +699,8 @@ inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
// get the dom attribute node, if there is any
|
||||
nsCOMPtr<nsIDOMNode> content(do_QueryInterface(aContent));
|
||||
nsCOMPtr<nsIDOMElement> el(do_QueryInterface(aContent));
|
||||
nsCOMPtr<nsIDOMNode> content(do_QueryInterface(aElement));
|
||||
nsCOMPtr<nsIDOMElement> el(do_QueryInterface(aElement));
|
||||
nsCOMPtr<nsIDOMAttr> domAttr;
|
||||
nsDependentAtomString attrStr(aAttribute);
|
||||
if (aNameSpaceID) {
|
||||
|
@ -186,10 +186,10 @@ nsSVGRenderingObserver::InvalidateViaReferencedElement()
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGRenderingObserver::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent *aContent,
|
||||
nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom *aAttribute,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
// An attribute belonging to the element that we are observing *or one of its
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsSVGMatrix.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
class nsSVGMutationObserver : public nsStubMutationObserver
|
||||
{
|
||||
public:
|
||||
@ -81,17 +83,17 @@ static nsSVGMutationObserver sSVGMutationObserver;
|
||||
// nsIMutationObserver methods
|
||||
|
||||
void
|
||||
nsSVGMutationObserver::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent *aContent,
|
||||
nsSVGMutationObserver::AttributeChanged(nsIDocument* aDocument,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom *aAttribute,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
if (aNameSpaceID != kNameSpaceID_XML || aAttribute != nsGkAtoms::space) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
nsIFrame* frame = aElement->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
@ -49,6 +49,9 @@
|
||||
#include "nsIXULSortService.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTreeBodyFrame.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
#define NS_ENSURE_NATIVE_COLUMN(_col) \
|
||||
nsRefPtr<nsTreeColumn> col = nsTreeBodyFrame::GetColumnImpl(_col); \
|
||||
@ -836,8 +839,8 @@ nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
|
||||
}
|
||||
|
||||
void
|
||||
nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
@ -847,14 +850,14 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
|
||||
// Make sure this notification concerns us.
|
||||
// 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->Invalidate();
|
||||
}
|
||||
|
||||
if (aContent->IsXUL()) {
|
||||
if (aElement->IsXUL()) {
|
||||
if (tag != nsGkAtoms::treecol &&
|
||||
tag != nsGkAtoms::treeitem &&
|
||||
tag != nsGkAtoms::treeseparator &&
|
||||
@ -862,7 +865,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
tag != nsGkAtoms::treecell)
|
||||
return;
|
||||
// We don't consider XUL nodes under non-XUL nodes.
|
||||
if (!aContent->GetParent()->IsXUL())
|
||||
if (!aElement->GetParent()->IsXUL())
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -872,7 +875,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
// If we have a legal tag, go up to the tree/select and make sure
|
||||
// that it's ours.
|
||||
|
||||
for (nsIContent* element = aContent; element != mBody; element = element->GetParent()) {
|
||||
for (nsIContent* element = aElement; element != mBody; element = element->GetParent()) {
|
||||
if (!element)
|
||||
return; // this is not for us
|
||||
nsIAtom *parentTag = element->Tag();
|
||||
@ -884,11 +887,11 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
// Handle changes of the hidden attribute.
|
||||
if (aAttribute == nsGkAtoms::hidden &&
|
||||
(tag == nsGkAtoms::treeitem || tag == nsGkAtoms::treeseparator)) {
|
||||
PRBool hidden = aContent->AttrValueIs(kNameSpaceID_None,
|
||||
PRBool hidden = aElement->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
|
||||
PRInt32 index = FindContent(aContent);
|
||||
PRInt32 index = FindContent(aElement);
|
||||
if (hidden && index >= 0) {
|
||||
// Hide this row along with its children.
|
||||
PRInt32 count = RemoveRow(index);
|
||||
@ -897,9 +900,9 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
}
|
||||
else if (!hidden && index < 0) {
|
||||
// Show this row along with its children.
|
||||
nsCOMPtr<nsIContent> parent = aContent->GetParent();
|
||||
nsCOMPtr<nsIContent> parent = aElement->GetParent();
|
||||
if (parent) {
|
||||
InsertRowFor(parent, aContent);
|
||||
InsertRowFor(parent, aElement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -912,7 +915,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
nsCOMPtr<nsITreeColumns> cols;
|
||||
mBoxObject->GetColumns(getter_AddRefs(cols));
|
||||
if (cols) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aContent);
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aElement);
|
||||
nsCOMPtr<nsITreeColumn> col;
|
||||
cols->GetColumnFor(element, getter_AddRefs(col));
|
||||
mBoxObject->InvalidateColumn(col);
|
||||
@ -921,12 +924,12 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treeitem) {
|
||||
PRInt32 index = FindContent(aContent);
|
||||
PRInt32 index = FindContent(aElement);
|
||||
if (index >= 0) {
|
||||
Row* row = mRows[index];
|
||||
if (aAttribute == nsGkAtoms::container) {
|
||||
PRBool isContainer =
|
||||
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
|
||||
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
row->SetContainer(isContainer);
|
||||
if (mBoxObject)
|
||||
@ -934,7 +937,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
}
|
||||
else if (aAttribute == nsGkAtoms::open) {
|
||||
PRBool isOpen =
|
||||
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
PRBool wasOpen = row->IsOpen();
|
||||
if (! isOpen && wasOpen)
|
||||
@ -944,7 +947,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
}
|
||||
else if (aAttribute == nsGkAtoms::empty) {
|
||||
PRBool isEmpty =
|
||||
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::empty,
|
||||
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::empty,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
row->SetEmpty(isEmpty);
|
||||
if (mBoxObject)
|
||||
@ -953,7 +956,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treeseparator) {
|
||||
PRInt32 index = FindContent(aContent);
|
||||
PRInt32 index = FindContent(aElement);
|
||||
if (index >= 0) {
|
||||
if (aAttribute == nsGkAtoms::properties && mBoxObject) {
|
||||
mBoxObject->InvalidateRow(index);
|
||||
@ -962,7 +965,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
}
|
||||
else if (tag == nsGkAtoms::treerow) {
|
||||
if (aAttribute == nsGkAtoms::properties) {
|
||||
nsCOMPtr<nsIContent> parent = aContent->GetParent();
|
||||
nsCOMPtr<nsIContent> parent = aElement->GetParent();
|
||||
if (parent) {
|
||||
PRInt32 index = FindContent(parent);
|
||||
if (index >= 0 && mBoxObject) {
|
||||
@ -978,7 +981,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
|
||||
aAttribute == nsGkAtoms::src ||
|
||||
aAttribute == nsGkAtoms::value ||
|
||||
aAttribute == nsGkAtoms::label) {
|
||||
nsIContent* parent = aContent->GetParent();
|
||||
nsIContent* parent = aElement->GetParent();
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIContent> grandParent = parent->GetParent();
|
||||
if (grandParent && grandParent->IsXUL()) {
|
||||
|
@ -61,6 +61,7 @@ void ObserveContentInserted(nsIDocument *aDocument, nsIContent *aChild, PRInt32
|
||||
class nsChangeObserver
|
||||
{
|
||||
public:
|
||||
// XXX use dom::Element
|
||||
virtual void ObserveAttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute)=0;
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include "nsHashtable.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@ -61,6 +61,8 @@
|
||||
|
||||
#include "nsINode.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMenuGroupOwnerX, nsIMutationObserver)
|
||||
|
||||
|
||||
@ -145,16 +147,16 @@ void nsMenuGroupOwnerX::AttributeWillChange(nsIDocument* aDocument,
|
||||
}
|
||||
|
||||
|
||||
void nsMenuGroupOwnerX::AttributeChanged(nsIDocument * aDocument,
|
||||
nsIContent * aContent,
|
||||
void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
|
||||
dom::Element* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom * aAttribute,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
nsChangeObserver* obs = LookupContentChangeObserver(aContent);
|
||||
nsChangeObserver* obs = LookupContentChangeObserver(aElement);
|
||||
if (obs)
|
||||
obs->ObserveAttributeChanged(aDocument, aContent, aAttribute);
|
||||
obs->ObserveAttributeChanged(aDocument, aElement, aAttribute);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user