mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-29 18:18:27 +00:00
d43d81d5ab
- Bug 1194905 - Build libvpx neon code without -mthumb and -mfloat-abi=softfp. r=mshal (24098bdb7) - Remove spurious commandline.css from AF tree. (49cf2bb5c) - Bug 969914 - Make developer toolbar match the light devtools theme when applied;r=jwalker,r=pbrosset (4047862bd) - Bug 1152304 - Add displaying of block notes to dis() in the JS shell. (r=jimb) (9c1d7fa30) - Bug 1126987 - Fix _lastEventSize initialization in stack.js. r=vporof (2083cb437) - Bug 1140569 - Show async stacks attached to timeline markers. r=vporof (f05e1b60c) - Bug 1141553 - Give function name the devtools-monospace class in the profiler r=vporof (0ca698ea2) - Bug 1150112 - Markers overview should react to theme change, and other marker views now use CSS to automatically use theme change. r=vporof (6f72cde25) - Bug 1050500 - Add entry reason to timeline marker. r=jsantell, r=smaug (db9cf8191) - Bug 922221 - implement console.timeStamp(label) to create profile timeline markers. r=khuey (73e513562) - Bug 1059908 - Merge FunctionType and FunctionSyntaxKind. r=efaust (2d765bde5) - Bug 1059908 - Introduce a CONSTRUCTOR flag and make getter/setter/method non-constructable. r=efaust (fddb15f13) - Bug 1162310 - Do not use nonexistent macro when XGILL_PLUGIN is defined, r=bhackett (57a5c2861) - pointer style (55ec84b3b) - Bug 1164602 - Replace js::NullPtr and JS::NullPtr with nullptr_t; r=sfink (9ae473e29) - pointer style (7d735a2b9) - pointer style (987c0128b) - Bug 1135629 - Rename Register::code to Register::encoding for Assembler functions. r=jandem (cf915c814) - pointer style (ac97f0d0b) - Bug 1150337 - OdinMonkey: Optimize the full range of immediate offsets on x64. r=luke (fffb82aa6) - fix typos (511e17002) - pointer style (c1b54384c) - Bug 1135707 - Fix interaction between Arm NOP fill and calculation of IonCache rejoin label r=jandem (306365ec4) - pointer style (a8fe90ade) - Bug 1166809 - Remove DispatchIonCache and RepatchIonCache. r=bhackett (9b8b02bf1) - Bug 1147403 part 3 - Make IonSpewer work during off-thread compilation. r=h4writer Bug 1147403 part 3.1 - Replace newly added IonSpewPass after KeepAlive transform. r=KWierso (01bd66aa3) - Bug 1147403 part 4 - Extract the printer from the serializer. r=h4writer (290a8887e) - pointer style (fc70e6a1a) - Bug 1147403 part 0 - Replace contextual information of dispatchHook by lambdas. r=shu (e177990e5) - Bug 1065657 - Allow multiple Debuggers to track allocations at the same time. r=shu (66b5a3ba9) - pointer style (bb317bb87) - Bug 1147403 part 5 - Add Debugger::onIonCompilation hook. r=shu (c14a28de1) - Bug 1147403 part 6 - Remove GetJitContext from serializing functions. r=h4writer (6d3d605a5) - pointer style (b2ec50945) - Bug 1147403 part 7 - Fix inIon, only reset the counter when the function is executed. r=jandem (cb6c180ef) - Bug 1165392, Bug 1165463 - Various unboxed array fixes and optimizations, r=jandem. (28ec85004)
287 lines
12 KiB
C++
287 lines
12 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef nsNodeUtils_h___
|
|
#define nsNodeUtils_h___
|
|
|
|
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
|
|
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
|
|
#include "js/TypeDecls.h"
|
|
#include "nsCOMArray.h"
|
|
|
|
struct CharacterDataChangeInfo;
|
|
template<class E> class nsCOMArray;
|
|
class nsCycleCollectionTraversalCallback;
|
|
namespace mozilla {
|
|
namespace dom {
|
|
class Animation;
|
|
}
|
|
}
|
|
|
|
class nsNodeUtils
|
|
{
|
|
public:
|
|
/**
|
|
* Send CharacterDataWillChange notifications to nsIMutationObservers.
|
|
* @param aContent Node whose data changed
|
|
* @param aInfo Struct with information details about the change
|
|
* @see nsIMutationObserver::CharacterDataWillChange
|
|
*/
|
|
static void CharacterDataWillChange(nsIContent* aContent,
|
|
CharacterDataChangeInfo* aInfo);
|
|
|
|
/**
|
|
* Send CharacterDataChanged notifications to nsIMutationObservers.
|
|
* @param aContent Node whose data changed
|
|
* @param aInfo Struct with information details about the change
|
|
* @see nsIMutationObserver::CharacterDataChanged
|
|
*/
|
|
static void CharacterDataChanged(nsIContent* aContent,
|
|
CharacterDataChangeInfo* aInfo);
|
|
|
|
/**
|
|
* Send AttributeWillChange notifications to nsIMutationObservers.
|
|
* @param aElement Element whose data will change
|
|
* @param aNameSpaceID Namespace of changing attribute
|
|
* @param aAttribute Local-name of changing attribute
|
|
* @param aModType Type of change (add/change/removal)
|
|
* @see nsIMutationObserver::AttributeWillChange
|
|
*/
|
|
static void AttributeWillChange(mozilla::dom::Element* aElement,
|
|
int32_t aNameSpaceID,
|
|
nsIAtom* aAttribute,
|
|
int32_t aModType);
|
|
|
|
/**
|
|
* Send AttributeChanged notifications to nsIMutationObservers.
|
|
* @param aElement Element whose data changed
|
|
* @param aNameSpaceID Namespace of changed attribute
|
|
* @param aAttribute Local-name of changed attribute
|
|
* @param aModType Type of change (add/change/removal)
|
|
* @see nsIMutationObserver::AttributeChanged
|
|
*/
|
|
static void AttributeChanged(mozilla::dom::Element* aElement,
|
|
int32_t aNameSpaceID,
|
|
nsIAtom* aAttribute,
|
|
int32_t aModType);
|
|
/**
|
|
* Send AttributeSetToCurrentValue notifications to nsIMutationObservers.
|
|
* @param aElement Element whose data changed
|
|
* @param aNameSpaceID Namespace of the attribute
|
|
* @param aAttribute Local-name of the attribute
|
|
* @see nsIMutationObserver::AttributeSetToCurrentValue
|
|
*/
|
|
static void AttributeSetToCurrentValue(mozilla::dom::Element* aElement,
|
|
int32_t aNameSpaceID,
|
|
nsIAtom* aAttribute);
|
|
|
|
/**
|
|
* Send ContentAppended notifications to nsIMutationObservers
|
|
* @param aContainer Node into which new child/children were added
|
|
* @param aFirstNewContent First new child
|
|
* @param aNewIndexInContainer Index of first new child
|
|
* @see nsIMutationObserver::ContentAppended
|
|
*/
|
|
static void ContentAppended(nsIContent* aContainer,
|
|
nsIContent* aFirstNewContent,
|
|
int32_t aNewIndexInContainer);
|
|
|
|
/**
|
|
* Send ContentInserted notifications to nsIMutationObservers
|
|
* @param aContainer Node into which new child was inserted
|
|
* @param aChild Newly inserted child
|
|
* @param aIndexInContainer Index of new child
|
|
* @see nsIMutationObserver::ContentInserted
|
|
*/
|
|
static void ContentInserted(nsINode* aContainer,
|
|
nsIContent* aChild,
|
|
int32_t aIndexInContainer);
|
|
/**
|
|
* Send ContentRemoved notifications to nsIMutationObservers
|
|
* @param aContainer Node from which child was removed
|
|
* @param aChild Removed child
|
|
* @param aIndexInContainer Index of removed child
|
|
* @see nsIMutationObserver::ContentRemoved
|
|
*/
|
|
static void ContentRemoved(nsINode* aContainer,
|
|
nsIContent* aChild,
|
|
int32_t aIndexInContainer,
|
|
nsIContent* aPreviousSibling);
|
|
/**
|
|
* Send ParentChainChanged notifications to nsIMutationObservers
|
|
* @param aContent The piece of content that had its parent changed.
|
|
* @see nsIMutationObserver::ParentChainChanged
|
|
*/
|
|
static inline void ParentChainChanged(nsIContent *aContent)
|
|
{
|
|
nsINode::nsSlots* slots = aContent->GetExistingSlots();
|
|
if (slots && !slots->mMutationObservers.IsEmpty()) {
|
|
NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(slots->mMutationObservers,
|
|
nsIMutationObserver,
|
|
ParentChainChanged,
|
|
(aContent));
|
|
}
|
|
}
|
|
|
|
static void AnimationAdded(mozilla::dom::Animation* aAnimation);
|
|
static void AnimationChanged(mozilla::dom::Animation* aAnimation);
|
|
static void AnimationRemoved(mozilla::dom::Animation* aAnimation);
|
|
|
|
/**
|
|
* To be called when reference count of aNode drops to zero.
|
|
* @param aNode The node which is going to be deleted.
|
|
*/
|
|
static void LastRelease(nsINode* aNode);
|
|
|
|
/**
|
|
* Clones aNode, its attributes and, if aDeep is true, its descendant nodes
|
|
* If aNewNodeInfoManager is not null, it is used to create new nodeinfos for
|
|
* the clones. aNodesWithProperties will be filled with all the nodes that
|
|
* have properties, and every node in it will be followed by its clone.
|
|
*
|
|
* @param aNode Node to clone.
|
|
* @param aDeep If true the function will be called recursively on
|
|
* descendants of the node
|
|
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
|
|
* nodeinfos for aNode and its attributes and
|
|
* descendants. May be null if the nodeinfos
|
|
* shouldn't be changed.
|
|
* @param aNodesWithProperties All nodes (from amongst aNode and its
|
|
* descendants) with properties. Every node will
|
|
* be followed by its clone.
|
|
* @param aResult *aResult will contain the cloned node.
|
|
*/
|
|
static nsresult Clone(nsINode *aNode, bool aDeep,
|
|
nsNodeInfoManager *aNewNodeInfoManager,
|
|
nsCOMArray<nsINode> &aNodesWithProperties,
|
|
nsINode **aResult)
|
|
{
|
|
return CloneAndAdopt(aNode, true, aDeep, aNewNodeInfoManager,
|
|
nullptr, aNodesWithProperties, nullptr, aResult);
|
|
}
|
|
|
|
/**
|
|
* Clones aNode, its attributes and, if aDeep is true, its descendant nodes
|
|
*/
|
|
static nsresult Clone(nsINode *aNode, bool aDeep, nsINode **aResult)
|
|
{
|
|
nsCOMArray<nsINode> dummyNodeWithProperties;
|
|
return CloneAndAdopt(aNode, true, aDeep, nullptr, nullptr,
|
|
dummyNodeWithProperties, aNode->GetParent(), aResult);
|
|
}
|
|
|
|
/**
|
|
* Walks aNode, its attributes and descendant nodes. If aNewNodeInfoManager is
|
|
* not null, it is used to create new nodeinfos for the nodes. Also reparents
|
|
* the XPConnect wrappers for the nodes into aReparentScope if non-null.
|
|
* aNodesWithProperties will be filled with all the nodes that have
|
|
* properties.
|
|
*
|
|
* @param aNode Node to adopt.
|
|
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
|
|
* nodeinfos for aNode and its attributes and
|
|
* descendants. May be null if the nodeinfos
|
|
* shouldn't be changed.
|
|
* @param aReparentScope New scope for the wrappers, or null if no reparenting
|
|
* should be done.
|
|
* @param aNodesWithProperties All nodes (from amongst aNode and its
|
|
* descendants) with properties.
|
|
*/
|
|
static nsresult Adopt(nsINode *aNode, nsNodeInfoManager *aNewNodeInfoManager,
|
|
JS::Handle<JSObject*> aReparentScope,
|
|
nsCOMArray<nsINode> &aNodesWithProperties)
|
|
{
|
|
nsCOMPtr<nsINode> node;
|
|
nsresult rv = CloneAndAdopt(aNode, false, true, aNewNodeInfoManager,
|
|
aReparentScope, aNodesWithProperties,
|
|
nullptr, getter_AddRefs(node));
|
|
|
|
nsMutationGuard::DidMutate();
|
|
|
|
return rv;
|
|
}
|
|
|
|
/**
|
|
* Helper for the cycle collector to traverse the DOM UserData for aNode.
|
|
*
|
|
* @param aNode the node to traverse UserData for
|
|
* @param aCb the cycle collection callback
|
|
*/
|
|
static void TraverseUserData(nsINode* aNode,
|
|
nsCycleCollectionTraversalCallback &aCb);
|
|
|
|
/**
|
|
* A basic implementation of the DOM cloneNode method. Calls nsINode::Clone to
|
|
* do the actual cloning of the node.
|
|
*
|
|
* @param aNode the node to clone
|
|
* @param aDeep if true all descendants will be cloned too
|
|
* @param aResult the clone
|
|
*/
|
|
static nsresult CloneNodeImpl(nsINode *aNode, bool aDeep, nsINode **aResult);
|
|
|
|
/**
|
|
* Release the UserData for aNode.
|
|
*
|
|
* @param aNode the node to release the UserData for
|
|
*/
|
|
static void UnlinkUserData(nsINode *aNode);
|
|
|
|
/**
|
|
* Returns a true if the node is a HTMLTemplate element.
|
|
*
|
|
* @param aNode a node to test for HTMLTemplate elementness.
|
|
*/
|
|
static bool IsTemplateElement(const nsINode *aNode);
|
|
|
|
/**
|
|
* Returns the first child of a node or the first child of
|
|
* a template element's content if the provided node is a
|
|
* template element.
|
|
*
|
|
* @param aNode A node from which to retrieve the first child.
|
|
*/
|
|
static nsIContent* GetFirstChildOfTemplateOrNode(nsINode* aNode);
|
|
|
|
private:
|
|
/**
|
|
* Walks aNode, its attributes and, if aDeep is true, its descendant nodes.
|
|
* If aClone is true the nodes will be cloned. If aNewNodeInfoManager is
|
|
* not null, it is used to create new nodeinfos for the nodes. Also reparents
|
|
* the XPConnect wrappers for the nodes into aReparentScope if non-null.
|
|
* aNodesWithProperties will be filled with all the nodes that have
|
|
* properties.
|
|
*
|
|
* @param aNode Node to adopt/clone.
|
|
* @param aClone If true the node will be cloned and the cloned node will
|
|
* be in aResult.
|
|
* @param aDeep If true the function will be called recursively on
|
|
* descendants of the node
|
|
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
|
|
* nodeinfos for aNode and its attributes and
|
|
* descendants. May be null if the nodeinfos
|
|
* shouldn't be changed.
|
|
* @param aReparentScope Scope into which wrappers should be reparented, or
|
|
* null if no reparenting should be done.
|
|
* @param aNodesWithProperties All nodes (from amongst aNode and its
|
|
* descendants) with properties. If aClone is
|
|
* true every node will be followed by its
|
|
* clone.
|
|
* @param aParent If aClone is true the cloned node will be appended to
|
|
* aParent's children. May be null. If not null then aNode
|
|
* must be an nsIContent.
|
|
* @param aResult If aClone is true then *aResult will contain the cloned
|
|
* node.
|
|
*/
|
|
static nsresult CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|
nsNodeInfoManager *aNewNodeInfoManager,
|
|
JS::Handle<JSObject*> aReparentScope,
|
|
nsCOMArray<nsINode> &aNodesWithProperties,
|
|
nsINode *aParent, nsINode **aResult);
|
|
};
|
|
|
|
#endif // nsNodeUtils_h___
|