mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1454251: Remove nsINode::eATTRIBUTE. r=bz
MozReview-Commit-ID: 7HeUbcG6szy
This commit is contained in:
parent
fea49419b0
commit
1f9cbf532c
@ -262,7 +262,7 @@ Attr::SetTextContentInternal(const nsAString& aTextContent,
|
||||
bool
|
||||
Attr::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
return !(aFlags & ~eATTRIBUTE);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
NS_IMPL_FROMNODE_HELPER(Attr, IsAttr())
|
||||
|
||||
// nsINode interface
|
||||
virtual void GetTextContentInternal(nsAString& aTextContent,
|
||||
OOMReporter& aError) override;
|
||||
|
@ -413,11 +413,9 @@ nsINode::ChildNodes()
|
||||
{
|
||||
nsSlots* slots = Slots();
|
||||
if (!slots->mChildNodes) {
|
||||
// Check |!IsElement()| first to catch the common case
|
||||
// without virtual call |IsNodeOfType|
|
||||
slots->mChildNodes = !IsElement() && IsNodeOfType(nsINode::eATTRIBUTE) ?
|
||||
new nsAttrChildContentList(this) :
|
||||
new nsParentNodeChildContentList(this);
|
||||
slots->mChildNodes = IsAttr()
|
||||
? new nsAttrChildContentList(this)
|
||||
: new nsParentNodeChildContentList(this);
|
||||
}
|
||||
|
||||
return slots->mChildNodes;
|
||||
@ -426,7 +424,7 @@ nsINode::ChildNodes()
|
||||
void
|
||||
nsINode::InvalidateChildNodes()
|
||||
{
|
||||
MOZ_ASSERT(IsElement() || !IsNodeOfType(nsINode::eATTRIBUTE));
|
||||
MOZ_ASSERT(!IsAttr());
|
||||
|
||||
nsSlots* slots = GetExistingSlots();
|
||||
if (!slots || !slots->mChildNodes) {
|
||||
@ -741,12 +739,12 @@ nsINode::CompareDocumentPosition(nsINode& aOtherNode) const
|
||||
|
||||
AutoTArray<const nsINode*, 32> parents1, parents2;
|
||||
|
||||
const nsINode *node1 = &aOtherNode, *node2 = this;
|
||||
const nsINode* node1 = &aOtherNode;
|
||||
const nsINode* node2 = this;
|
||||
|
||||
// Check if either node is an attribute
|
||||
const Attr* attr1 = nullptr;
|
||||
if (node1->IsNodeOfType(nsINode::eATTRIBUTE)) {
|
||||
attr1 = static_cast<const Attr*>(node1);
|
||||
const Attr* attr1 = Attr::FromNode(node1);
|
||||
if (attr1) {
|
||||
const Element* elem = attr1->GetElement();
|
||||
// If there is an owner element add the attribute
|
||||
// to the chain and walk up to the element
|
||||
@ -755,8 +753,7 @@ nsINode::CompareDocumentPosition(nsINode& aOtherNode) const
|
||||
parents1.AppendElement(attr1);
|
||||
}
|
||||
}
|
||||
if (node2->IsNodeOfType(nsINode::eATTRIBUTE)) {
|
||||
const Attr* attr2 = static_cast<const Attr*>(node2);
|
||||
if (auto* attr2 = Attr::FromNode(node2)) {
|
||||
const Element* elem = attr2->GetElement();
|
||||
if (elem == node1 && attr1) {
|
||||
// Both nodes are attributes on the same element.
|
||||
@ -1295,7 +1292,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
||||
bool aNotify, nsAttrAndChildArray& aChildArray)
|
||||
{
|
||||
MOZ_ASSERT(!aKid->GetParentNode(), "Inserting node that already has parent");
|
||||
MOZ_ASSERT(!IsNodeOfType(nsINode::eATTRIBUTE));
|
||||
MOZ_ASSERT(!IsAttr());
|
||||
|
||||
// The id-handling code, and in the future possibly other code, need to
|
||||
// react to unexpected attribute changes.
|
||||
@ -1649,7 +1646,7 @@ nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
|
||||
MOZ_ASSERT(aKid && aKid->GetParentNode() == this &&
|
||||
aKid == GetChildAt_Deprecated(aIndex) &&
|
||||
ComputeIndexOf(aKid) == (int32_t)aIndex, "Bogus aKid");
|
||||
MOZ_ASSERT(!IsNodeOfType(nsINode::eATTRIBUTE));
|
||||
MOZ_ASSERT(!IsAttr());
|
||||
|
||||
nsMutationGuard::DidMutate();
|
||||
mozAutoDocUpdate updateBatch(GetComposedDoc(), UPDATE_CONTENT_MODEL, aNotify);
|
||||
|
@ -412,8 +412,6 @@ public:
|
||||
* Bit-flags to pass (or'ed together) to IsNodeOfType()
|
||||
*/
|
||||
enum {
|
||||
/** nsIAttribute nodes */
|
||||
eATTRIBUTE = 1 << 2,
|
||||
/** form control elements */
|
||||
eHTML_FORM_CONTROL = 1 << 6,
|
||||
/** animation elements */
|
||||
@ -582,6 +580,14 @@ public:
|
||||
return NodeType() == COMMENT_NODE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the node is an Attr node.
|
||||
*/
|
||||
bool IsAttr() const
|
||||
{
|
||||
return NodeType() == ATTRIBUTE_NODE;
|
||||
}
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() = 0;
|
||||
|
||||
/**
|
||||
|
@ -613,7 +613,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
}
|
||||
}
|
||||
|
||||
if (aDeep && (!aClone || !aNode->IsNodeOfType(nsINode::eATTRIBUTE))) {
|
||||
if (aDeep && (!aClone || !aNode->IsAttr())) {
|
||||
// aNode's children.
|
||||
for (nsIContent* cloneChild = aNode->GetFirstChild();
|
||||
cloneChild;
|
||||
|
@ -982,7 +982,7 @@ nsRange::DoSetRange(const RawRangeBoundary& aStart,
|
||||
static_cast<nsIContent*>(aEnd.Container())->GetBindingParent()) ||
|
||||
(!aRoot->GetParentNode() &&
|
||||
(aRoot->IsDocument() ||
|
||||
aRoot->IsNodeOfType(nsINode::eATTRIBUTE) ||
|
||||
aRoot->IsAttr() ||
|
||||
aRoot->IsDocumentFragment() ||
|
||||
/*For backward compatibility*/
|
||||
aRoot->IsContent())),
|
||||
|
@ -249,10 +249,8 @@ XPathResult::Invalidate(const nsIContent* aChangeRoot)
|
||||
if (contextNode->IsContent()) {
|
||||
ctxBindingParent =
|
||||
contextNode->AsContent()->GetBindingParent();
|
||||
} else if (contextNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
|
||||
Element* parent =
|
||||
static_cast<Attr*>(contextNode.get())->GetElement();
|
||||
if (parent) {
|
||||
} else if (auto* attr = Attr::FromNode(contextNode)) {
|
||||
if (Element* parent = attr->GetElement()) {
|
||||
ctxBindingParent = parent->GetBindingParent();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user