--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -174,17 +174,17 @@ public:
nsIContent* GetContent() const { return mContent; }
mozilla::dom::Element* Elm() const
{ return mContent && mContent->IsElement() ? mContent->AsElement() : nullptr; }
/**
* Return node type information of DOM node associated with the accessible.
*/
bool IsContent() const
- { return GetNode() && GetNode()->IsNodeOfType(nsINode::eCONTENT); }
+ { return GetNode() && GetNode()->IsContent(); }
/**
* Return the unique identifier of the accessible.
*/
void* UniqueID() { return static_cast<void*>(this); }
/**
* Return language associated with the accessible.
--- a/accessible/windows/sdn/sdnAccessible.cpp
+++ b/accessible/windows/sdn/sdnAccessible.cpp
@@ -101,18 +101,19 @@ sdnAccessible::get_nodeInfo(BSTR __RPC_F
DOMNode->GetNodeName(nodeName);
*aNodeName = ::SysAllocString(nodeName.get());
}
nsAutoString nodeValue;
DOMNode->GetNodeValue(nodeValue);
*aNodeValue = ::SysAllocString(nodeValue.get());
- *aNameSpaceID = mNode->IsNodeOfType(nsINode::eCONTENT) ?
- static_cast<short>(mNode->AsContent()->GetNameSpaceID()) : 0;
+ *aNameSpaceID = mNode->IsContent()
+ ? static_cast<short>(mNode->AsContent()->GetNameSpaceID())
+ : 0;
// This is a unique ID for every content node. The 3rd party accessibility
// application can compare this to the childID we return for events such as
// focus events, to correlate back to data nodes in their internal object
// model.
AccessibleWrap* accessible = GetAccessible();
if (accessible) {
*aUniqueID = AccessibleWrap::GetChildIDFor(accessible);
--- a/dom/base/Comment.cpp
+++ b/dom/base/Comment.cpp
@@ -24,17 +24,17 @@ Comment::~Comment()
}
NS_IMPL_ISUPPORTS_INHERITED(Comment, nsGenericDOMDataNode, nsIDOMNode,
nsIDOMCharacterData, nsIDOMComment)
bool
Comment::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eCOMMENT | eDATA_NODE));
+ return !(aFlags & ~(eCOMMENT | eDATA_NODE));
}
nsGenericDOMDataNode*
Comment::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const
{
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
Comment *it = new Comment(ni.forget());
if (it && aCloneText) {
--- a/dom/base/DocumentFragment.cpp
+++ b/dom/base/DocumentFragment.cpp
@@ -28,17 +28,17 @@ JSObject*
DocumentFragment::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{
return DocumentFragmentBinding::Wrap(aCx, this, aGivenProto);
}
bool
DocumentFragment::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eDOCUMENT_FRAGMENT));
+ return !(aFlags & ~eDOCUMENT_FRAGMENT);
}
#ifdef DEBUG
void
DocumentFragment::List(FILE* out, int32_t aIndent) const
{
int32_t indent;
for (indent = aIndent; --indent >= 0; ) {
--- a/dom/base/DocumentType.cpp
+++ b/dom/base/DocumentType.cpp
@@ -88,17 +88,17 @@ NS_IMPL_ISUPPORTS_INHERITED(DocumentType
bool
DocumentType::IsNodeOfType(uint32_t aFlags) const
{
// Don't claim to be eDATA_NODE since we're just inheriting
// nsGenericDOMDataNode for convinience. Doctypes aren't really
// data nodes (they have a null .nodeValue and don't implement
// nsIDOMCharacterData)
- return !(aFlags & ~eCONTENT);
+ return false;
}
const nsTextFragment*
DocumentType::GetText()
{
return nullptr;
}
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -2203,17 +2203,17 @@ Element::ShouldBlur(nsIContent *aContent
// if focus on this element would get redirected, then check the redirected
// content as well when blurring.
return (contentToBlur && nsFocusManager::GetRedirectedFocus(aContent) == contentToBlur);
}
bool
Element::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~eCONTENT);
+ return false;
}
/* static */
nsresult
Element::DispatchEvent(nsPresContext* aPresContext,
WidgetEvent* aEvent,
nsIContent* aTarget,
bool aFullDispatch,
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5493,17 +5493,17 @@ bool
nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode,
const nsIContent* aContent)
{
NS_PRECONDITION(aNode,
"Must have a node to work with");
NS_PRECONDITION(aContent,
"Must have a content to work with");
- if (!aNode->IsNodeOfType(nsINode::eCONTENT)) {
+ if (!aNode->IsContent()) {
/**
* The root isn't an nsIContent, so it's a document or attribute. The only
* nodes in the same anonymous subtree as it will have a null
* bindingParent.
*
* XXXbz strictly speaking, that's not true for attribute nodes.
*/
return aContent->GetBindingParent() == nullptr;
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -484,19 +484,18 @@ nsDocumentEncoder::SerializeToStringRecu
maybeFixedNode = fixedNodeKungfuDeathGrip;
}
if (!maybeFixedNode)
maybeFixedNode = aNode;
if ((mFlags & SkipInvisibleContent) &&
!(mFlags & OutputNonTextContentAsPlaceholder)) {
- if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
- nsIFrame* frame = static_cast<nsIContent*>(aNode)->GetPrimaryFrame();
- if (frame) {
+ if (aNode->IsContent()) {
+ if (nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame()) {
if (!frame->IsSelectable(nullptr)) {
aDontSerializeRoot = true;
}
}
}
}
if (!aDontSerializeRoot) {
--- a/dom/base/nsGenericDOMDataNode.cpp
+++ b/dom/base/nsGenericDOMDataNode.cpp
@@ -792,17 +792,17 @@ nsGenericDOMDataNode::SetXBLInsertionPoi
slots->mXBLInsertionPoint = nullptr;
}
}
}
bool
nsGenericDOMDataNode::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eDATA_NODE));
+ return !(aFlags & ~eDATA_NODE);
}
void
nsGenericDOMDataNode::SaveSubtreeState()
{
}
#ifdef DEBUG
--- a/dom/base/nsIMutationObserver.h
+++ b/dom/base/nsIMutationObserver.h
@@ -293,18 +293,18 @@ public:
virtual void ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) = 0;
/**
* The node is in the process of being destroyed. Calling QI on the node is
* not supported, however it is possible to get children and flags through
- * nsINode as well as calling IsNodeOfType(eCONTENT) and casting to
- * nsIContent to get attributes.
+ * nsINode as well as calling IsContent and casting to nsIContent to get
+ * attributes.
*
* NOTE: This notification is only called on observers registered directly
* on the node. This is because when the node is destroyed it can not have
* any ancestors. If you want to know when a descendant node is being
* removed from the observed node, use the ContentRemoved notification.
*
* @param aNode The node being destroyed.
*
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -336,17 +336,17 @@ static nsIContent* GetRootForContentSubt
nsIContent*
nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
{
NS_ENSURE_TRUE(aPresShell, nullptr);
if (IsNodeOfType(eDOCUMENT))
return static_cast<nsIDocument*>(this)->GetRootElement();
- if (!IsNodeOfType(eCONTENT))
+ if (!IsContent())
return nullptr;
if (GetComposedDoc() != aPresShell->GetDocument()) {
return nullptr;
}
if (static_cast<nsIContent*>(this)->HasIndependentSelection()) {
// This node should be a descendant of input/textarea editor.
@@ -430,17 +430,17 @@ nsINode::GetComposedDocInternal() const
ShadowRoot* containingShadow = AsContent()->GetContainingShadow();
return containingShadow->IsComposedDocParticipant() ? OwnerDoc() : nullptr;
}
#ifdef DEBUG
void
nsINode::CheckNotNativeAnonymous() const
{
- if (!IsNodeOfType(eCONTENT))
+ if (!IsContent())
return;
nsIContent* content = static_cast<const nsIContent *>(this)->GetBindingParent();
while (content) {
if (content->IsRootOfNativeAnonymousSubtree()) {
NS_ERROR("Element not marked to be in native anonymous subtree!");
break;
}
content = content->GetBindingParent();
@@ -2095,17 +2095,17 @@ nsINode::EnsurePreInsertionValidity(nsIN
void
nsINode::EnsurePreInsertionValidity1(nsINode& aNewChild, nsINode* aRefChild,
ErrorResult& aError)
{
if ((!IsNodeOfType(eDOCUMENT) &&
!IsNodeOfType(eDOCUMENT_FRAGMENT) &&
!IsElement()) ||
- !aNewChild.IsNodeOfType(eCONTENT)) {
+ !aNewChild.IsContent()) {
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return;
}
}
void
nsINode::EnsurePreInsertionValidity2(bool aReplace, nsINode& aNewChild,
nsINode* aRefChild, ErrorResult& aError)
@@ -2605,18 +2605,17 @@ bool
nsINode::Contains(const nsINode* aOther) const
{
if (aOther == this) {
return true;
}
if (!aOther ||
OwnerDoc() != aOther->OwnerDoc() ||
IsInUncomposedDoc() != aOther->IsInUncomposedDoc() ||
- !(aOther->IsElement() ||
- aOther->IsNodeOfType(nsINode::eCONTENT)) ||
+ !aOther->IsContent() ||
!GetFirstChild()) {
return false;
}
const nsIContent* other = static_cast<const nsIContent*>(aOther);
if (this == OwnerDoc()) {
// document.contains(aOther) returns true if aOther is in the document,
// but is not in any anonymous subtree.
@@ -2642,18 +2641,18 @@ nsINode::Length() const
switch (NodeType()) {
case nsIDOMNode::DOCUMENT_TYPE_NODE:
return 0;
case nsIDOMNode::TEXT_NODE:
case nsIDOMNode::CDATA_SECTION_NODE:
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
case nsIDOMNode::COMMENT_NODE:
- MOZ_ASSERT(IsNodeOfType(eCONTENT));
- return static_cast<const nsIContent*>(this)->TextLength();
+ MOZ_ASSERT(IsContent());
+ return AsContent()->TextLength();
default:
return GetChildCount();
}
}
const RawServoSelectorList*
nsINode::ParseServoSelectorList(
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -369,18 +369,16 @@ public:
#endif
virtual ~nsINode();
/**
* Bit-flags to pass (or'ed together) to IsNodeOfType()
*/
enum {
- /** nsIContent nodes */
- eCONTENT = 1 << 0,
/** nsIDocument nodes */
eDOCUMENT = 1 << 1,
/** nsIAttribute nodes */
eATTRIBUTE = 1 << 2,
/** text nodes */
eTEXT = 1 << 3,
/** xml processing instructions */
ePROCESSING_INSTRUCTION = 1 << 4,
@@ -1150,17 +1148,17 @@ public:
void SetFlags(FlagsType aFlagsToSet)
{
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS_ROOT |
NODE_IS_NATIVE_ANONYMOUS_ROOT |
NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE |
NODE_DESCENDANTS_NEED_FRAMES |
NODE_NEEDS_FRAME |
NODE_CHROME_ONLY_ACCESS)) ||
- IsNodeOfType(eCONTENT),
+ IsContent(),
"Flag only permitted on nsIContent nodes");
nsWrapperCache::SetFlags(aFlagsToSet);
}
void UnsetFlags(FlagsType aFlagsToUnset)
{
NS_ASSERTION(!(aFlagsToUnset &
(NODE_IS_ANONYMOUS_ROOT |
@@ -1765,17 +1763,17 @@ protected:
{ return GetBoolFlag(ElementHasWeirdParserInsertionMode); }
bool HandlingClick() const { return GetBoolFlag(NodeHandlingClick); }
void SetHandlingClick() { SetBoolFlag(NodeHandlingClick); }
void ClearHandlingClick() { ClearBoolFlag(NodeHandlingClick); }
void SetSubtreeRootPointer(nsINode* aSubtreeRoot)
{
NS_ASSERTION(aSubtreeRoot, "aSubtreeRoot can never be null!");
- NS_ASSERTION(!(IsNodeOfType(eCONTENT) && IsInUncomposedDoc()) &&
+ NS_ASSERTION(!(IsContent() && IsInUncomposedDoc()) &&
!IsInShadowTree(), "Shouldn't be here!");
mSubtreeRoot = aSubtreeRoot;
}
void ClearSubtreeRootPointer()
{
mSubtreeRoot = nullptr;
}
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -176,51 +176,49 @@ nsNodeUtils::NativeAnonymousChildListCha
IMPL_MUTATION_NOTIFICATION(NativeAnonymousChildListChange, aContent,
(doc, aContent, aIsRemove));
}
void
nsNodeUtils::ContentInserted(nsINode* aContainer,
nsIContent* aChild)
{
- NS_PRECONDITION(aContainer->IsNodeOfType(nsINode::eCONTENT) ||
+ NS_PRECONDITION(aContainer->IsContent() ||
aContainer->IsNodeOfType(nsINode::eDOCUMENT),
"container must be an nsIContent or an nsIDocument");
nsIContent* container;
nsIDocument* doc = aContainer->OwnerDoc();
nsIDocument* document;
- if (aContainer->IsNodeOfType(nsINode::eCONTENT)) {
- container = static_cast<nsIContent*>(aContainer);
+ if (aContainer->IsContent()) {
+ container = aContainer->AsContent();
document = doc;
- }
- else {
+ } else {
container = nullptr;
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer,
(document, container, aChild));
}
void
nsNodeUtils::ContentRemoved(nsINode* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{
- NS_PRECONDITION(aContainer->IsNodeOfType(nsINode::eCONTENT) ||
+ NS_PRECONDITION(aContainer->IsContent() ||
aContainer->IsNodeOfType(nsINode::eDOCUMENT),
"container must be an nsIContent or an nsIDocument");
nsIContent* container;
nsIDocument* doc = aContainer->OwnerDoc();
nsIDocument* document;
- if (aContainer->IsNodeOfType(nsINode::eCONTENT)) {
+ if (aContainer->IsContent()) {
container = static_cast<nsIContent*>(aContainer);
document = doc;
- }
- else {
+ } else {
container = nullptr;
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
(document, container, aChild, aPreviousSibling));
}
@@ -406,17 +404,17 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
nsNodeInfoManager *aNewNodeInfoManager,
JS::Handle<JSObject*> aReparentScope,
nsCOMArray<nsINode> *aNodesWithProperties,
nsINode* aParent, ErrorResult& aError)
{
NS_PRECONDITION((!aClone && aNewNodeInfoManager) || !aReparentScope,
"If cloning or not getting a new nodeinfo we shouldn't "
"rewrap");
- NS_PRECONDITION(!aParent || aNode->IsNodeOfType(nsINode::eCONTENT),
+ NS_PRECONDITION(!aParent || aNode->IsContent(),
"Can't insert document or attribute nodes into a parent");
// First deal with aNode and walk its attributes (and their children). Then,
// if aDeep is true, deal with aNode's children (and recurse into their
// attributes and children).
nsAutoScriptBlocker scriptBlocker;
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -985,28 +985,28 @@ nsRange::DoSetRange(const RawRangeBounda
"Set all or none");
NS_PRECONDITION(!aRoot || aNotInsertedYet ||
(nsContentUtils::ContentIsDescendantOf(aStart.Container(), aRoot) &&
nsContentUtils::ContentIsDescendantOf(aEnd.Container(), aRoot) &&
aRoot == IsValidBoundary(aStart.Container()) &&
aRoot == IsValidBoundary(aEnd.Container())),
"Wrong root");
NS_PRECONDITION(!aRoot ||
- (aStart.Container()->IsNodeOfType(nsINode::eCONTENT) &&
- aEnd.Container()->IsNodeOfType(nsINode::eCONTENT) &&
+ (aStart.Container()->IsContent() &&
+ aEnd.Container()->IsContent() &&
aRoot ==
static_cast<nsIContent*>(aStart.Container())->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(aEnd.Container())->GetBindingParent()) ||
(!aRoot->GetParentNode() &&
(aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
aRoot->IsNodeOfType(nsINode::eATTRIBUTE) ||
aRoot->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT) ||
/*For backward compatibility*/
- aRoot->IsNodeOfType(nsINode::eCONTENT))),
+ aRoot->IsContent())),
"Bad root");
if (mRoot != aRoot) {
if (mRoot) {
mRoot->RemoveMutationObserver(this);
}
if (aRoot) {
aRoot->AddMutationObserver(this);
}
@@ -1252,23 +1252,22 @@ nsRange::IsValidOffset(nsINode* aNode, u
/* static */
nsINode*
nsRange::ComputeRootNode(nsINode* aNode, bool aMaySpanAnonymousSubtrees)
{
if (!aNode) {
return nullptr;
}
- if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
+ if (aNode->IsContent()) {
if (aNode->NodeInfo()->NameAtom() == nsGkAtoms::documentTypeNodeName) {
return nullptr;
}
- nsIContent* content = static_cast<nsIContent*>(aNode);
-
+ nsIContent* content = aNode->AsContent();
if (!aMaySpanAnonymousSubtrees) {
// If the node is in a shadow tree then the ShadowRoot is the root.
ShadowRoot* containingShadow = content->GetContainingShadow();
if (containingShadow) {
return containingShadow;
}
// If the node has a binding parent, that should be the root.
--- a/dom/base/nsTextNode.cpp
+++ b/dom/base/nsTextNode.cpp
@@ -106,17 +106,17 @@ JSObject*
nsTextNode::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{
return TextBinding::Wrap(aCx, this, aGivenProto);
}
bool
nsTextNode::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eTEXT | eDATA_NODE));
+ return !(aFlags & ~(eTEXT | eDATA_NODE));
}
nsGenericDOMDataNode*
nsTextNode::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const
{
already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
nsTextNode *it = new nsTextNode(ni);
if (aCloneText) {
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1416,20 +1416,18 @@ ContentEventHandler::HandleQueryContentE
// Similar to nsFrameSelection::GetFrameForNodeOffset,
// but this is more flexible for OnQueryTextRect to use
static nsresult GetFrameForTextRect(nsINode* aNode,
int32_t aNodeOffset,
bool aHint,
nsIFrame** aReturnFrame)
{
- NS_ENSURE_TRUE(aNode && aNode->IsNodeOfType(nsINode::eCONTENT),
- NS_ERROR_UNEXPECTED);
- nsIContent* content = static_cast<nsIContent*>(aNode);
- nsIFrame* frame = content->GetPrimaryFrame();
+ NS_ENSURE_TRUE(aNode && aNode->IsContent(), NS_ERROR_UNEXPECTED);
+ nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
int32_t childNodeOffset = 0;
return frame->GetChildFrameContainingOffset(aNodeOffset, aHint,
&childNodeOffset, aReturnFrame);
}
nsresult
ContentEventHandler::OnQuerySelectedText(WidgetQueryContentEvent* aEvent)
@@ -2486,17 +2484,17 @@ ContentEventHandler::OnQueryTextRect(Wid
frame = frame->GetNextContinuation();
if (!frame) {
do {
iter->Next();
nsINode* node = iter->GetCurrentNode();
if (!node) {
break;
}
- if (!node->IsNodeOfType(nsINode::eCONTENT)) {
+ if (!node->IsContent()) {
continue;
}
nsIFrame* primaryFrame = node->AsContent()->GetPrimaryFrame();
// The node may be hidden by CSS.
if (!primaryFrame) {
continue;
}
// We should take only text frame's rect and br frame's rect. We can
@@ -3082,23 +3080,21 @@ nsresult
ContentEventHandler::GetStartFrameAndOffset(const RawRange& aRawRange,
nsIFrame*& aFrame,
int32_t& aOffsetInFrame)
{
aFrame = nullptr;
aOffsetInFrame = -1;
nsINode* node = aRawRange.GetStartContainer();
- if (NS_WARN_IF(!node) ||
- NS_WARN_IF(!node->IsNodeOfType(nsINode::eCONTENT))) {
+ if (NS_WARN_IF(!node) || NS_WARN_IF(!node->IsContent())) {
return NS_ERROR_FAILURE;
}
- nsIContent* content = static_cast<nsIContent*>(node);
RefPtr<nsFrameSelection> fs = mPresShell->FrameSelection();
- aFrame = fs->GetFrameForNodeOffset(content, aRawRange.StartOffset(),
+ aFrame = fs->GetFrameForNodeOffset(node->AsContent(), aRawRange.StartOffset(),
fs->GetHint(), &aOffsetInFrame);
if (NS_WARN_IF(!aFrame)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult
@@ -3138,17 +3134,17 @@ static void AdjustRangeForSelection(nsIC
!node->IsNodeOfType(nsINode::eTEXT)) {
return;
}
// When the offset is at the end of the text node, set it to after the
// text node, to make sure the caret is drawn on a new line when the last
// character of the text node is '\n' in <textarea>.
int32_t textLength =
- static_cast<int32_t>(static_cast<nsIContent*>(node)->TextLength());
+ static_cast<int32_t>(node->AsContent()->TextLength());
MOZ_ASSERT(nodeOffset <= textLength, "Offset is past length of text node");
if (nodeOffset != textLength) {
return;
}
nsIContent* aRootParent = aRoot->GetParent();
if (NS_WARN_IF(!aRootParent)) {
return;
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -325,19 +325,18 @@ IMEContentObserver::InitWithEditor(nsPre
if (NS_WARN_IF(!mEditorBase)) {
return false;
}
nsIPresShell* presShell = aPresContext->PresShell();
// get selection and root content
nsCOMPtr<nsISelectionController> selCon;
- if (mEditableNode->IsNodeOfType(nsINode::eCONTENT)) {
- nsIFrame* frame =
- static_cast<nsIContent*>(mEditableNode.get())->GetPrimaryFrame();
+ if (mEditableNode->IsContent()) {
+ nsIFrame* frame = mEditableNode->AsContent()->GetPrimaryFrame();
if (NS_WARN_IF(!frame)) {
return false;
}
frame->GetSelectionController(aPresContext,
getter_AddRefs(selCon));
} else {
// mEditableNode is a document
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6570,17 +6570,17 @@ void HTMLMediaElement::NotifyShutdownEve
mShuttingDown = true;
ResetState();
AddRemoveSelfReference();
}
bool
HTMLMediaElement::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eMEDIA));
+ return !(aFlags & ~eMEDIA);
}
void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement)
{
LOG_EVENT(LogLevel::Debug, ("%p Queuing simple source error event", this));
nsCOMPtr<nsIRunnable> event = new nsSourceErrorEventRunner(this, aSourceElement);
mMainThreadEventTarget->Dispatch(event.forget());
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1764,17 +1764,17 @@ nsINode*
nsGenericHTMLFormElement::GetScopeChainParent() const
{
return mForm ? mForm : nsGenericHTMLElement::GetScopeChainParent();
}
bool
nsGenericHTMLFormElement::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eHTML_FORM_CONTROL));
+ return !(aFlags & ~eHTML_FORM_CONTROL);
}
void
nsGenericHTMLFormElement::SaveSubtreeState()
{
SaveState();
nsGenericHTMLElement::SaveSubtreeState();
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -939,17 +939,17 @@ nsMathMLElement::IntrinsicState() const
return Link::LinkState() | nsMathMLElementBase::IntrinsicState() |
(mIncrementScriptLevel ?
NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : EventStates());
}
bool
nsMathMLElement::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~eCONTENT);
+ return false;
}
void
nsMathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel,
bool aNotify)
{
if (aIncrementScriptLevel == mIncrementScriptLevel)
return;
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -352,17 +352,17 @@ SVGAnimationElement::UnsetAttr(int32_t a
}
return NS_OK;
}
bool
SVGAnimationElement::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eANIMATION));
+ return !(aFlags & ~eANIMATION);
}
//----------------------------------------------------------------------
// SVGTests methods
bool
SVGAnimationElement::IsInChromeDoc() const
{
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -916,17 +916,17 @@ nsSVGElement::GetAttributeChangeHint(con
retval |= nsChangeHint_ReconstructFrame;
}
return retval;
}
bool
nsSVGElement::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~eCONTENT);
+ return false;
}
void
nsSVGElement::NodeInfoChanged(nsIDocument* aOldDoc)
{
nsSVGElementBase::NodeInfoChanged(aOldDoc);
aOldDoc->UnscheduleSVGForPresAttrEvaluation(this);
mContentDeclarationBlock = nullptr;
--- a/dom/svg/nsSVGFilters.h
+++ b/dom/svg/nsSVGFilters.h
@@ -83,17 +83,17 @@ public:
// nsSVGElement interface
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override = 0;
virtual bool HasValidDimensions() const override;
bool IsNodeOfType(uint32_t aFlags) const override
- { return !(aFlags & ~(eCONTENT | eFILTER)); }
+ { return !(aFlags & ~eFILTER); }
virtual nsSVGString& GetResultImageName() = 0;
// Return a list of all image names used as sources. Default is to
// return no sources.
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
--- a/dom/xml/CDATASection.cpp
+++ b/dom/xml/CDATASection.cpp
@@ -23,17 +23,17 @@ JSObject*
CDATASection::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{
return CDATASectionBinding::Wrap(aCx, this, aGivenProto);
}
bool
CDATASection::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | eTEXT | eDATA_NODE));
+ return !(aFlags & ~(eTEXT | eDATA_NODE));
}
nsGenericDOMDataNode*
CDATASection::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const
{
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
CDATASection *it = new CDATASection(ni.forget());
if (it && aCloneText) {
--- a/dom/xml/ProcessingInstruction.cpp
+++ b/dom/xml/ProcessingInstruction.cpp
@@ -87,17 +87,17 @@ ProcessingInstruction::GetAttrValue(nsAt
GetData(data);
return nsContentUtils::GetPseudoAttributeValue(data, aName, aValue);
}
bool
ProcessingInstruction::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~(eCONTENT | ePROCESSING_INSTRUCTION | eDATA_NODE));
+ return !(aFlags & ~(ePROCESSING_INSTRUCTION | eDATA_NODE));
}
nsGenericDOMDataNode*
ProcessingInstruction::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
bool aCloneText) const
{
nsAutoString data;
nsGenericDOMDataNode::GetData(data);
--- a/dom/xslt/xpath/XPathResult.cpp
+++ b/dom/xslt/xpath/XPathResult.cpp
@@ -113,18 +113,17 @@ XPathResult::IterateNext(ErrorResult& aR
}
void
XPathResult::NodeWillBeDestroyed(const nsINode* aNode)
{
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
// Set to null to avoid unregistring unnecessarily
mDocument = nullptr;
- Invalidate(aNode->IsNodeOfType(nsINode::eCONTENT) ?
- static_cast<const nsIContent*>(aNode) : nullptr);
+ Invalidate(aNode->IsContent() ? aNode->AsContent() : nullptr);
}
void
XPathResult::CharacterDataChanged(nsIDocument* aDocument,
nsIContent *aContent,
CharacterDataChangeInfo* aInfo)
{
Invalidate(aContent);
@@ -252,20 +251,19 @@ XPathResult::Invalidate(const nsIContent
{
nsCOMPtr<nsINode> contextNode = do_QueryReferent(mContextNode);
if (contextNode && aChangeRoot && aChangeRoot->GetBindingParent()) {
// If context node is in anonymous content, changes to
// non-anonymous content need to invalidate the XPathResult. If
// the changes are happening in a different anonymous trees, no
// invalidation should happen.
nsIContent* ctxBindingParent = nullptr;
- if (contextNode->IsNodeOfType(nsINode::eCONTENT)) {
+ if (contextNode->IsContent()) {
ctxBindingParent =
- static_cast<nsIContent*>(contextNode.get())
- ->GetBindingParent();
+ contextNode->AsContent()->GetBindingParent();
} else if (contextNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
Element* parent =
static_cast<Attr*>(contextNode.get())->GetElement();
if (parent) {
ctxBindingParent = parent->GetBindingParent();
}
}
if (ctxBindingParent != aChangeRoot->GetBindingParent()) {
--- a/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
+++ b/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
@@ -47,17 +47,17 @@ txXPathTreeWalker::moveToRoot()
nsIDocument* root = mPosition.mNode->GetUncomposedDoc();
if (root) {
mPosition.mIndex = txXPathNode::eDocument;
mPosition.mNode = root;
}
else {
nsINode *rootNode = mPosition.Root();
- NS_ASSERTION(rootNode->IsNodeOfType(nsINode::eCONTENT),
+ NS_ASSERTION(rootNode->IsContent(),
"root of subtree wasn't an nsIContent");
mPosition.mIndex = txXPathNode::eContent;
mPosition.mNode = rootNode;
}
}
bool
@@ -72,17 +72,17 @@ txXPathTreeWalker::moveToElementById(con
nsCOMPtr<nsIContent> content;
if (doc) {
content = doc->GetElementById(aID);
}
else {
// We're in a disconnected subtree, search only that subtree.
nsINode *rootNode = mPosition.Root();
- NS_ASSERTION(rootNode->IsNodeOfType(nsINode::eCONTENT),
+ NS_ASSERTION(rootNode->IsContent(),
"root of subtree wasn't an nsIContent");
content = nsContentUtils::MatchElementId(
static_cast<nsIContent*>(rootNode), aID);
}
if (!content) {
return false;
--- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
@@ -667,18 +667,18 @@ void txSyncCompileObserver::onDoneCompil
nsresult
TX_CompileStylesheet(nsINode* aNode, txMozillaXSLTProcessor* aProcessor,
txStylesheet** aStylesheet)
{
// If we move GetBaseURI to nsINode this can be simplified.
nsCOMPtr<nsIDocument> doc = aNode->OwnerDoc();
nsCOMPtr<nsIURI> uri;
- if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
- uri = static_cast<nsIContent*>(aNode)->GetBaseURI();
+ if (aNode->IsContent()) {
+ uri = aNode->AsContent()->GetBaseURI();
}
else {
NS_ASSERTION(aNode->IsNodeOfType(nsINode::eDOCUMENT), "not a doc");
uri = static_cast<nsIDocument*>(aNode)->GetBaseURI();
}
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
nsAutoCString spec;
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -1677,17 +1677,17 @@ nsIContent *
nsXULElement::GetBindingParent() const
{
return mBindingParent;
}
bool
nsXULElement::IsNodeOfType(uint32_t aFlags) const
{
- return !(aFlags & ~eCONTENT);
+ return false;
}
nsresult
nsXULElement::AddPopupListener(nsAtom* aName)
{
// Add a popup listener to the element
bool isContext = (aName == nsGkAtoms::context ||
aName == nsGkAtoms::contextmenu);
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -798,17 +798,17 @@ public:
/**
* returns true if aNode is an editable node.
*/
bool IsEditable(nsIDOMNode* aNode);
bool IsEditable(nsINode* aNode)
{
NS_ENSURE_TRUE(aNode, false);
- if (!aNode->IsNodeOfType(nsINode::eCONTENT) || IsMozEditorBogusNode(aNode) ||
+ if (!aNode->IsContent() || IsMozEditorBogusNode(aNode) ||
!IsModifiableNode(aNode)) {
return false;
}
switch (aNode->NodeType()) {
case nsIDOMNode::ELEMENT_NODE:
// In HTML editors, if we're dealing with an element, then ask it
// whether it's editable.
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -1099,17 +1099,17 @@ EditorEventListener::Focus(InternalFocus
// If the target is a document node but it's not editable, we should ignore
// it because actual focused element's event is going to come.
if (node->IsNodeOfType(nsINode::eDOCUMENT) &&
!node->HasFlag(NODE_IS_EDITABLE)) {
return NS_OK;
}
- if (node->IsNodeOfType(nsINode::eCONTENT)) {
+ if (node->IsContent()) {
// XXX If the focus event target is a form control in contenteditable
// element, perhaps, the parent HTML editor should do nothing by this
// handler. However, FindSelectionRoot() returns the root element of the
// contenteditable editor. So, the editableRoot value is invalid for
// the plain text editor, and it will be set to the wrong limiter of
// the selection. However, fortunately, actual bugs are not found yet.
nsCOMPtr<nsIContent> editableRoot = editorBase->FindSelectionRoot(node);
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -368,17 +368,17 @@ HTMLEditor::UpdateRootElement()
mRootElement = do_QueryInterface(rootElement);
}
already_AddRefed<nsIContent>
HTMLEditor::FindSelectionRoot(nsINode* aNode)
{
NS_PRECONDITION(aNode->IsNodeOfType(nsINode::eDOCUMENT) ||
- aNode->IsNodeOfType(nsINode::eCONTENT),
+ aNode->IsContent(),
"aNode must be content or document node");
nsCOMPtr<nsIDocument> doc = aNode->GetUncomposedDoc();
if (!doc) {
return nullptr;
}
nsCOMPtr<nsIContent> content;
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4886,23 +4886,22 @@ PresShell::CreateRangePaintInfo(nsIDOMRa
nsINode* startContainer = range->GetStartContainer();
nsINode* endContainer = range->GetEndContainer();
nsIDocument* doc = startContainer->GetComposedDoc();
if (startContainer == doc || endContainer == doc) {
ancestorFrame = rootFrame;
} else {
nsINode* ancestor =
nsContentUtils::GetCommonAncestor(startContainer, endContainer);
- NS_ASSERTION(!ancestor || ancestor->IsNodeOfType(nsINode::eCONTENT),
+ NS_ASSERTION(!ancestor || ancestor->IsContent(),
"common ancestor is not content");
- if (!ancestor || !ancestor->IsNodeOfType(nsINode::eCONTENT))
+ if (!ancestor || !ancestor->IsContent())
return nullptr;
- nsIContent* ancestorContent = static_cast<nsIContent*>(ancestor);
- ancestorFrame = ancestorContent->GetPrimaryFrame();
+ ancestorFrame = ancestor->AsContent()->GetPrimaryFrame();
// XXX deal with ancestorFrame being null due to display:contents
// use the nearest ancestor frame that includes all continuations as the
// root for building the display list
while (ancestorFrame &&
nsLayoutUtils::GetNextContinuationOrIBSplitSibling(ancestorFrame))
ancestorFrame = ancestorFrame->GetParent();