diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:34:38 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:34:38 -0400 |
commit | 5f12940329ba496da5730863cae94cd8c0b145da (patch) | |
tree | 7dede8dd472329aac367a5bd1c02494fca44482f | |
parent | a72b827325c25c5951b57146e482e49e92e60f32 (diff) | |
download | uxp-5f12940329ba496da5730863cae94cd8c0b145da.tar.gz |
Bug 1396584 - Remove support for multiple ShadowRoots
Tag #1375
44 files changed, 334 insertions, 1955 deletions
diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp index 23b919516b..391b7c326a 100644 --- a/dom/base/ChildIterator.cpp +++ b/dom/base/ChildIterator.cpp @@ -8,7 +8,6 @@ #include "nsContentUtils.h" #include "mozilla/dom/XBLChildrenElement.h" #include "mozilla/dom/HTMLContentElement.h" -#include "mozilla/dom/HTMLShadowElement.h" #include "mozilla/dom/ShadowRoot.h" #include "nsIAnonymousContentCreator.h" #include "nsIFrame.h" @@ -78,17 +77,6 @@ ExplicitChildIterator::GetNextChild() } mIndexInInserted = 0; mChild = mChild->GetNextSibling(); - } else if (mShadowIterator) { - // If we're inside of a <shadow> element, look through the - // explicit children of the projected ShadowRoot via - // the mShadowIterator. - nsIContent* nextChild = mShadowIterator->GetNextChild(); - if (nextChild) { - return nextChild; - } - - mShadowIterator = nullptr; - mChild = mChild->GetNextSibling(); } else if (mDefaultChild) { // If we're already in default content, check if there are more nodes there MOZ_ASSERT(mChild); @@ -110,23 +98,7 @@ ExplicitChildIterator::GetNextChild() // Iterate until we find a non-insertion point, or an insertion point with // content. while (mChild) { - // If the current child being iterated is a shadow insertion point then - // the iterator needs to go into the projected ShadowRoot. - if (ShadowRoot::IsShadowInsertionPoint(mChild)) { - // Look for the next child in the projected ShadowRoot for the <shadow> - // element. - HTMLShadowElement* shadowElem = HTMLShadowElement::FromContent(mChild); - ShadowRoot* projectedShadow = shadowElem->GetOlderShadowRoot(); - if (projectedShadow) { - mShadowIterator = new ExplicitChildIterator(projectedShadow); - nsIContent* nextChild = mShadowIterator->GetNextChild(); - if (nextChild) { - return nextChild; - } - mShadowIterator = nullptr; - } - mChild = mChild->GetNextSibling(); - } else if (nsContentUtils::IsContentInsertionPoint(mChild)) { + if (nsContentUtils::IsContentInsertionPoint(mChild)) { // If the current child being iterated is a content insertion point // then the iterator needs to return the nodes distributed into // the content insertion point. @@ -198,11 +170,9 @@ ExplicitChildIterator::Seek(nsIContent* aChildToFind) !aChildToFind->IsRootOfAnonymousSubtree()) { // Fast path: just point ourselves to aChildToFind, which is a // normal DOM child of ours. - MOZ_ASSERT(!ShadowRoot::IsShadowInsertionPoint(aChildToFind)); MOZ_ASSERT(!nsContentUtils::IsContentInsertionPoint(aChildToFind)); mChild = aChildToFind; mIndexInInserted = 0; - mShadowIterator = nullptr; mDefaultChild = nullptr; mIsFirst = false; return true; @@ -223,9 +193,8 @@ ExplicitChildIterator::Get() const if (mIndexInInserted) { MatchedNodes assignedChildren = GetMatchedNodesForPoint(mChild); return assignedChildren[mIndexInInserted - 1]; - } else if (mShadowIterator) { - return mShadowIterator->Get(); } + return mDefaultChild ? mDefaultChild : mChild; } @@ -241,13 +210,6 @@ ExplicitChildIterator::GetPreviousChild() return assignedChildren[mIndexInInserted - 1]; } mChild = mChild->GetPreviousSibling(); - } else if (mShadowIterator) { - nsIContent* previousChild = mShadowIterator->GetPreviousChild(); - if (previousChild) { - return previousChild; - } - mShadowIterator = nullptr; - mChild = mChild->GetPreviousSibling(); } else if (mDefaultChild) { // If we're already in default content, check if there are more nodes there mDefaultChild = mDefaultChild->GetPreviousSibling(); @@ -267,22 +229,7 @@ ExplicitChildIterator::GetPreviousChild() // Iterate until we find a non-insertion point, or an insertion point with // content. while (mChild) { - if (ShadowRoot::IsShadowInsertionPoint(mChild)) { - // If the current child being iterated is a shadow insertion point then - // the iterator needs to go into the projected ShadowRoot. - HTMLShadowElement* shadowElem = HTMLShadowElement::FromContent(mChild); - ShadowRoot* projectedShadow = shadowElem->GetOlderShadowRoot(); - if (projectedShadow) { - // Create a ExplicitChildIterator that begins iterating from the end. - mShadowIterator = new ExplicitChildIterator(projectedShadow, false); - nsIContent* previousChild = mShadowIterator->GetPreviousChild(); - if (previousChild) { - return previousChild; - } - mShadowIterator = nullptr; - } - mChild = mChild->GetPreviousSibling(); - } else if (nsContentUtils::IsContentInsertionPoint(mChild)) { + if (nsContentUtils::IsContentInsertionPoint(mChild)) { // If the current child being iterated is a content insertion point // then the iterator needs to return the nodes distributed into // the content insertion point. diff --git a/dom/base/ChildIterator.h b/dom/base/ChildIterator.h index 63425149af..f78ba7ca3d 100644 --- a/dom/base/ChildIterator.h +++ b/dom/base/ChildIterator.h @@ -48,15 +48,11 @@ public: ExplicitChildIterator(const ExplicitChildIterator& aOther) : mParent(aOther.mParent), mChild(aOther.mChild), mDefaultChild(aOther.mDefaultChild), - mShadowIterator(aOther.mShadowIterator ? - new ExplicitChildIterator(*aOther.mShadowIterator) : - nullptr), mIndexInInserted(aOther.mIndexInInserted), mIsFirst(aOther.mIsFirst) {} ExplicitChildIterator(ExplicitChildIterator&& aOther) : mParent(aOther.mParent), mChild(aOther.mChild), mDefaultChild(aOther.mDefaultChild), - mShadowIterator(Move(aOther.mShadowIterator)), mIndexInInserted(aOther.mIndexInInserted), mIsFirst(aOther.mIsFirst) {} nsIContent* GetNextChild(); @@ -114,11 +110,6 @@ protected: // to null, we continue iterating at mChild's next sibling. nsIContent* mDefaultChild; - // If non-null, this points to an iterator of the explicit children of - // the ShadowRoot projected by the current shadow element that we're - // iterating. - nsAutoPtr<ExplicitChildIterator> mShadowIterator; - // If not zero, we're iterating inserted children for an insertion point. This // is an index into mChild's inserted children array (mChild must be an // nsXBLChildrenElement). The index is one past the "current" child (as diff --git a/dom/base/DocumentFragment.cpp b/dom/base/DocumentFragment.cpp index b3d0d9962d..3e1e2c81bf 100644 --- a/dom/base/DocumentFragment.cpp +++ b/dom/base/DocumentFragment.cpp @@ -125,9 +125,7 @@ DocumentFragment::Constructor(const GlobalObject& aGlobal, return window->GetDoc()->CreateDocumentFragment(); } -NS_IMPL_CYCLE_COLLECTION_INHERITED(DocumentFragment, - FragmentOrElement, - mHost) +NS_IMPL_CYCLE_COLLECTION_INHERITED(DocumentFragment, FragmentOrElement, mHost) // QueryInterface implementation for DocumentFragment NS_INTERFACE_MAP_BEGIN(DocumentFragment) diff --git a/dom/base/DocumentFragment.h b/dom/base/DocumentFragment.h index 33d8d4d9d5..ccc233ff13 100644 --- a/dom/base/DocumentFragment.h +++ b/dom/base/DocumentFragment.h @@ -43,8 +43,7 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocumentFragment, - FragmentOrElement) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocumentFragment, FragmentOrElement) // interface nsIDOMNode NS_FORWARD_NSIDOMNODE_TO_NSINODE @@ -123,15 +122,9 @@ public: return nullptr; } - Element* GetHost() const - { - return mHost; - } + Element* GetHost() const { return mHost; } - void SetHost(Element* aHost) - { - mHost = aHost; - } + void SetHost(Element* aHost) { mHost = aHost; } static already_AddRefed<DocumentFragment> Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index a2b78092ad..5bbfbee9b4 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -1095,6 +1095,11 @@ Element::RemoveFromIdTable() already_AddRefed<ShadowRoot> Element::CreateShadowRoot(ErrorResult& aError) { + if (GetShadowRoot()) { + aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return nullptr; + } + nsAutoScriptBlocker scriptBlocker; RefPtr<mozilla::dom::NodeInfo> nodeInfo; @@ -1131,24 +1136,7 @@ Element::CreateShadowRoot(ErrorResult& aError) shadowRoot->SetIsComposedDocParticipant(IsInComposedDoc()); - // Replace the old ShadowRoot with the new one and let the old - // ShadowRoot know about the younger ShadowRoot because the old - // ShadowRoot is projected into the younger ShadowRoot's shadow - // insertion point (if it exists). - ShadowRoot* olderShadow = GetShadowRoot(); SetShadowRoot(shadowRoot); - if (olderShadow) { - olderShadow->SetYoungerShadow(shadowRoot); - - // Unbind children of older shadow root because they - // are no longer in the composed tree. - for (nsIContent* child = olderShadow->GetFirstChild(); child; - child = child->GetNextSibling()) { - child->UnbindFromTree(true, false); - } - - olderShadow->SetIsComposedDocParticipant(false); - } // xblBinding takes ownership of docInfo. RefPtr<nsXBLBinding> xblBinding = new nsXBLBinding(shadowRoot, protoBinding); diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index d7e7a78f49..592f5447d2 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -861,23 +861,10 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor) // for destination insertion points where nodes have been distributed. nsTArray<nsIContent*>* destPoints = GetExistingDestInsertionPoints(); if (destPoints && !destPoints->IsEmpty()) { - // Push destination insertion points to aVisitor.mDestInsertionPoints - // excluding shadow insertion points. - bool didPushNonShadowInsertionPoint = false; + // Push destination insertion points to aVisitor.mDestInsertionPoints. for (uint32_t i = 0; i < destPoints->Length(); i++) { nsIContent* point = destPoints->ElementAt(i); - if (!ShadowRoot::IsShadowInsertionPoint(point)) { - aVisitor.mDestInsertionPoints.AppendElement(point); - didPushNonShadowInsertionPoint = true; - } - } - - // Next node in the event path is the final destination - // (non-shadow) insertion point that was pushed. - if (didPushNonShadowInsertionPoint) { - parent = aVisitor.mDestInsertionPoints.LastElement(); - aVisitor.mDestInsertionPoints.SetLength( - aVisitor.mDestInsertionPoints.Length() - 1); + aVisitor.mDestInsertionPoints.AppendElement(point); } } @@ -901,10 +888,7 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor) aVisitor.mDestInsertionPoints.SetLength( aVisitor.mDestInsertionPoints.Length() - 1); } else { - // The pool host for the youngest shadow root is shadow DOM host, - // for older shadow roots, it is the shadow insertion point - // where the shadow root is projected, nullptr if none exists. - parent = thisShadowRoot->GetPoolHost(); + parent = thisShadowRoot->GetHost(); } } @@ -2407,9 +2391,8 @@ FragmentOrElement::SetIsElementInStyleScopeFlagOnShadowTree(bool aInStyleScope) NS_ASSERTION(IsElement(), "calling SetIsElementInStyleScopeFlagOnShadowTree " "on a non-Element is useless"); ShadowRoot* shadowRoot = GetShadowRoot(); - while (shadowRoot) { + if (shadowRoot) { shadowRoot->SetIsElementInStyleScopeFlagOnSubtree(aInStyleScope); - shadowRoot = shadowRoot->GetOlderShadowRoot(); } } diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index 51223a8937..c9bd58d53a 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -15,7 +15,6 @@ #include "nsIStyleSheetLinkingElement.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/HTMLContentElement.h" -#include "mozilla/dom/HTMLShadowElement.h" #include "nsXBLPrototypeBinding.h" #include "mozilla/StyleSheet.h" #include "mozilla/StyleSheetInlines.h" @@ -27,10 +26,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(ShadowRoot) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ShadowRoot, DocumentFragment) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPoolHost) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleSheetList) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOlderShadow) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mYoungerShadow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAssociatedBinding) for (auto iter = tmp->mIdentifierMap.ConstIter(); !iter.Done(); iter.Next()) { @@ -38,18 +34,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ShadowRoot, } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ShadowRoot, - DocumentFragment) - if (tmp->mPoolHost) { - tmp->mPoolHost->RemoveMutationObserver(tmp); +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ShadowRoot) + if (tmp->GetHost()) { + tmp->GetHost()->RemoveMutationObserver(tmp); } - NS_IMPL_CYCLE_COLLECTION_UNLINK(mPoolHost) NS_IMPL_CYCLE_COLLECTION_UNLINK(mStyleSheetList) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mOlderShadow) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mYoungerShadow) NS_IMPL_CYCLE_COLLECTION_UNLINK(mAssociatedBinding) tmp->mIdentifierMap.Clear(); -NS_IMPL_CYCLE_COLLECTION_UNLINK_END +NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(DocumentFragment) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ShadowRoot) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent) @@ -62,9 +54,10 @@ NS_IMPL_RELEASE_INHERITED(ShadowRoot, DocumentFragment) ShadowRoot::ShadowRoot(Element* aElement, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, nsXBLPrototypeBinding* aProtoBinding) - : DocumentFragment(aNodeInfo), mPoolHost(aElement), - mProtoBinding(aProtoBinding), mShadowElement(nullptr), - mInsertionPointChanged(false), mIsComposedDocParticipant(false) + : DocumentFragment(aNodeInfo) + , mProtoBinding(aProtoBinding) + , mInsertionPointChanged(false) + , mIsComposedDocParticipant(false) { SetHost(aElement); @@ -81,23 +74,21 @@ ShadowRoot::ShadowRoot(Element* aElement, // Add the ShadowRoot as a mutation observer on the host to watch // for mutations because the insertion points in this ShadowRoot // may need to be updated when the host children are modified. - mPoolHost->AddMutationObserver(this); + GetHost()->AddMutationObserver(this); } ShadowRoot::~ShadowRoot() { - if (mPoolHost) { + if (GetHost()) { // mPoolHost may have been unlinked or a new ShadowRoot may have been // creating, making this one obsolete. - mPoolHost->RemoveMutationObserver(this); + GetHost()->RemoveMutationObserver(this); } UnsetFlags(NODE_IS_IN_SHADOW_TREE); // nsINode destructor expects mSubtreeRoot == this. SetSubtreeRootPointer(this); - - SetHost(nullptr); } JSObject* @@ -246,15 +237,6 @@ ShadowRoot::RemoveInsertionPoint(HTMLContentElement* aInsertionPoint) } void -ShadowRoot::SetYoungerShadow(ShadowRoot* aYoungerShadow) -{ - mYoungerShadow = aYoungerShadow; - mYoungerShadow->mOlderShadow = this; - - ChangePoolHost(mYoungerShadow->GetShadowElement()); -} - -void ShadowRoot::RemoveDestInsertionPoint(nsIContent* aInsertionPoint, nsTArray<nsIContent*>& aDestInsertionPoints) { @@ -302,8 +284,7 @@ ShadowRoot::DistributeSingleNode(nsIContent* aContent) // Find the appropriate position in the matched node list for the // newly distributed content. bool isIndexFound = false; - MOZ_ASSERT(mPoolHost, "Where did the content come from if there is no pool host?"); - ExplicitChildIterator childIterator(mPoolHost); + ExplicitChildIterator childIterator(GetHost()); for (uint32_t i = 0; i < matchedNodes.Length(); i++) { // Seek through the host's explicit children until the inserted content // is found or when the current matched node is reached. @@ -323,15 +304,6 @@ ShadowRoot::DistributeSingleNode(nsIContent* aContent) insertionPoint->AppendMatchedNode(aContent); } - // Handle the case where the parent of the insertion point is a ShadowRoot - // that is projected into the younger ShadowRoot's shadow insertion point. - // The node distributed into the insertion point must be reprojected - // to the shadow insertion point. - if (insertionPoint->GetParent() == this && - mYoungerShadow && mYoungerShadow->GetShadowElement()) { - mYoungerShadow->GetShadowElement()->DistributeSingleNode(aContent); - } - // Handle the case where the parent of the insertion point has a ShadowRoot. // The node distributed into the insertion point must be reprojected to the // insertion points of the parent's ShadowRoot. @@ -339,16 +311,6 @@ ShadowRoot::DistributeSingleNode(nsIContent* aContent) if (parentShadow) { parentShadow->DistributeSingleNode(aContent); } - - // Handle the case where the parent of the insertion point is the <shadow> - // element. The node distributed into the insertion point must be reprojected - // into the older ShadowRoot's insertion points. - if (mShadowElement && mShadowElement == insertionPoint->GetParent()) { - ShadowRoot* olderShadow = mShadowElement->GetOlderShadowRoot(); - if (olderShadow) { - olderShadow->DistributeSingleNode(aContent); - } - } } } @@ -370,15 +332,6 @@ ShadowRoot::RemoveDistributedNode(nsIContent* aContent) mInsertionPoints[i]->RemoveMatchedNode(aContent); - // Handle the case where the parent of the insertion point is a ShadowRoot - // that is projected into the younger ShadowRoot's shadow insertion point. - // The removed node needs to be removed from the shadow insertion point. - if (mInsertionPoints[i]->GetParent() == this) { - if (mYoungerShadow && mYoungerShadow->GetShadowElement()) { - mYoungerShadow->GetShadowElement()->RemoveDistributedNode(aContent); - } - } - // Handle the case where the parent of the insertion point has a ShadowRoot. // The removed node needs to be removed from the insertion points of the // parent's ShadowRoot. @@ -387,16 +340,6 @@ ShadowRoot::RemoveDistributedNode(nsIContent* aContent) parentShadow->RemoveDistributedNode(aContent); } - // Handle the case where the parent of the insertion point is the <shadow> - // element. The removed node must be removed from the older ShadowRoot's - // insertion points. - if (mShadowElement && mShadowElement == mInsertionPoints[i]->GetParent()) { - ShadowRoot* olderShadow = mShadowElement->GetOlderShadowRoot(); - if (olderShadow) { - olderShadow->RemoveDistributedNode(aContent); - } - } - break; } } @@ -407,16 +350,10 @@ ShadowRoot::DistributeAllNodes() { // Create node pool. nsTArray<nsIContent*> nodePool; - - // Make sure there is a pool host, an older shadow may not have - // one if the younger shadow does not have a <shadow> element. - if (mPoolHost) { - ExplicitChildIterator childIterator(mPoolHost); - for (nsIContent* content = childIterator.GetNextChild(); - content; - content = childIterator.GetNextChild()) { - nodePool.AppendElement(content); - } + ExplicitChildIterator childIterator(GetHost()); + for (nsIContent* content = childIterator.GetNextChild(); content; + content = childIterator.GetNextChild()) { + nodePool.AppendElement(content); } nsTArray<ShadowRoot*> shadowsToUpdate; @@ -447,20 +384,6 @@ ShadowRoot::DistributeAllNodes() } } - // If there is a shadow insertion point in this ShadowRoot, the children - // of the shadow insertion point needs to be distributed into the insertion - // points of the older ShadowRoot. - if (mShadowElement && mOlderShadow) { - mOlderShadow->DistributeAllNodes(); - } - - // If there is a younger ShadowRoot with a shadow insertion point, - // then the children of this ShadowRoot needs to be distributed to - // the younger ShadowRoot's shadow insertion point. - if (mYoungerShadow && mYoungerShadow->GetShadowElement()) { - mYoungerShadow->GetShadowElement()->DistributeAllNodes(); - } - for (uint32_t i = 0; i < shadowsToUpdate.Length(); i++) { shadowsToUpdate[i]->DistributeAllNodes(); } @@ -517,59 +440,6 @@ ShadowRoot::StyleSheets() return mStyleSheetList; } -void -ShadowRoot::SetShadowElement(HTMLShadowElement* aShadowElement) -{ - // If there is already a shadow element point, remove - // the projected shadow because it is no longer an insertion - // point. - if (mShadowElement) { - mShadowElement->SetProjectedShadow(nullptr); - } - - if (mOlderShadow) { - // Nodes for distribution will come from the new shadow element. - mOlderShadow->ChangePoolHost(aShadowElement); - } - - // Set the new shadow element to project the older ShadowRoot because - // it is the current shadow insertion point. - mShadowElement = aShadowElement; - if (mShadowElement) { - mShadowElement->SetProjectedShadow(mOlderShadow); - } -} - -void -ShadowRoot::ChangePoolHost(nsIContent* aNewHost) -{ - if (mPoolHost) { - mPoolHost->RemoveMutationObserver(this); - } - - // Clear the nodes matched to content insertion points - // because it is no longer relevant. - for (uint32_t i = 0; i < mInsertionPoints.Length(); i++) { - mInsertionPoints[i]->ClearMatchedNodes(); - } - - mPoolHost = aNewHost; - if (mPoolHost) { - mPoolHost->AddMutationObserver(this); - } -} - -bool -ShadowRoot::IsShadowInsertionPoint(nsIContent* aContent) -{ - if (!aContent) { - return false; - } - - HTMLShadowElement* shadowElem = HTMLShadowElement::FromContent(aContent); - return shadowElem && shadowElem->IsInsertionPoint(); -} - /** * Returns whether the web components pool population algorithm * on the host would contain |aContent|. This function ignores @@ -580,8 +450,7 @@ bool ShadowRoot::IsPooledNode(nsIContent* aContent, nsIContent* aContainer, nsIContent* aHost) { - if (nsContentUtils::IsContentInsertionPoint(aContent) || - IsShadowInsertionPoint(aContent)) { + if (nsContentUtils::IsContentInsertionPoint(aContent)) { // Insertion points never end up in the pool. return false; } @@ -614,7 +483,7 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument, int32_t aModType, const nsAttrValue* aOldValue) { - if (!IsPooledNode(aElement, aElement->GetParent(), mPoolHost)) { + if (!IsPooledNode(aElement, aElement->GetParent(), GetHost())) { return; } @@ -647,7 +516,7 @@ ShadowRoot::ContentAppended(nsIDocument* aDocument, } } - if (IsPooledNode(currentChild, aContainer, mPoolHost)) { + if (IsPooledNode(currentChild, aContainer, GetHost())) { DistributeSingleNode(currentChild); } @@ -669,7 +538,7 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument, // Watch for new nodes added to the pool because the node // may need to be added to an insertion point. - if (IsPooledNode(aChild, aContainer, mPoolHost)) { + if (IsPooledNode(aChild, aContainer, GetHost())) { // Add insertion point to destination insertion points of fallback content. if (nsContentUtils::IsContentInsertionPoint(aContainer)) { HTMLContentElement* content = HTMLContentElement::FromContent(aContainer); @@ -706,7 +575,7 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument, // Watch for node that is removed from the pool because // it may need to be removed from an insertion point. - if (IsPooledNode(aChild, aContainer, mPoolHost)) { + if (IsPooledNode(aChild, aContainer, GetHost())) { RemoveDistributedNode(aChild); } } @@ -718,15 +587,6 @@ ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const return NS_ERROR_DOM_DATA_CLONE_ERR; } -void -ShadowRoot::DestroyContent() -{ - if (mOlderShadow) { - mOlderShadow->DestroyContent(); - } - DocumentFragment::DestroyContent(); -} - NS_IMPL_CYCLE_COLLECTION_INHERITED(ShadowRootStyleSheetList, StyleSheetList, mShadowRoot) diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h index e76e4ab3f3..04943752be 100644 --- a/dom/base/ShadowRoot.h +++ b/dom/base/ShadowRoot.h @@ -25,7 +25,6 @@ namespace dom { class Element; class HTMLContentElement; -class HTMLShadowElement; class ShadowRootStyleSheetList; class ShadowRoot final : public DocumentFragment, @@ -42,7 +41,8 @@ public: NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED - ShadowRoot(Element* aElement, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, + ShadowRoot(Element* aElement, + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, nsXBLPrototypeBinding* aProtoBinding); void AddToIdTable(Element* aElement, nsIAtom* aId); @@ -52,24 +52,6 @@ public: bool ApplyAuthorStyles(); void SetApplyAuthorStyles(bool aApplyAuthorStyles); StyleSheetList* StyleSheets(); - HTMLShadowElement* GetShadowElement() { return mShadowElement; } - - /** - * Sets the current shadow insertion point where the older - * ShadowRoot will be projected. - */ - void SetShadowElement(HTMLShadowElement* aShadowElement); - - /** - * Change the node that populates the distribution pool with - * its children. This is distinct from the ShadowRoot host described - * in the specifications. The ShadowRoot host is the element - * which created this ShadowRoot and does not change. The pool host - * is the same as the ShadowRoot host if this is the youngest - * ShadowRoot. If this is an older ShadowRoot, the pool host is - * the <shadow> element in the younger ShadowRoot (if it exists). - */ - void ChangePoolHost(nsIContent* aNewHost); /** * Distributes a single explicit child of the pool host to the content @@ -92,23 +74,15 @@ public: void AddInsertionPoint(HTMLContentElement* aInsertionPoint); void RemoveInsertionPoint(HTMLContentElement* aInsertionPoint); - void SetYoungerShadow(ShadowRoot* aYoungerShadow); - ShadowRoot* GetYoungerShadowRoot() { return mYoungerShadow; } void SetInsertionPointChanged() { mInsertionPointChanged = true; } void SetAssociatedBinding(nsXBLBinding* aBinding) { mAssociatedBinding = aBinding; } - nsISupports* GetParentObject() const { return mPoolHost; } - - nsIContent* GetPoolHost() { return mPoolHost; } - nsTArray<HTMLShadowElement*>& ShadowDescendants() { return mShadowDescendants; } - JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; static bool IsPooledNode(nsIContent* aChild, nsIContent* aContainer, nsIContent* aHost); static ShadowRoot* FromNode(nsINode* aNode); - static bool IsShadowInsertionPoint(nsIContent* aContent); static void RemoveDestInsertionPoint(nsIContent* aInsertionPoint, nsTArray<nsIContent*>& aDestInsertionPoints); @@ -125,7 +99,6 @@ public: void GetInnerHTML(nsAString& aInnerHTML); void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError); Element* Host(); - ShadowRoot* GetOlderShadowRoot() { return mOlderShadow; } void StyleSheetChanged(); bool IsComposedDocParticipant() { return mIsComposedDocParticipant; } @@ -134,14 +107,9 @@ public: mIsComposedDocParticipant = aIsComposedDocParticipant; } - virtual void DestroyContent() override; protected: virtual ~ShadowRoot(); - // The pool host is the parent of the nodes that will be distributed - // into the insertion points in this ShadowRoot. See |ChangeShadowRoot|. - nsCOMPtr<nsIContent> mPoolHost; - // An array of content insertion points that are a descendant of the ShadowRoot // sorted in tree order. Insertion points are responsible for notifying // the ShadowRoot when they are removed or added as a descendant. The insertion @@ -149,10 +117,6 @@ protected: // by the array. nsTArray<HTMLContentElement*> mInsertionPoints; - // An array of the <shadow> elements that are descendant of the ShadowRoot - // sorted in tree order. Only the first may be a shadow insertion point. - nsTArray<HTMLShadowElement*> mShadowDescendants; - nsTHashtable<nsIdentifierMapEntry> mIdentifierMap; nsXBLPrototypeBinding* mProtoBinding; @@ -163,17 +127,6 @@ protected: RefPtr<ShadowRootStyleSheetList> mStyleSheetList; - // The current shadow insertion point of this ShadowRoot. - HTMLShadowElement* mShadowElement; - - // The ShadowRoot that was created by the host element before - // this ShadowRoot was created. - RefPtr<ShadowRoot> mOlderShadow; - - // The ShadowRoot that was created by the host element after - // this ShadowRoot was created. - RefPtr<ShadowRoot> mYoungerShadow; - // A boolean that indicates that an insertion point was added or removed // from this ShadowRoot and that the nodes need to be redistributed into // the insertion points. After this flag is set, nodes will be distributed diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index a68f5ef87d..96f9065803 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -46,7 +46,6 @@ #include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLTemplateElement.h" #include "mozilla/dom/HTMLContentElement.h" -#include "mozilla/dom/HTMLShadowElement.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/dom/Promise.h" @@ -7056,20 +7055,6 @@ nsContentUtils::HasDistributedChildren(nsIContent* aContent) return true; } - ShadowRoot* shadow = ShadowRoot::FromNode(aContent); - if (shadow) { - // Children of a shadow root are distributed to - // the shadow insertion point of the younger shadow root. - return shadow->GetYoungerShadowRoot(); - } - - HTMLShadowElement* shadowEl = HTMLShadowElement::FromContent(aContent); - if (shadowEl && shadowEl->IsInsertionPoint()) { - // Children of a shadow insertion points are distributed - // to the insertion points in the older shadow root. - return shadowEl->GetOlderShadowRoot(); - } - HTMLContentElement* contentEl = HTMLContentElement::FromContent(aContent); if (contentEl && contentEl->IsInsertionPoint()) { // Children of a content insertion point are distributed to the diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index 2f0e30387c..0ae35480ff 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -1560,7 +1560,6 @@ GK_ATOM(saturate, "saturate") GK_ATOM(saturation, "saturation") GK_ATOM(set, "set") GK_ATOM(seed, "seed") -GK_ATOM(shadow, "shadow") GK_ATOM(shape_rendering, "shape-rendering") GK_ATOM(skewX, "skewX") GK_ATOM(skewY, "skewY") diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp index 384e56cde6..5fdd24e439 100644 --- a/dom/base/nsNodeUtils.cpp +++ b/dom/base/nsNodeUtils.cpp @@ -65,7 +65,7 @@ using mozilla::AutoJSContext; } \ ShadowRoot* shadow = ShadowRoot::FromNode(node); \ if (shadow) { \ - node = shadow->GetPoolHost(); \ + node = shadow->GetHost(); \ } else { \ node = node->GetParentNode(); \ } \ @@ -93,7 +93,7 @@ using mozilla::AutoJSContext; } \ ShadowRoot* shadow = ShadowRoot::FromNode(node); \ if (shadow) { \ - node = shadow->GetPoolHost(); \ + node = shadow->GetHost(); \ } else { \ node = node->GetParentNode(); \ } \ diff --git a/dom/base/test/test_mutationobservers.html b/dom/base/test/test_mutationobservers.html index 7e4c994235..021bedf1c8 100644 --- a/dom/base/test/test_mutationobservers.html +++ b/dom/base/test/test_mutationobservers.html @@ -612,7 +612,7 @@ function testOutsideShadowDOM() { is(records.length, 1); is(records[0].type, "attributes", "Should have got attributes"); observer.disconnect(); - then(testInsideShadowDOM); + then(testMarquee); }); m.observe(div, { attributes: true, @@ -628,32 +628,6 @@ function testOutsideShadowDOM() { div.setAttribute("foo", "bar"); } -function testInsideShadowDOM() { - var m = new M(function(records, observer) { - is(records.length, 4); - is(records[0].type, "childList"); - is(records[1].type, "attributes"); - is(records[2].type, "characterData"); - is(records[3].type, "childList"); - observer.disconnect(); - then(testMarquee); - }); - var sr = div.createShadowRoot(); - m.observe(sr, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - - sr.innerHTML = "<div" + ">text</" + "div>"; - sr.firstChild.setAttribute("foo", "bar"); - sr.firstChild.firstChild.data = "text2"; - sr.firstChild.appendChild(document.createElement("div")); - div.setAttribute("foo", "bar2"); - -} - function testMarquee() { var m = new M(function(records, observer) { is(records.length, 1); diff --git a/dom/html/HTMLShadowElement.cpp b/dom/html/HTMLShadowElement.cpp deleted file mode 100644 index 8824c2875f..0000000000 --- a/dom/html/HTMLShadowElement.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/* -*- 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/. */ - -#include "mozilla/dom/ShadowRoot.h" - -#include "ChildIterator.h" -#include "nsContentUtils.h" -#include "nsDocument.h" -#include "mozilla/dom/HTMLShadowElement.h" -#include "mozilla/dom/HTMLUnknownElement.h" -#include "mozilla/dom/HTMLShadowElementBinding.h" - -// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Shadow) to add check for web components -// being enabled. -nsGenericHTMLElement* -NS_NewHTMLShadowElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, - mozilla::dom::FromParser aFromParser) -{ - // When this check is removed, remove the nsDocument.h and - // HTMLUnknownElement.h includes. Also remove nsINode::IsHTMLShadowElement. - // - // We have to jump through some hoops to be able to produce both NodeInfo* and - // already_AddRefed<NodeInfo>& for our callees. - RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo); - if (!nsDocument::IsWebComponentsEnabled(nodeInfo)) { - already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget()); - return new mozilla::dom::HTMLUnknownElement(nodeInfoArg); - } - - already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget()); - return new mozilla::dom::HTMLShadowElement(nodeInfoArg); -} - -using namespace mozilla::dom; - -HTMLShadowElement::HTMLShadowElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) - : nsGenericHTMLElement(aNodeInfo), mIsInsertionPoint(false) -{ -} - -HTMLShadowElement::~HTMLShadowElement() -{ - if (mProjectedShadow) { - mProjectedShadow->RemoveMutationObserver(this); - } -} - -NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLShadowElement) - -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLShadowElement, - nsGenericHTMLElement) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mProjectedShadow) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END - -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLShadowElement, - nsGenericHTMLElement) - if (tmp->mProjectedShadow) { - tmp->mProjectedShadow->RemoveMutationObserver(tmp); - tmp->mProjectedShadow = nullptr; - } -NS_IMPL_CYCLE_COLLECTION_UNLINK_END - -NS_IMPL_ADDREF_INHERITED(HTMLShadowElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLShadowElement, Element) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLShadowElement) -NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) - -NS_IMPL_ELEMENT_CLONE(HTMLShadowElement) - -JSObject* -HTMLShadowElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) -{ - return HTMLShadowElementBinding::Wrap(aCx, this, aGivenProto); -} - -void -HTMLShadowElement::SetProjectedShadow(ShadowRoot* aProjectedShadow) -{ - if (mProjectedShadow) { - mProjectedShadow->RemoveMutationObserver(this); - - // The currently projected ShadowRoot is going away, - // thus the destination insertion points need to be updated. - ExplicitChildIterator childIterator(mProjectedShadow); - for (nsIContent* content = childIterator.GetNextChild(); - content; - content = childIterator.GetNextChild()) { - ShadowRoot::RemoveDestInsertionPoint(this, content->DestInsertionPoints()); - } - } - - mProjectedShadow = aProjectedShadow; - if (mProjectedShadow) { - // A new ShadowRoot is being projected, thus its explcit - // children will be distributed to this shadow insertion point. - ExplicitChildIterator childIterator(mProjectedShadow); - for (nsIContent* content = childIterator.GetNextChild(); - content; - content = childIterator.GetNextChild()) { - content->DestInsertionPoints().AppendElement(this); - } - - // Watch for mutations on the projected shadow because - // it affects the nodes that are distributed to this shadow - // insertion point. - mProjectedShadow->AddMutationObserver(this); - } -} - -static bool -IsInFallbackContent(nsIContent* aContent) -{ - nsINode* parentNode = aContent->GetParentNode(); - while (parentNode) { - if (parentNode->IsHTMLElement(nsGkAtoms::content)) { - return true; - } - parentNode = parentNode->GetParentNode(); - } - - return false; -} - -nsresult -HTMLShadowElement::BindToTree(nsIDocument* aDocument, - nsIContent* aParent, - nsIContent* aBindingParent, - bool aCompileEventHandlers) -{ - RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow(); - - nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, - aBindingParent, - aCompileEventHandlers); - NS_ENSURE_SUCCESS(rv, rv); - - ShadowRoot* containingShadow = GetContainingShadow(); - if (containingShadow && !oldContainingShadow) { - // Keep track of all descendant <shadow> elements in tree order so - // that when the current shadow insertion point is removed, the next - // one can be found quickly. - TreeOrderComparator comparator; - containingShadow->ShadowDescendants().InsertElementSorted(this, comparator); - - if (containingShadow->ShadowDescendants()[0] != this) { - // Only the first <shadow> (in tree order) of a ShadowRoot can be an insertion point. - return NS_OK; - } - - if (IsInFallbackContent(this)) { - // If the first shadow element in tree order is invalid (in fallback content), - // the containing ShadowRoot will not have a shadow insertion point. - containingShadow->SetShadowElement(nullptr); - } else { - mIsInsertionPoint = true; - containingShadow->SetShadowElement(this); - } - - containingShadow->SetInsertionPointChanged(); - } - - if (mIsInsertionPoint && containingShadow) { - // Propagate BindToTree calls to projected shadow root children. - ShadowRoot* projectedShadow = containingShadow->GetOlderShadowRoot(); - if (projectedShadow) { - projectedShadow->SetIsComposedDocParticipant(IsInComposedDoc()); - - for (nsIContent* child = projectedShadow->GetFirstChild(); child; - child = child->GetNextSibling()) { - rv = child->BindToTree(nullptr, projectedShadow, - projectedShadow->GetBindingParent(), - aCompileEventHandlers); - NS_ENSURE_SUCCESS(rv, rv); - } - } - } - - return NS_OK; -} - -void -HTMLShadowElement::UnbindFromTree(bool aDeep, bool aNullParent) -{ - RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow(); - - if (mIsInsertionPoint && oldContainingShadow) { - // Propagate UnbindFromTree call to previous projected shadow - // root children. - ShadowRoot* projectedShadow = oldContainingShadow->GetOlderShadowRoot(); - if (projectedShadow) { - for (nsIContent* child = projectedShadow->GetFirstChild(); child; - child = child->GetNextSibling()) { - child->UnbindFromTree(true, false); - } - - projectedShadow->SetIsComposedDocParticipant(false); - } - } - - nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); - - if (oldContainingShadow && !GetContainingShadow() && mIsInsertionPoint) { - nsTArray<HTMLShadowElement*>& shadowDescendants = - oldContainingShadow->ShadowDescendants(); - shadowDescendants.RemoveElement(this); - oldContainingShadow->SetShadowElement(nullptr); - - // Find the next shadow insertion point. - if (shadowDescendants.Length() > 0 && - !IsInFallbackContent(shadowDescendants[0])) { - oldContainingShadow->SetShadowElement(shadowDescendants[0]); - } - - oldContainingShadow->SetInsertionPointChanged(); - - mIsInsertionPoint = false; - } -} - -void -HTMLShadowElement::DistributeSingleNode(nsIContent* aContent) -{ - if (aContent->DestInsertionPoints().Contains(this)) { - // Node has already been distrbuted this this node, - // we are done. - return; - } - - aContent->DestInsertionPoints().AppendElement(this); - - // Handle the case where the shadow element is a child of - // a node with a ShadowRoot. The nodes that have been distributed to - // this shadow insertion point will need to be reprojected into the - // insertion points of the parent's ShadowRoot. - ShadowRoot* parentShadowRoot = GetParent()->GetShadowRoot(); - if (parentShadowRoot) { - parentShadowRoot->DistributeSingleNode(aContent); - return; - } - - // Handle the case where the parent of this shadow element is a ShadowRoot - // that is projected into a shadow insertion point in the younger ShadowRoot. - ShadowRoot* containingShadow = GetContainingShadow(); - ShadowRoot* youngerShadow = containingShadow->GetYoungerShadowRoot(); - if (youngerShadow && GetParent() == containingShadow) { - HTMLShadowElement* youngerShadowElement = youngerShadow->GetShadowElement(); - if (youngerShadowElement) { - youngerShadowElement->DistributeSingleNode(aContent); - } - } -} - -void -HTMLShadowElement::RemoveDistributedNode(nsIContent* aContent) -{ - ShadowRoot::RemoveDestInsertionPoint(this, aContent->DestInsertionPoints()); - - // Handle the case where the shadow element is a child of - // a node with a ShadowRoot. The nodes that have been distributed to - // this shadow insertion point will need to be removed from the - // insertion points of the parent's ShadowRoot. - ShadowRoot* parentShadowRoot = GetParent()->GetShadowRoot(); - if (parentShadowRoot) { - parentShadowRoot->RemoveDistributedNode(aContent); - return; - } - - // Handle the case where the parent of this shadow element is a ShadowRoot - // that is projected into a shadow insertion point in the younger ShadowRoot. - ShadowRoot* containingShadow = GetContainingShadow(); - ShadowRoot* youngerShadow = containingShadow->GetYoungerShadowRoot(); - if (youngerShadow && GetParent() == containingShadow) { - HTMLShadowElement* youngerShadowElement = youngerShadow->GetShadowElement(); - if (youngerShadowElement) { - youngerShadowElement->RemoveDistributedNode(aContent); - } - } -} - -void -HTMLShadowElement::DistributeAllNodes() -{ - // All the explicit children of the projected ShadowRoot are distributed - // into this shadow insertion point so update the destination insertion - // points. - ShadowRoot* containingShadow = GetContainingShadow(); - ShadowRoot* olderShadow = containingShadow->GetOlderShadowRoot(); - if (olderShadow) { - ExplicitChildIterator childIterator(olderShadow); - for (nsIContent* content = childIterator.GetNextChild(); - content; - content = childIterator.GetNextChild()) { - ShadowRoot::RemoveDestInsertionPoint(this, content->DestInsertionPoints()); - content->DestInsertionPoints().AppendElement(this); - } - } - - // Handle the case where the shadow element is a child of - // a node with a ShadowRoot. The nodes that have been distributed to - // this shadow insertion point will need to be reprojected into the - // insertion points of the parent's ShadowRoot. - ShadowRoot* parentShadowRoot = GetParent()->GetShadowRoot(); - if (parentShadowRoot) { - parentShadowRoot->DistributeAllNodes(); - return; - } - - // Handle the case where the parent of this shadow element is a ShadowRoot - // that is projected into a shadow insertion point in the younger ShadowRoot. - ShadowRoot* youngerShadow = containingShadow->GetYoungerShadowRoot(); - if (youngerShadow && GetParent() == containingShadow) { - HTMLShadowElement* youngerShadowElement = youngerShadow->GetShadowElement(); - if (youngerShadowElement) { - youngerShadowElement->DistributeAllNodes(); - } - } -} - -void -HTMLShadowElement::ContentAppended(nsIDocument* aDocument, - nsIContent* aContainer, - nsIContent* aFirstNewContent, - int32_t aNewIndexInContainer) -{ - // Watch for content appended to the projected shadow (the ShadowRoot that - // will be rendered in place of this shadow insertion point) because the - // nodes may need to be distributed into other insertion points. - nsIContent* currentChild = aFirstNewContent; - while (currentChild) { - if (ShadowRoot::IsPooledNode(currentChild, aContainer, mProjectedShadow)) { - DistributeSingleNode(currentChild); - } - currentChild = currentChild->GetNextSibling(); - } -} - -void -HTMLShadowElement::ContentInserted(nsIDocument* aDocument, - nsIContent* aContainer, - nsIContent* aChild, - int32_t aIndexInContainer) -{ - // Watch for content appended to the projected shadow (the ShadowRoot that - // will be rendered in place of this shadow insertion point) because the - // nodes may need to be distributed into other insertion points. - if (!ShadowRoot::IsPooledNode(aChild, aContainer, mProjectedShadow)) { - return; - } - - DistributeSingleNode(aChild); -} - -void -HTMLShadowElement::ContentRemoved(nsIDocument* aDocument, - nsIContent* aContainer, - nsIContent* aChild, - int32_t aIndexInContainer, - nsIContent* aPreviousSibling) -{ - // Watch for content removed from the projected shadow (the ShadowRoot that - // will be rendered in place of this shadow insertion point) because the - // nodes may need to be removed from other insertion points. - if (!ShadowRoot::IsPooledNode(aChild, aContainer, mProjectedShadow)) { - return; - } - - RemoveDistributedNode(aChild); -} - diff --git a/dom/html/HTMLShadowElement.h b/dom/html/HTMLShadowElement.h deleted file mode 100644 index 95083b802f..0000000000 --- a/dom/html/HTMLShadowElement.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- 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 mozilla_dom_HTMLShadowElement_h__ -#define mozilla_dom_HTMLShadowElement_h__ - -#include "nsGenericHTMLElement.h" - -namespace mozilla { -namespace dom { - -class HTMLShadowElement final : public nsGenericHTMLElement, - public nsStubMutationObserver -{ -public: - explicit HTMLShadowElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED - NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED - NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED - - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLShadowElement, - nsGenericHTMLElement) - - static HTMLShadowElement* FromContent(nsIContent* aContent) - { - if (aContent->IsHTMLShadowElement()) { - return static_cast<HTMLShadowElement*>(aContent); - } - - return nullptr; - } - - virtual bool IsHTMLShadowElement() const override { return true; } - - virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override; - - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, - bool aCompileEventHandlers) override; - - virtual void UnbindFromTree(bool aDeep = true, - bool aNullParent = true) override; - - bool IsInsertionPoint() { return mIsInsertionPoint; } - - /** - * Sets the ShadowRoot that will be rendered in place of - * this shadow insertion point. - */ - void SetProjectedShadow(ShadowRoot* aProjectedShadow); - - /** - * Distributes a single explicit child of the projected ShadowRoot - * to relevant insertion points. - */ - void DistributeSingleNode(nsIContent* aContent); - - /** - * Removes a single explicit child of the projected ShadowRoot - * from relevant insertion points. - */ - void RemoveDistributedNode(nsIContent* aContent); - - /** - * Distributes all the explicit children of the projected ShadowRoot - * to the shadow insertion point in the younger ShadowRoot and - * the content insertion point of the parent node's ShadowRoot. - */ - void DistributeAllNodes(); - - // WebIDL methods. - ShadowRoot* GetOlderShadowRoot() { return mProjectedShadow; } - -protected: - virtual ~HTMLShadowElement(); - - virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; - - // The ShadowRoot that will be rendered in place of this shadow insertion point. - RefPtr<ShadowRoot> mProjectedShadow; - - bool mIsInsertionPoint; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_HTMLShadowElement_h__ - diff --git a/dom/html/moz.build b/dom/html/moz.build index c86c169b5c..1ccc630fdb 100644 --- a/dom/html/moz.build +++ b/dom/html/moz.build @@ -92,7 +92,6 @@ EXPORTS.mozilla.dom += [ 'HTMLProgressElement.h', 'HTMLScriptElement.h', 'HTMLSelectElement.h', - 'HTMLShadowElement.h', 'HTMLSharedElement.h', 'HTMLSharedListElement.h', 'HTMLSharedObjectElement.h', @@ -172,7 +171,6 @@ UNIFIED_SOURCES += [ 'HTMLProgressElement.cpp', 'HTMLScriptElement.cpp', 'HTMLSelectElement.cpp', - 'HTMLShadowElement.cpp', 'HTMLSharedElement.cpp', 'HTMLSharedListElement.cpp', 'HTMLSharedObjectElement.cpp', diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 16f438acc0..3b451b29cd 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -1700,7 +1700,6 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre) NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress) NS_DECLARE_NS_NEW_HTML_ELEMENT(Script) NS_DECLARE_NS_NEW_HTML_ELEMENT(Select) -NS_DECLARE_NS_NEW_HTML_ELEMENT(Shadow) NS_DECLARE_NS_NEW_HTML_ELEMENT(Source) NS_DECLARE_NS_NEW_HTML_ELEMENT(Span) NS_DECLARE_NS_NEW_HTML_ELEMENT(Style) diff --git a/dom/html/nsGenericHTMLFrameElement.cpp b/dom/html/nsGenericHTMLFrameElement.cpp index 03e6ffb421..8170179e2c 100644 --- a/dom/html/nsGenericHTMLFrameElement.cpp +++ b/dom/html/nsGenericHTMLFrameElement.cpp @@ -27,6 +27,7 @@ #include "nsServiceManagerUtils.h" #include "nsSubDocumentFrame.h" #include "nsXULElement.h" +#include "nsAttrValueOrString.h" using namespace mozilla; using namespace mozilla::dom; diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp index 1c390a53ec..eb22b772f9 100644 --- a/dom/html/nsHTMLContentSink.cpp +++ b/dom/html/nsHTMLContentSink.cpp @@ -31,6 +31,7 @@ #include "mozilla/Logging.h" #include "nsNodeUtils.h" #include "nsIContent.h" +#include "mozilla/dom/CustomElementRegistry.h" #include "mozilla/dom/Element.h" #include "mozilla/Preferences.h" diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini index f5d0f84ea9..756e6f2ae1 100644 --- a/dom/tests/mochitest/webcomponents/mochitest.ini +++ b/dom/tests/mochitest/webcomponents/mochitest.ini @@ -25,7 +25,6 @@ skip-if = true || stylo # disabled - See bug 1390396 and 1293844 skip-if = !debug # TestFunctions only applied in debug builds [test_nested_content_element.html] [test_dest_insertion_points.html] -[test_dest_insertion_points_shadow.html] [test_fallback_dest_insertion_points.html] [test_detached_style.html] [test_dynamic_content_element_matching.html] @@ -38,7 +37,6 @@ skip-if = true # disabled - See bug 1390396 [test_document_register_stack.html] skip-if = true # disabled - See bug 1390396 [test_document_shared_registry.html] -[test_event_dispatch.html] [test_event_retarget.html] [test_event_stopping.html] [test_template.html] @@ -46,11 +44,8 @@ skip-if = true # disabled - See bug 1390396 [test_template_custom_elements.html] [test_shadowroot.html] [test_shadowroot_inert_element.html] -[test_shadowroot_host.html] [test_shadowroot_style.html] -[test_shadowroot_style_multiple_shadow.html] [test_shadowroot_style_order.html] -[test_shadowroot_youngershadowroot.html] [test_style_fallback_content.html] [test_unresolved_pseudo_class.html] [test_link_prefetch.html] diff --git a/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html deleted file mode 100644 index 75286463e6..0000000000 --- a/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html +++ /dev/null @@ -1,68 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=999999 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 999999</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=999999">Mozilla Bug 999999</a> -<p id="display"></p> -<div id="content"> -<div id="shadowhost"></div> -</div> -<pre id="test"> -</pre> -<script type="application/javascript"> - -/** Test for Bug 999999 **/ -var host = document.getElementById("shadowhost"); - -// Test destination insertion points of node distributed to shadow element. -var olderShadowRoot = host.createShadowRoot(); -var youngerShadowRoot = host.createShadowRoot(); - -var shadowElem = document.createElement("shadow"); -youngerShadowRoot.appendChild(shadowElem); - -var span = document.createElement("span"); -olderShadowRoot.appendChild(span); - -is(span.getDestinationInsertionPoints().length, 1, "Child of ShadowRoot should be distributed to shadow insertion point."); -is(span.getDestinationInsertionPoints()[0], shadowElem, "Shadow element should be in destination insertion point list."); - -// Test destination insertion points of node removed from tree. -olderShadowRoot.removeChild(span); -is(span.getDestinationInsertionPoints().length, 0, "Node removed from tree should no longer be distributed."); - -// Test destination insertion points of fallback content being reprojected into a shadow element. -var content = document.createElement("content"); -var fallback = document.createElement("span"); - -content.appendChild(fallback); -olderShadowRoot.appendChild(content); - -is(fallback.getDestinationInsertionPoints().length, 2, "The fallback content should have 2 destination insertion points, the parent content and the shadow element to which it is reprojected."); -is(fallback.getDestinationInsertionPoints()[0], content, "First destination of the fallback content should be the parent content element."); -is(fallback.getDestinationInsertionPoints()[1], shadowElem, "Second destination of the fallback content should be the shadow element to which the element is reprojected."); - -// Test destination insertion points of fallback content being removed from tree. -content.removeChild(fallback); -is(fallback.getDestinationInsertionPoints().length, 0, "The content should no longer be distributed to any nodes because it is no longer fallback content."); - -// Test destination insertion points of distributed content after removing shadow insertion point. -var div = document.createElement("div"); -olderShadowRoot.appendChild(div); -is(div.getDestinationInsertionPoints().length, 1, "Children in older shadow root should be distributed to shadow insertion point."); -is(div.getDestinationInsertionPoints()[0], shadowElem, "Destination insertion point should include shadow element."); - -youngerShadowRoot.removeChild(shadowElem); -is(div.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after removing shadow element."); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_event_dispatch.html b/dom/tests/mochitest/webcomponents/test_event_dispatch.html deleted file mode 100644 index c73bfb214e..0000000000 --- a/dom/tests/mochitest/webcomponents/test_event_dispatch.html +++ /dev/null @@ -1,458 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=887541 ---> -<head> - <title>Test for event model in web components</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887541">Bug 887541</a> -<script> - -var els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"] - .getService(SpecialPowers.Ci.nsIEventListenerService); - -function eventListener(e) { - eventChain.push(this); -} - -function isEventChain(actual, expected, msg) { - is(actual.length, expected.length, msg); - for (var i = 0; i < expected.length; i++) { - is(actual[i], expected[i], msg + " at " + i); - } - - // Check to make sure the event chain matches what we get back from nsIEventListenerService.getEventTargetChainFor - if (0 < actual.length) { - var chain = els.getEventTargetChainFor(actual[0], true); // Events should be dispatched on actual[0]. - for (var i = 0; i < expected.length; i++) { - ok(SpecialPowers.compare(chain[i], expected[i]), msg + " at " + i + " for nsIEventListenerService"); - } - } -} - -/* - * Test 1: Test of event dispatch through a basic ShadowRoot with content a insertion point. - * - * <div elemOne> ------ <shadow-root shadowOne> - * | | - * <div elemTwo> <span elemThree> - * | - * <content elemFour> - */ - -var elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -var elemTwo = document.createElement("div"); -elemTwo.addEventListener("custom", eventListener); - -var elemThree = document.createElement("span"); -elemThree.addEventListener("custom", eventListener); - -var elemFour = document.createElement("content"); -elemFour.addEventListener("custom", eventListener); - -var shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemThree.appendChild(elemFour); -shadowOne.appendChild(elemThree); -elemOne.appendChild(elemTwo); - -var eventChain = []; -var customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemFour, elemThree, shadowOne, elemOne], "Event path for test 1 for event dispatched on elemTwo."); - -/* - * Test 2: Test of event dispatch through a nested ShadowRoots with content insertion points. - * - * <div elemFive> --- <shadow-root shadowTwo> - * | | - * <div elemOne> <div elemFour> ----- <shadow-root shadowOne> - * | | - * <content elemTwo> <p elemSix> - * | - * <content elemThree> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("content"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("content"); -elemThree.addEventListener("custom", eventListener); - -var elemFour = document.createElement("div"); -elemFour.addEventListener("custom", eventListener); - -var elemFive = document.createElement("div"); -elemFive.addEventListener("custom", eventListener); - -var elemSix = document.createElement("p"); -elemSix.addEventListener("custom", eventListener); - -var shadowOne = elemFour.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -var shadowTwo = elemFive.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -elemFive.appendChild(elemOne); -shadowTwo.appendChild(elemFour); -elemFour.appendChild(elemTwo); -shadowOne.appendChild(elemSix); -elemSix.appendChild(elemThree); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemOne.dispatchEvent(customEvent); -is(elemOne.getDestinationInsertionPoints().length, 2, "yes"); -isEventChain(eventChain, [elemOne, elemThree, elemSix, shadowOne, elemTwo, elemFour, shadowTwo, elemFive], "Event path for test 2 for event dispatched on elemOne."); - -/* - * Test 3: Test of event dispatch through nested ShadowRoot with content insertion points. - * - * <div elemOne> ------- <shadow-root shadowOne> - * | | - * <span elemTwo> <span elemThree> ------------ <shadow-root shadowTwo> - * | | - * <span elemFour> <content elemSix> - * | - * <content elemFive> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("span"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -shadowTwo = elemThree.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -shadowOne.appendChild(elemThree); -elemThree.appendChild(elemFour); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemSix); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemFive, elemFour, elemSix, shadowTwo, elemThree, shadowOne, elemOne], "Event path for test 3 for event dispatched on elemTwo."); - -/* - * Test 4: Test of event dispatch through host with multiple ShadowRoots with shadow insertion point. - * - * <div elemSeven> --- <shadow-root shadowTwo> (younger ShadowRoot) - * | | | - * <div elemOne> | <div elemSix> -------- <shadow-root shadowOne> - * | | | - * | <shadow elemFour> <content elemFive> - * | | - * | <content elemTwo> - * | - * --- <shadow-root shadowThree> (older ShadowRoot) - * | | - * | <content elemThree> - * | - * <div elemEight> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("content"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("content"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("shadow"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("div"); -elemSix.addEventListener("custom", eventListener); - -var elemSeven = document.createElement("div"); -elemSeven.addEventListener("custom", eventListener); - -var elemEight = document.createElement("div"); -elemEight.addEventListener("custom", eventListener); - -var shadowThree = elemSeven.createShadowRoot(); -shadowThree.addEventListener("custom", eventListener); - -shadowTwo = elemSeven.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemSix.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemSeven.appendChild(elemOne); -shadowTwo.appendChild(elemSix); -elemSix.appendChild(elemFour); -elemFour.appendChild(elemTwo); -shadowThree.appendChild(elemEight); -shadowThree.appendChild(elemThree); -shadowOne.appendChild(elemFive); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemOne.dispatchEvent(customEvent); -isEventChain(eventChain, [elemOne, elemFive, shadowOne, elemThree, shadowThree, elemTwo, elemFour, elemSix, shadowTwo, elemSeven], "Event path for test 4 for event dispatched on elemOne."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemEight.dispatchEvent(customEvent); -isEventChain(eventChain, [elemEight, elemFive, shadowOne, elemSix, shadowTwo, elemSeven], "Event path for test 4 for event dispatched on elemEight."); - -/* - * Test 5: Test of event dispatch through nested shadowroot with insertion points that match specific tags. - * - * <div elemOne> --------- <shadow-root shadowOne> - * | | | - * | <p elemThree> <span elemFour> ------------------------ <shadow-root shadowTwo> - * | | | | - * <span elemTwo> | <content select="p" elemFive> <content elemSeven> - * | - * <content select="span" elemSix> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("p"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.select = "p"; -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.select = "span"; -elemSix.addEventListener("custom", eventListener); - -elemSeven = document.createElement("content"); -elemSeven.addEventListener("custom", eventListener); - -shadowTwo = elemFour.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -elemOne.appendChild(elemThree); -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemSix); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemSeven); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemSeven, shadowTwo, elemSix, elemFour, shadowOne, elemOne], "Event path for test 5 for event dispatched on elemTwo."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, elemSeven, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 5 for event dispatched on elemThree."); - -/* - * Test 6: Test of event dispatch through nested shadowroot with insertion points that match specific tags. - * - * <div elemOne> --------- <shadow-root shadowOne>; - * | | | - * | <p elemThree> <span elemFour> ------ <shadow-root shadowTwo> - * | | | | - * <span elemTwo> <content elemFive> | <content select="p" elemSeven> - * | - * <content select="span" elemSix> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("p"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.select = "span"; -elemSix.addEventListener("custom", eventListener); - -elemSeven = document.createElement("content"); -elemSeven.select = "p"; -elemSeven.addEventListener("custom", eventListener); - -shadowTwo = elemFour.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -elemOne.appendChild(elemThree); -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemSix); -shadowTwo.appendChild(elemSeven); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemSix, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 6 for event dispatched on elemTwo."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, elemSeven, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 6 for event dispatched on elemThree."); - -/* - * Test 7: Test of event dispatch through nested shadowroot with insertion points that match specific tags. - * - * <div elemOne> --------- <shadow-root shadowOne> - * | | | - * | <p elemThree> <span elemFour> ------ <shadow-root shadowTwo> - * | | | - * <span elemTwo> <content elemFive> <span elemEight> - * | | - * | <content select="p" elemSeven> - * | - * <content select="span" elemSix> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("p"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.select = "span"; -elemSix.addEventListener("custom", eventListener); - -elemSeven = document.createElement("content"); -elemSeven.select = "p"; -elemSeven.addEventListener("custom", eventListener); - -elemEight = document.createElement("span"); -elemEight.addEventListener("custom", eventListener); - -shadowTwo = elemFour.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -elemOne.appendChild(elemThree); -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemEight); -elemEight.appendChild(elemSix); -elemEight.appendChild(elemSeven); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemSix, elemEight, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 7 for event dispatched on elemTwo."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, elemSeven, elemEight, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 7 for event dispatched on elemThree."); - -/* - * Test 8: Test of event dispatch through host with multiple ShadowRoots with shadow insertion point. - * - * <div elemOne> --- <shadow-root shadowOne> (younger ShadowRoot) - * | | - * | <div elemFour> - * | | - * | <shadow elemTwo> - * | - * --- <shadow-root shadowTwo> (older ShadowRoot) - * | - * <div elemThree> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("shadow"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("div"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("div"); -elemFour.addEventListener("custom", eventListener); - -shadowTwo = elemOne.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemTwo); -shadowTwo.appendChild(elemThree); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, shadowTwo, elemTwo, elemFour, shadowOne, elemOne], "Event path for test 8 for event dispatched on elemThree."); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_host.html b/dom/tests/mochitest/webcomponents/test_shadowroot_host.html deleted file mode 100644 index f48d63e87d..0000000000 --- a/dom/tests/mochitest/webcomponents/test_shadowroot_host.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1083587 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 1083587</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1083587">Mozilla Bug 1083587</a> -<p id="display"></p> -<div id="content" style="display: none"> -<div id="host"></div> -</div> -<pre id="test"> -</pre> -<script type="application/javascript"> - -/** Test for Bug 1083587 **/ -var hostInDoc = document.getElementById("host"); -var shadowOne = hostInDoc.createShadowRoot(); -is(shadowOne.host, hostInDoc); - -var shadowTwo = hostInDoc.createShadowRoot(); -is(shadowOne.host, hostInDoc); -is(shadowTwo.host, hostInDoc); - -var hostNotInDoc = document.createElement("div"); -var shadowThree = hostNotInDoc.createShadowRoot(); -is(shadowThree.host, hostNotInDoc); - -var shadowFour = hostNotInDoc.createShadowRoot(); -is(shadowThree.host, hostNotInDoc); -is(shadowFour.host, hostNotInDoc); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html deleted file mode 100644 index 7a606bcd7f..0000000000 --- a/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=806506 ---> -<head> - <title>Test for ShadowRoot styles with multiple ShadowRoot on host.</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<div class="tall" id="bodydiv"></div> -<div id="container"></div> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a> -<script> -// Create ShadowRoot. -var container = document.getElementById("container"); -var elem = document.createElement("div"); -container.appendChild(elem); // Put ShadowRoot host in document. -var firstRoot = elem.createShadowRoot(); -var secondRoot = elem.createShadowRoot(); -var thirdRoot = elem.createShadowRoot(); - -// A style element that will be appended into the ShadowRoot. -var firstStyle = document.createElement("style"); -firstRoot.appendChild(firstStyle); -is(firstRoot.styleSheets.length, 1, "firstStyle should be the only style in firstRoot."); -is(firstRoot.styleSheets[0].ownerNode, firstStyle, "firstStyle should in the ShadowRoot styleSheets."); - -var secondStyle = document.createElement("style"); -secondRoot.appendChild(secondStyle); -is(secondRoot.styleSheets.length, 1, "secondStyle should be the only style in secondRoot."); -is(secondRoot.styleSheets[0].ownerNode, secondStyle, "secondStyle should in the ShadowRoot styleSheets."); - -var thirdStyle = document.createElement("style"); -thirdRoot.appendChild(thirdStyle); -is(thirdRoot.styleSheets.length, 1, "thirdStyle should be the only style in thirdRoot."); -is(thirdRoot.styleSheets[0].ownerNode, thirdStyle, "thirdStyle should in the ShadowRoot styleSheets."); - -// Check the stylesheet counts again to make sure that none of the style sheets leaked into the older ShadowRoots. -is(firstRoot.styleSheets.length, 1, "Adding a stylesheet to a younger ShadowRoot should not affect stylesheets in the older ShadowRoot."); -is(secondRoot.styleSheets.length, 1, "Adding a stylesheet to a younger ShadowRoot should not affect stylesheets in the older ShadowRoot."); - -// Remove styles and make sure they are removed from the correct ShadowRoot. -firstRoot.removeChild(firstStyle); -is(firstRoot.styleSheets.length, 0, "firstRoot should no longer have any styles."); - -thirdRoot.removeChild(thirdStyle); -is(thirdRoot.styleSheets.length, 0, "thirdRoot should no longer have any styles."); - -secondRoot.removeChild(secondStyle); -is(secondRoot.styleSheets.length, 0, "secondRoot should no longer have any styles."); - -</script> -</body> -</html> - diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html b/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html deleted file mode 100644 index 17743321bc..0000000000 --- a/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1083587 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 1083587</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1083587">Mozilla Bug 1083587</a> -<p id="display"></p> -<div id="content" style="display: none"> -<div id="host"></div> -</div> -<pre id="test"> -</pre> -<script type="application/javascript"> - -/** Test for Bug 1083587 **/ -var hostInDoc = document.getElementById("host"); -var shadowOne = hostInDoc.createShadowRoot(); -is(shadowOne.olderShadowRoot, null); - -var shadowTwo = hostInDoc.createShadowRoot(); -is(shadowOne.olderShadowRoot, null); -is(shadowTwo.olderShadowRoot, shadowOne); - -var hostNotInDoc = document.createElement("div"); -var shadowThree = hostNotInDoc.createShadowRoot(); -is(shadowThree.olderShadowRoot, null); - -var shadowFour = hostNotInDoc.createShadowRoot(); -is(shadowThree.olderShadowRoot, null); -is(shadowFour.olderShadowRoot, shadowThree); - -</script> -</body> -</html> diff --git a/dom/webidl/HTMLShadowElement.webidl b/dom/webidl/HTMLShadowElement.webidl deleted file mode 100644 index f72cd06e18..0000000000 --- a/dom/webidl/HTMLShadowElement.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html - * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and - * Opera Software ASA. You are granted a license to use, reproduce - * and create derivative works of this document. - */ - -[Func="nsDocument::IsWebComponentsEnabled"] -interface HTMLShadowElement : HTMLElement -{ - readonly attribute ShadowRoot? olderShadowRoot; -}; - diff --git a/dom/webidl/ShadowRoot.webidl b/dom/webidl/ShadowRoot.webidl index 8dd069244c..90e6b64676 100644 --- a/dom/webidl/ShadowRoot.webidl +++ b/dom/webidl/ShadowRoot.webidl @@ -20,7 +20,6 @@ interface ShadowRoot : DocumentFragment [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString innerHTML; readonly attribute Element host; - readonly attribute ShadowRoot? olderShadowRoot; attribute boolean applyAuthorStyles; readonly attribute StyleSheetList styleSheets; }; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 156da302dd..dba8e2818e 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -226,7 +226,6 @@ WEBIDL_FILES = [ 'HTMLQuoteElement.webidl', 'HTMLScriptElement.webidl', 'HTMLSelectElement.webidl', - 'HTMLShadowElement.webidl', 'HTMLSourceElement.webidl', 'HTMLSpanElement.webidl', 'HTMLStyleElement.webidl', diff --git a/editor/libeditor/HTMLEditUtils.cpp b/editor/libeditor/HTMLEditUtils.cpp index 5cdad2e9e9..7933637fe8 100644 --- a/editor/libeditor/HTMLEditUtils.cpp +++ b/editor/libeditor/HTMLEditUtils.cpp @@ -727,7 +727,6 @@ static const ElementInfo kElements[eHTMLTag_userdefined] = { GROUP_LEAF), ELEM(section, true, true, GROUP_BLOCK, GROUP_FLOW_ELEMENT), ELEM(select, true, false, GROUP_FORMCONTROL, GROUP_SELECT_CONTENT), - ELEM(shadow, true, false, GROUP_NONE, GROUP_INLINE_ELEMENT), ELEM(small, true, true, GROUP_FONTSTYLE, GROUP_INLINE_ELEMENT), ELEM(source, false, false, GROUP_PICTURE_CONTENT, GROUP_NONE), ELEM(span, true, true, GROUP_SPECIAL, GROUP_INLINE_ELEMENT), diff --git a/layout/reftests/css-display/display-contents-shadow-dom-1-ref.html b/layout/reftests/css-display/display-contents-shadow-dom-1-ref.html index f57822901d..6e6dad2331 100644 --- a/layout/reftests/css-display/display-contents-shadow-dom-1-ref.html +++ b/layout/reftests/css-display/display-contents-shadow-dom-1-ref.html @@ -45,8 +45,6 @@ span { color:blue; } <span style="color:green">R</span> <div></div> <b style="color:green">V</b> - <b style="color:green">W</b> - <b style="color:green">X</b> <!-- <b style="color:green">Y</b> --> </body> </html> diff --git a/layout/reftests/css-display/display-contents-shadow-dom-1.html b/layout/reftests/css-display/display-contents-shadow-dom-1.html index f5e49a192a..40f67baf55 100644 --- a/layout/reftests/css-display/display-contents-shadow-dom-1.html +++ b/layout/reftests/css-display/display-contents-shadow-dom-1.html @@ -51,8 +51,6 @@ div.after::after {content: " Y";} <div id="hostT" class="c">T</div> <div id="hostU"><span class="c">U</span></div> <div id="hostV" class="c" style="color:red"><b class="c" style="color:inherit">V</b></div> - <div id="hostW" class="c" style="color:red"><b class="c" style="color:inherit">W</b></div> - <span id="hostX" style="color:red"><b class="c" style="color:inherit">X</b></span> <!-- TODO(bug 1021572?) <div id="hostY" class="c" style="color:red"><b>Y</b></div> --> <script> @@ -105,8 +103,6 @@ div.after::after {content: " Y";} shadow("hostP").innerHTML = '<content select="b"></content><content select="i"></content>'; shadow("hostQ").innerHTML = '<content select="b"></content><content select="i"></content>'; shadow("hostR").innerHTML = '<content select="span"></content>'; - shadow("hostW").innerHTML = '<z style="color:red"><content select="b"></content></z>'; - shadow("hostX").innerHTML = '<z style="color:red"><content select="b"></content></z>'; // TODO(bug 1021572?) shadow("hostY").innerHTML = '<content select="b"><style scoped>:scope{color:green}</style></content>'; function tweak() { @@ -222,8 +218,6 @@ div.after::after {content: " Y";} shadow("hostT"); shadow("hostU"); shadow("hostV").innerHTML = '<z style="color:green"><content select="b"></content></z>'; - shadow("hostW").innerHTML = '<z style="color:green"><content select="b"></content></z>'; - shadow("hostX").innerHTML = '<z style="color:green"><content select="b"></content></z>'; document.body.offsetHeight; document.documentElement.removeAttribute("class"); diff --git a/layout/reftests/webcomponents/adjacent-insertion-points-1-ref.html b/layout/reftests/webcomponents/adjacent-insertion-points-1-ref.html deleted file mode 100644 index 2c1f4e3419..0000000000 --- a/layout/reftests/webcomponents/adjacent-insertion-points-1-ref.html +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE HTML> -<html> -<body> -<div><span>Hello</span><span>World</span></div> -</body> -</html> diff --git a/layout/reftests/webcomponents/adjacent-insertion-points-1.html b/layout/reftests/webcomponents/adjacent-insertion-points-1.html deleted file mode 100644 index a8c6f983dc..0000000000 --- a/layout/reftests/webcomponents/adjacent-insertion-points-1.html +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <script> - function tweak() { - var oldShadowRoot = document.getElementById('outer').createShadowRoot(); - oldShadowRoot.innerHTML = 'World'; - - var youngShadowRoot = document.getElementById('outer').createShadowRoot(); - youngShadowRoot.innerHTML = 'Hello<content></content><shadow></shadow>'; - } - </script> -</head> -<body onload="tweak()"> -<div id="outer"></div> -</body> -</html> diff --git a/layout/reftests/webcomponents/adjacent-insertion-points-2-ref.html b/layout/reftests/webcomponents/adjacent-insertion-points-2-ref.html deleted file mode 100644 index 2c1f4e3419..0000000000 --- a/layout/reftests/webcomponents/adjacent-insertion-points-2-ref.html +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE HTML> -<html> -<body> -<div><span>Hello</span><span>World</span></div> -</body> -</html> diff --git a/layout/reftests/webcomponents/adjacent-insertion-points-2.html b/layout/reftests/webcomponents/adjacent-insertion-points-2.html deleted file mode 100644 index f90cb206bb..0000000000 --- a/layout/reftests/webcomponents/adjacent-insertion-points-2.html +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <script> - function tweak() { - var oldShadowRoot = document.getElementById('outer').createShadowRoot(); - oldShadowRoot.innerHTML = 'Hello'; - - var youngShadowRoot = document.getElementById('outer').createShadowRoot(); - youngShadowRoot.innerHTML = '<shadow></shadow><content></content>World'; - } - </script> -</head> -<body onload="tweak()"> -<div id="outer"></div> -</body> -</html> diff --git a/layout/reftests/webcomponents/basic-shadow-element-1-ref.html b/layout/reftests/webcomponents/basic-shadow-element-1-ref.html deleted file mode 100644 index a47b9362a3..0000000000 --- a/layout/reftests/webcomponents/basic-shadow-element-1-ref.html +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> -</head> -<body> -<div> - <div style="width:100px; height:100px; background-color:green"></div><div style="width:100px; height:100px; background-color:orange">Hello World</div> -</div> -</body> -</html> diff --git a/layout/reftests/webcomponents/basic-shadow-element-1.html b/layout/reftests/webcomponents/basic-shadow-element-1.html deleted file mode 100644 index e51bd8b722..0000000000 --- a/layout/reftests/webcomponents/basic-shadow-element-1.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <script> - function tweak() { - var olderShadow = document.getElementById('outer').createShadowRoot(); - olderShadow.innerHTML = '<div style="width:100px; height:100px; background-color: orange"><content></content></div>'; - - var youngerShadow = document.getElementById('outer').createShadowRoot(); - youngerShadow.innerHTML = '<div style="width:100px; height:100px; background-color: green"></div><shadow>Hello World</shadow>'; - } - </script> -</head> -<body onload="tweak()"> -<div id="outer"> - <div style="width:300px; height:100px; background-color:red;"></div> -</div> -</body> -</html> diff --git a/layout/reftests/webcomponents/nested-shadow-element-1.html b/layout/reftests/webcomponents/nested-shadow-element-1.html deleted file mode 100644 index cfaad3d490..0000000000 --- a/layout/reftests/webcomponents/nested-shadow-element-1.html +++ /dev/null @@ -1,29 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <script> - function tweak() { - var olderShadow = document.getElementById('outer').createShadowRoot(); - olderShadow.innerHTML = '<content></content><span>World</span>'; - - var youngerShadow = document.getElementById('outer').createShadowRoot(); - youngerShadow.innerHTML = '<div id="shadowparent"><shadow id="youngshadow"><span>Hello</span></shadow></div>'; - - var shadowParent = youngerShadow.getElementById("shadowparent"); - var nestedShadow = shadowParent.createShadowRoot(); - nestedShadow.innerHTML = '<div style="background-color: green"><content></content></div>'; - - // Dynamically append a span to the shadow element in the younger ShadowRoot to make sure - // it is projected into the nested shadow. - var appendedSpan = document.createElement("span"); - appendedSpan.textContent = ' '; - youngerShadow.getElementById("youngshadow").appendChild(appendedSpan); - } - </script> -</head> -<body onload="tweak()"> -<div id="outer"> - <div style="width:300px; height:100px; background-color:red;"></div> -</div> -</body> -</html> diff --git a/layout/reftests/webcomponents/reftest.list b/layout/reftests/webcomponents/reftest.list index beba21b18c..e0a30a520b 100644 --- a/layout/reftests/webcomponents/reftest.list +++ b/layout/reftests/webcomponents/reftest.list @@ -5,13 +5,9 @@ pref(dom.webcomponents.enabled,true) == basic-shadow-3.html basic-shadow-3-ref.h pref(dom.webcomponents.enabled,true) == basic-shadow-4.html basic-shadow-4-ref.html pref(dom.webcomponents.enabled,true) == basic-insertion-point-1.html basic-insertion-point-1-ref.html pref(dom.webcomponents.enabled,true) == basic-insertion-point-2.html basic-insertion-point-2-ref.html -pref(dom.webcomponents.enabled,true) == adjacent-insertion-points-1.html adjacent-insertion-points-1-ref.html -pref(dom.webcomponents.enabled,true) == adjacent-insertion-points-2.html adjacent-insertion-points-2-ref.html pref(dom.webcomponents.enabled,true) == fallback-content-1.html fallback-content-1-ref.html pref(dom.webcomponents.enabled,true) == remove-insertion-point-1.html remove-insertion-point-1-ref.html pref(dom.webcomponents.enabled,true) == nested-insertion-point-1.html nested-insertion-point-1-ref.html -pref(dom.webcomponents.enabled,true) == basic-shadow-element-1.html basic-shadow-element-1-ref.html -pref(dom.webcomponents.enabled,true) == nested-shadow-element-1.html nested-shadow-element-1-ref.html pref(dom.webcomponents.enabled,true) == update-dist-node-descendants-1.html update-dist-node-descendants-1-ref.html pref(dom.webcomponents.enabled,true) == input-transition-1.html input-transition-1-ref.html pref(dom.webcomponents.enabled,true) == dynamic-insertion-point-distribution-1.html dynamic-insertion-point-distribution-1-ref.html diff --git a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java index 4e1acea502..b8e1b944cc 100644 --- a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java +++ b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java @@ -2215,10 +2215,6 @@ public final class ElementName // CPPONLY: NS_NewHTMLUnknownElement, // CPPONLY: NS_NewSVGUnknownElement, TreeBuilder.OTHER); - public static final ElementName SHADOW = new ElementName("shadow", "shadow", - // CPPONLY: NS_NewHTMLShadowElement, - // CPPONLY: NS_NewSVGUnknownElement, - TreeBuilder.OTHER); public static final ElementName VIEW = new ElementName("view", "view", // CPPONLY: NS_NewHTMLUnknownElement, // CPPONLY: NS_NewSVGViewElement, @@ -2274,19 +2270,19 @@ public final class ElementName private final static @NoLength ElementName[] ELEMENT_NAMES = { VKERN, LOGBASE, - FIELDSET, + FOREIGNOBJECT, DATA, LI, - COMPLEXES, - QUOTIENT, + CANVAS, + TT, PRE, ARTICLE, DIALOG, ARCTAN, LISTENER, - RATIONALS, - MROOT, - MATRIXROW, + REALS, + MOMENT, + MROW, GEQ, G, DD, @@ -2296,12 +2292,12 @@ public final class ElementName INTERVAL, MN, BR, - POWER, - MMULTISCRIPTS, - CONTENT, - INTERSECT, - RT, - TFOOT, + NOTANUMBER, + MPRESCRIPTS, + CARTESIANPRODUCT, + LT, + NEST, + SCRIPT, APPLY, COS, MTD, @@ -2321,18 +2317,18 @@ public final class ElementName OPTION, MALIGNGROUP, FECOMPONENTTRANSFER, - MERROR, - VECTOR, - IMPLIES, - PRIMES, - APPLET, - EMPTYSET, - FEPOINTLIGHT, - LOWLIMIT, - NOTSUBSET, - PRODUCT, - SELECT, - MENU, + MUNDEROVER, + SELECTOR, + EXISTS, + NATURALNUMBERS, + DT, + DATALIST, + FESPOTLIGHT, + LIMIT, + MTEXT, + OUTPUT, + ROOT, + VECTORPRODUCT, FECOLORMATRIX, INFINITY, BIG, @@ -2371,30 +2367,30 @@ public final class ElementName OPTGROUP, CENTER, FEGAUSSIANBLUR, - MOVER, - NOBR, - SOLIDCOLOR, - ADDRESS, - DETAILS, - MS, - NOFRAMES, - PLUS, - TIMES, - BASEFONT, - DETERMINANT, - FONT_FACE_FORMAT, - FEOFFSET, - FONT, - INPUT, - LIST, - MOMENTABOUT, - NOSCRIPT, - OUTERPRODUCT, - PLAINTEXT, - RADIALGRADIENT, - SUBSET, - UPLIMIT, - FEDROPSHADOW, + METER, + MLABELEDTR, + TR, + ARCCOS, + DEFS, + INTEGERS, + MINUS, + PROGRESS, + SEMANTICS, + ARCCOT, + GT, + EQUIVALENT, + FRAMESET, + FEDISTANTLIGHT, + IDENT, + LINEARGRADIENT, + MSQRT, + NOTPRSUBSET, + OBJECT, + PRSUBSET, + RECT, + SCALARPRODUCT, + TEXT, + SDEV, VIEW, ISINDEX, FEMORPHOLOGY, @@ -2472,54 +2468,54 @@ public final class ElementName FOOTER, HANDLER, MARKER, - MUNDEROVER, - MLABELEDTR, - NOTANUMBER, - TR, - SELECTOR, - ARCCOS, - CANVAS, - DEFS, - EXISTS, - INTEGERS, - MPRESCRIPTS, - MINUS, - NATURALNUMBERS, - PROGRESS, - REALS, - SEMANTICS, - DT, - ARCCOT, - CARTESIANPRODUCT, - GT, - DATALIST, - EQUIVALENT, - FOREIGNOBJECT, - FRAMESET, - FESPOTLIGHT, - FEDISTANTLIGHT, - LT, - IDENT, - LIMIT, - LINEARGRADIENT, - MOMENT, - MSQRT, - MTEXT, - NOTPRSUBSET, - NEST, - OBJECT, - OUTPUT, - PRSUBSET, - TT, - RECT, - ROOT, - SCALARPRODUCT, - SCRIPT, - TEXT, - VECTORPRODUCT, - SDEV, - MROW, - SHADOW, + MOVER, + MERROR, + NOBR, + POWER, + SOLIDCOLOR, + VECTOR, + ADDRESS, + COMPLEXES, + DETAILS, + IMPLIES, + MS, + MMULTISCRIPTS, + NOFRAMES, + PRIMES, + PLUS, + RATIONALS, + TIMES, + APPLET, + BASEFONT, + CONTENT, + DETERMINANT, + EMPTYSET, + FONT_FACE_FORMAT, + FIELDSET, + FEOFFSET, + FEPOINTLIGHT, + FONT, + INTERSECT, + INPUT, + LOWLIMIT, + LIST, + MROOT, + MOMENTABOUT, + NOTSUBSET, + NOSCRIPT, + RT, + OUTERPRODUCT, + PRODUCT, + PLAINTEXT, + QUOTIENT, + RADIALGRADIENT, + SELECT, + SUBSET, + TFOOT, + UPLIMIT, + MENU, + FEDROPSHADOW, + MATRIXROW, APPROX, FECONVOLVEMATRIX, MATRIX, @@ -2672,24 +2668,23 @@ public final class ElementName HEADER, OR, MUNDER, - METER, }; private final static int[] ELEMENT_HASHES = { 1909280949, 1753057319, - 2001349704, + 2001309869, 1681770564, 1818230786, - 1983002201, - 2007257240, + 1982935782, + 2006974466, 58773795, 1747176599, 1782357526, 1897999926, 1970938456, - 1990969577, - 2005181733, - 2055515017, + 1990969429, + 2005160150, + 2055514836, 54061139, 62390273, 1730150402, @@ -2699,12 +2694,12 @@ public final class ElementName 1868641064, 1902641154, 1963982850, - 1973040373, - 1988486813, - 1999917383, - 2002882873, - 2005925890, - 2008851557, + 1971981018, + 1988486811, + 1999745104, + 2002780162, + 2005766372, + 2008340774, 2082727685, 51965171, 57200451, @@ -2724,18 +2719,18 @@ public final class ElementName 1905563974, 1938171179, 1967788867, - 1971628838, - 1976348214, - 1986140359, - 1989812374, - 1998724870, - 2000825752, - 2001392796, - 2004557976, - 2005543977, - 2006560839, - 2008125638, - 2021937364, + 1971467002, + 1974775352, + 1984294038, + 1988972590, + 1998585858, + 2000525512, + 2001392795, + 2004557973, + 2005324101, + 2006329158, + 2007803172, + 2009706573, 2068523853, 2087049448, 51434643, @@ -2774,30 +2769,30 @@ public final class ElementName 1939219752, 1966223078, 1968053806, - 1971466997, - 1971938532, - 1974771450, - 1982173479, - 1983633431, - 1986527234, - 1988763672, - 1990074116, - 1991909525, - 1999397992, - 2000439531, - 2001281328, - 2001349736, - 2001495140, - 2003183333, - 2004719812, - 2005279787, - 2005719336, - 2006036556, - 2006896969, - 2007781534, - 2008165414, - 2009276567, - 2051837468, + 1971465813, + 1971703386, + 1973420034, + 1982106678, + 1983533124, + 1986351224, + 1988502165, + 1990037800, + 1991350601, + 1998883894, + 2000158722, + 2000965834, + 2001349720, + 2001392798, + 2003062853, + 2004635806, + 2005231925, + 2005543979, + 2006028454, + 2006592552, + 2007601444, + 2008133709, + 2008994116, + 2041712436, 2060065124, 2070023911, 2085266636, @@ -2875,54 +2870,54 @@ public final class ElementName 1967795958, 1968840263, 1971461414, - 1971467002, - 1971703386, - 1971981018, - 1973420034, - 1974775352, - 1982106678, - 1982935782, - 1983533124, - 1984294038, - 1986351224, - 1988486811, - 1988502165, - 1988972590, - 1990037800, - 1990969429, - 1991350601, - 1998585858, - 1998883894, - 1999745104, - 2000158722, - 2000525512, - 2000965834, - 2001309869, - 2001349720, - 2001392795, - 2001392798, - 2002780162, - 2003062853, - 2004557973, - 2004635806, - 2005160150, - 2005231925, - 2005324101, - 2005543979, - 2005766372, - 2006028454, - 2006329158, - 2006592552, - 2006974466, - 2007601444, - 2007803172, - 2008133709, - 2008340774, - 2008994116, - 2009706573, - 2041712436, - 2055514836, - 2058653206, + 1971466997, + 1971628838, + 1971938532, + 1973040373, + 1974771450, + 1976348214, + 1982173479, + 1983002201, + 1983633431, + 1986140359, + 1986527234, + 1988486813, + 1988763672, + 1989812374, + 1990074116, + 1990969577, + 1991909525, + 1998724870, + 1999397992, + 1999917383, + 2000439531, + 2000825752, + 2001281328, + 2001349704, + 2001349736, + 2001392796, + 2001495140, + 2002882873, + 2003183333, + 2004557976, + 2004719812, + 2005181733, + 2005279787, + 2005543977, + 2005719336, + 2005925890, + 2006036556, + 2006560839, + 2006896969, + 2007257240, + 2007781534, + 2008125638, + 2008165414, + 2008851557, + 2009276567, + 2021937364, + 2051837468, + 2055515017, 2066000646, 2068523856, 2072193862, @@ -3075,6 +3070,5 @@ public final class ElementName 1968836118, 1970798594, 1971457766, - 1971465813, }; } diff --git a/parser/html/nsHtml5AtomList.h b/parser/html/nsHtml5AtomList.h index 71617e4ea0..38fe05b0f6 100644 --- a/parser/html/nsHtml5AtomList.h +++ b/parser/html/nsHtml5AtomList.h @@ -1059,7 +1059,6 @@ HTML5_ATOM(fedropshadow, "fedropshadow") HTML5_ATOM(feDropShadow, "feDropShadow") HTML5_ATOM(mrow, "mrow") HTML5_ATOM(matrixrow, "matrixrow") -HTML5_ATOM(shadow, "shadow") HTML5_ATOM(view, "view") HTML5_ATOM(approx, "approx") HTML5_ATOM(fecolormatrix, "fecolormatrix") diff --git a/parser/html/nsHtml5ElementName.cpp b/parser/html/nsHtml5ElementName.cpp index 84a0560124..7b8d1fb208 100644 --- a/parser/html/nsHtml5ElementName.cpp +++ b/parser/html/nsHtml5ElementName.cpp @@ -473,7 +473,6 @@ nsHtml5ElementName* nsHtml5ElementName::ELT_SDEV = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_FEDROPSHADOW = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_MROW = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_MATRIXROW = nullptr; -nsHtml5ElementName* nsHtml5ElementName::ELT_SHADOW = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_VIEW = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_APPROX = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_FECOLORMATRIX = nullptr; @@ -488,7 +487,7 @@ nsHtml5ElementName* nsHtml5ElementName::ELT_RUBY = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_SUMMARY = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_TBODY = nullptr; nsHtml5ElementName** nsHtml5ElementName::ELEMENT_NAMES = 0; -static int32_t const ELEMENT_HASHES_DATA[] = { 1909280949, 1753057319, 2001349704, 1681770564, 1818230786, 1983002201, 2007257240, 58773795, 1747176599, 1782357526, 1897999926, 1970938456, 1990969577, 2005181733, 2055515017, 54061139, 62390273, 1730150402, 1749395095, 1756625221, 1798693940, 1868641064, 1902641154, 1963982850, 1973040373, 1988486813, 1999917383, 2002882873, 2005925890, 2008851557, 2082727685, 51965171, 57200451, 60350803, 69730305, 1703292116, 1733890180, 1748355193, 1749813541, 1754634617, 1763839627, 1797540167, 1805647874, 1857622310, 1881498736, 1899272519, 1905563974, 1938171179, 1967788867, 1971628838, 1976348214, 1986140359, 1989812374, 1998724870, 2000825752, 2001392796, 2004557976, 2005543977, 2006560839, 2008125638, 2021937364, 2068523853, 2087049448, 51434643, 52488851, 56151587, 57210387, 59826259, 60354131, 63438849, 926941186, 1686489160, 1715300574, 1732381397, 1737099991, 1748100148, 1748642422, 1749715159, 1751288021, 1753467414, 1755158905, 1757259017, 1771722827, 1786534215, 1797645367, 1803929812, 1807501636, 1853642948, 1865773108, 1873350948, 1887579800, 1898223949, 1900544002, 1904285766, 1907435316, 1925844629, 1939219752, 1966223078, 1968053806, 1971466997, 1971938532, 1974771450, 1982173479, 1983633431, 1986527234, 1988763672, 1990074116, 1991909525, 1999397992, 2000439531, 2001281328, 2001349736, 2001495140, 2003183333, 2004719812, 2005279787, 2005719336, 2006036556, 2006896969, 2007781534, 2008165414, 2009276567, 2051837468, 2060065124, 2070023911, 2085266636, 2092255447, 50910499, 51957043, 52485715, 53012355, 55110883, 56680499, 57206291, 57732851, 59768833, 60345427, 60352083, 61395251, 62973651, 67633153, 893386754, 960495618, 1682547543, 1689922072, 1713515574, 1716349149, 1731545140, 1733076167, 1736576231, 1740181637, 1747814436, 1748228205, 1748607578, 1748879564, 1749656156, 1749801286, 1749917205, 1751493207, 1753343188, 1753588936, 1755076808, 1756474198, 1757146773, 1757293380, 1766632184, 1773808452, 1783388497, 1797361975, 1797585096, 1798677556, 1803876550, 1805233752, 1806806678, 1813512194, 1818755074, 1854228698, 1864368130, 1867237670, 1870268949, 1874102998, 1881669634, 1889085973, 1898223945, 1898971138, 1899694294, 1901940917, 1903761465, 1904515399, 1906135367, 1907959605, 1919418370, 1934172497, 1938173140, 1941221172, 1965334268, 1967128578, 1967795958, 1968840263, 1971461414, 1971467002, 1971703386, 1971981018, 1973420034, 1974775352, 1982106678, 1982935782, 1983533124, 1984294038, 1986351224, 1988486811, 1988502165, 1988972590, 1990037800, 1990969429, 1991350601, 1998585858, 1998883894, 1999745104, 2000158722, 2000525512, 2000965834, 2001309869, 2001349720, 2001392795, 2001392798, 2002780162, 2003062853, 2004557973, 2004635806, 2005160150, 2005231925, 2005324101, 2005543979, 2005766372, 2006028454, 2006329158, 2006592552, 2006974466, 2007601444, 2007803172, 2008133709, 2008340774, 2008994116, 2009706573, 2041712436, 2055514836, 2058653206, 2066000646, 2068523856, 2072193862, 2083120164, 2087012585, 2091479332, 2092557349, 50908899, 50916387, 51438659, 51961587, 51965683, 52486755, 52490899, 54054451, 55104723, 55111395, 56677619, 56682579, 57205395, 57207619, 57731155, 57733651, 59244545, 59821379, 60345171, 60347747, 60351123, 60352339, 60875283, 61925907, 62450211, 62974707, 67108865, 68681729, 876609538, 910163970, 943718402, 1679960596, 1682186266, 1685703382, 1686491348, 1699324759, 1703936002, 1713736758, 1715310660, 1719741029, 1730965751, 1732069431, 1733054663, 1733372532, 1736200310, 1736576583, 1738539010, 1747048757, 1747306711, 1747838298, 1748225318, 1748346119, 1748359220, 1748621670, 1748846791, 1749272732, 1749649513, 1749673195, 1749723735, 1749813486, 1749905526, 1749932347, 1751386406, 1752979652, 1753319686, 1753362711, 1753479494, 1754031332, 1754894485, 1755148615, 1756098852, 1756600614, 1757137429, 1757157700, 1757268168, 1758044696, 1765431364, 1766992520, 1773295687, 1781815495, 1783210839, 1783388498, 1790207270, 1797368887, 1797544247, 1797628983, 1798417460, 1798686984, 1800730821, 1803876557, 1803929861, 1805502724, 1806799156, 1806981428, 1807599880, 1817013469, 1818700314, 1820327938, 1854228692, 1854245076, 1857653029, 1865714391, 1867061545, 1868312196, 1870135298, 1873281026, 1874053333, 1881288348, 1881613047, 1884120164, 1887743720, 1897398274, 1898130486, 1898223946, 1898753862, 1899170008, 1899272521, 1899796819, 1900845386, 1902116866, 1903302038, 1904283860, 1904412884, 1904946933, 1906087319, 1907085604, 1907661127, 1908709605, 1914900309, 1925049415, 1932928296, 1935549734, 1938172967, 1938817026, 1941178676, 1948778498, 1965115924, 1965634084, 1966386470, 1967760215, 1967795910, 1967957189, 1968836118, 1970798594, 1971457766, 1971465813 }; +static int32_t const ELEMENT_HASHES_DATA[] = { 1909280949, 1753057319, 2001309869, 1681770564, 1818230786, 1982935782, 2006974466, 58773795, 1747176599, 1782357526, 1897999926, 1970938456, 1990969429, 2005160150, 2055514836, 54061139, 62390273, 1730150402, 1749395095, 1756625221, 1798693940, 1868641064, 1902641154, 1963982850, 1971981018, 1988486811, 1999745104, 2002780162, 2005766372, 2008340774, 2082727685, 51965171, 57200451, 60350803, 69730305, 1703292116, 1733890180, 1748355193, 1749813541, 1754634617, 1763839627, 1797540167, 1805647874, 1857622310, 1881498736, 1899272519, 1905563974, 1938171179, 1967788867, 1971467002, 1974775352, 1984294038, 1988972590, 1998585858, 2000525512, 2001392795, 2004557973, 2005324101, 2006329158, 2007803172, 2009706573, 2068523853, 2087049448, 51434643, 52488851, 56151587, 57210387, 59826259, 60354131, 63438849, 926941186, 1686489160, 1715300574, 1732381397, 1737099991, 1748100148, 1748642422, 1749715159, 1751288021, 1753467414, 1755158905, 1757259017, 1771722827, 1786534215, 1797645367, 1803929812, 1807501636, 1853642948, 1865773108, 1873350948, 1887579800, 1898223949, 1900544002, 1904285766, 1907435316, 1925844629, 1939219752, 1966223078, 1968053806, 1971465813, 1971703386, 1973420034, 1982106678, 1983533124, 1986351224, 1988502165, 1990037800, 1991350601, 1998883894, 2000158722, 2000965834, 2001349720, 2001392798, 2003062853, 2004635806, 2005231925, 2005543979, 2006028454, 2006592552, 2007601444, 2008133709, 2008994116, 2041712436, 2060065124, 2070023911, 2085266636, 2092255447, 50910499, 51957043, 52485715, 53012355, 55110883, 56680499, 57206291, 57732851, 59768833, 60345427, 60352083, 61395251, 62973651, 67633153, 893386754, 960495618, 1682547543, 1689922072, 1713515574, 1716349149, 1731545140, 1733076167, 1736576231, 1740181637, 1747814436, 1748228205, 1748607578, 1748879564, 1749656156, 1749801286, 1749917205, 1751493207, 1753343188, 1753588936, 1755076808, 1756474198, 1757146773, 1757293380, 1766632184, 1773808452, 1783388497, 1797361975, 1797585096, 1798677556, 1803876550, 1805233752, 1806806678, 1813512194, 1818755074, 1854228698, 1864368130, 1867237670, 1870268949, 1874102998, 1881669634, 1889085973, 1898223945, 1898971138, 1899694294, 1901940917, 1903761465, 1904515399, 1906135367, 1907959605, 1919418370, 1934172497, 1938173140, 1941221172, 1965334268, 1967128578, 1967795958, 1968840263, 1971461414, 1971466997, 1971628838, 1971938532, 1973040373, 1974771450, 1976348214, 1982173479, 1983002201, 1983633431, 1986140359, 1986527234, 1988486813, 1988763672, 1989812374, 1990074116, 1990969577, 1991909525, 1998724870, 1999397992, 1999917383, 2000439531, 2000825752, 2001281328, 2001349704, 2001349736, 2001392796, 2001495140, 2002882873, 2003183333, 2004557976, 2004719812, 2005181733, 2005279787, 2005543977, 2005719336, 2005925890, 2006036556, 2006560839, 2006896969, 2007257240, 2007781534, 2008125638, 2008165414, 2008851557, 2009276567, 2021937364, 2051837468, 2055515017, 2066000646, 2068523856, 2072193862, 2083120164, 2087012585, 2091479332, 2092557349, 50908899, 50916387, 51438659, 51961587, 51965683, 52486755, 52490899, 54054451, 55104723, 55111395, 56677619, 56682579, 57205395, 57207619, 57731155, 57733651, 59244545, 59821379, 60345171, 60347747, 60351123, 60352339, 60875283, 61925907, 62450211, 62974707, 67108865, 68681729, 876609538, 910163970, 943718402, 1679960596, 1682186266, 1685703382, 1686491348, 1699324759, 1703936002, 1713736758, 1715310660, 1719741029, 1730965751, 1732069431, 1733054663, 1733372532, 1736200310, 1736576583, 1738539010, 1747048757, 1747306711, 1747838298, 1748225318, 1748346119, 1748359220, 1748621670, 1748846791, 1749272732, 1749649513, 1749673195, 1749723735, 1749813486, 1749905526, 1749932347, 1751386406, 1752979652, 1753319686, 1753362711, 1753479494, 1754031332, 1754894485, 1755148615, 1756098852, 1756600614, 1757137429, 1757157700, 1757268168, 1758044696, 1765431364, 1766992520, 1773295687, 1781815495, 1783210839, 1783388498, 1790207270, 1797368887, 1797544247, 1797628983, 1798417460, 1798686984, 1800730821, 1803876557, 1803929861, 1805502724, 1806799156, 1806981428, 1807599880, 1817013469, 1818700314, 1820327938, 1854228692, 1854245076, 1857653029, 1865714391, 1867061545, 1868312196, 1870135298, 1873281026, 1874053333, 1881288348, 1881613047, 1884120164, 1887743720, 1897398274, 1898130486, 1898223946, 1898753862, 1899170008, 1899272521, 1899796819, 1900845386, 1902116866, 1903302038, 1904283860, 1904412884, 1904946933, 1906087319, 1907085604, 1907661127, 1908709605, 1914900309, 1925049415, 1932928296, 1935549734, 1938172967, 1938817026, 1941178676, 1948778498, 1965115924, 1965634084, 1966386470, 1967760215, 1967795910, 1967957189, 1968836118, 1970798594, 1971457766 }; staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HASHES_DATA, MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA) }; void nsHtml5ElementName::initializeStatics() @@ -881,7 +880,6 @@ nsHtml5ElementName::initializeStatics() ELT_FEDROPSHADOW = new nsHtml5ElementName(nsHtml5Atoms::fedropshadow, nsHtml5Atoms::feDropShadow, NS_NewHTMLUnknownElement, NS_NewSVGFEDropShadowElement, nsHtml5TreeBuilder::OTHER); ELT_MROW = new nsHtml5ElementName(nsHtml5Atoms::mrow, nsHtml5Atoms::mrow, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_MATRIXROW = new nsHtml5ElementName(nsHtml5Atoms::matrixrow, nsHtml5Atoms::matrixrow, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); - ELT_SHADOW = new nsHtml5ElementName(nsHtml5Atoms::shadow, nsHtml5Atoms::shadow, NS_NewHTMLShadowElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_VIEW = new nsHtml5ElementName(nsHtml5Atoms::view, nsHtml5Atoms::view, NS_NewHTMLUnknownElement, NS_NewSVGViewElement, nsHtml5TreeBuilder::OTHER); ELT_APPROX = new nsHtml5ElementName(nsHtml5Atoms::approx, nsHtml5Atoms::approx, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_FECOLORMATRIX = new nsHtml5ElementName(nsHtml5Atoms::fecolormatrix, nsHtml5Atoms::feColorMatrix, NS_NewHTMLUnknownElement, NS_NewSVGFEColorMatrixElement, nsHtml5TreeBuilder::OTHER); @@ -895,22 +893,22 @@ nsHtml5ElementName::initializeStatics() ELT_RUBY = new nsHtml5ElementName(nsHtml5Atoms::ruby, nsHtml5Atoms::ruby, NS_NewHTMLElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR); ELT_SUMMARY = new nsHtml5ElementName(nsHtml5Atoms::summary, nsHtml5Atoms::summary, NS_NewHTMLSummaryElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL); ELT_TBODY = new nsHtml5ElementName(nsHtml5Atoms::tbody, nsHtml5Atoms::tbody, NS_NewHTMLTableSectionElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG); - ELEMENT_NAMES = new nsHtml5ElementName*[401]; + ELEMENT_NAMES = new nsHtml5ElementName*[400]; ELEMENT_NAMES[0] = ELT_VKERN; ELEMENT_NAMES[1] = ELT_LOGBASE; - ELEMENT_NAMES[2] = ELT_FIELDSET; + ELEMENT_NAMES[2] = ELT_FOREIGNOBJECT; ELEMENT_NAMES[3] = ELT_DATA; ELEMENT_NAMES[4] = ELT_LI; - ELEMENT_NAMES[5] = ELT_COMPLEXES; - ELEMENT_NAMES[6] = ELT_QUOTIENT; + ELEMENT_NAMES[5] = ELT_CANVAS; + ELEMENT_NAMES[6] = ELT_TT; ELEMENT_NAMES[7] = ELT_PRE; ELEMENT_NAMES[8] = ELT_ARTICLE; ELEMENT_NAMES[9] = ELT_DIALOG; ELEMENT_NAMES[10] = ELT_ARCTAN; ELEMENT_NAMES[11] = ELT_LISTENER; - ELEMENT_NAMES[12] = ELT_RATIONALS; - ELEMENT_NAMES[13] = ELT_MROOT; - ELEMENT_NAMES[14] = ELT_MATRIXROW; + ELEMENT_NAMES[12] = ELT_REALS; + ELEMENT_NAMES[13] = ELT_MOMENT; + ELEMENT_NAMES[14] = ELT_MROW; ELEMENT_NAMES[15] = ELT_GEQ; ELEMENT_NAMES[16] = ELT_G; ELEMENT_NAMES[17] = ELT_DD; @@ -920,12 +918,12 @@ nsHtml5ElementName::initializeStatics() ELEMENT_NAMES[21] = ELT_INTERVAL; ELEMENT_NAMES[22] = ELT_MN; ELEMENT_NAMES[23] = ELT_BR; - ELEMENT_NAMES[24] = ELT_POWER; - ELEMENT_NAMES[25] = ELT_MMULTISCRIPTS; - ELEMENT_NAMES[26] = ELT_CONTENT; - ELEMENT_NAMES[27] = ELT_INTERSECT; - ELEMENT_NAMES[28] = ELT_RT; - ELEMENT_NAMES[29] = ELT_TFOOT; + ELEMENT_NAMES[24] = ELT_NOTANUMBER; + ELEMENT_NAMES[25] = ELT_MPRESCRIPTS; + ELEMENT_NAMES[26] = ELT_CARTESIANPRODUCT; + ELEMENT_NAMES[27] = ELT_LT; + ELEMENT_NAMES[28] = ELT_NEST; + ELEMENT_NAMES[29] = ELT_SCRIPT; ELEMENT_NAMES[30] = ELT_APPLY; ELEMENT_NAMES[31] = ELT_COS; ELEMENT_NAMES[32] = ELT_MTD; @@ -945,18 +943,18 @@ nsHtml5ElementName::initializeStatics() ELEMENT_NAMES[46] = ELT_OPTION; ELEMENT_NAMES[47] = ELT_MALIGNGROUP; ELEMENT_NAMES[48] = ELT_FECOMPONENTTRANSFER; - ELEMENT_NAMES[49] = ELT_MERROR; - ELEMENT_NAMES[50] = ELT_VECTOR; - ELEMENT_NAMES[51] = ELT_IMPLIES; - ELEMENT_NAMES[52] = ELT_PRIMES; - ELEMENT_NAMES[53] = ELT_APPLET; - ELEMENT_NAMES[54] = ELT_EMPTYSET; - ELEMENT_NAMES[55] = ELT_FEPOINTLIGHT; - ELEMENT_NAMES[56] = ELT_LOWLIMIT; - ELEMENT_NAMES[57] = ELT_NOTSUBSET; - ELEMENT_NAMES[58] = ELT_PRODUCT; - ELEMENT_NAMES[59] = ELT_SELECT; - ELEMENT_NAMES[60] = ELT_MENU; + ELEMENT_NAMES[49] = ELT_MUNDEROVER; + ELEMENT_NAMES[50] = ELT_SELECTOR; + ELEMENT_NAMES[51] = ELT_EXISTS; + ELEMENT_NAMES[52] = ELT_NATURALNUMBERS; + ELEMENT_NAMES[53] = ELT_DT; + ELEMENT_NAMES[54] = ELT_DATALIST; + ELEMENT_NAMES[55] = ELT_FESPOTLIGHT; + ELEMENT_NAMES[56] = ELT_LIMIT; + ELEMENT_NAMES[57] = ELT_MTEXT; + ELEMENT_NAMES[58] = ELT_OUTPUT; + ELEMENT_NAMES[59] = ELT_ROOT; + ELEMENT_NAMES[60] = ELT_VECTORPRODUCT; ELEMENT_NAMES[61] = ELT_FECOLORMATRIX; ELEMENT_NAMES[62] = ELT_INFINITY; ELEMENT_NAMES[63] = ELT_BIG; @@ -995,30 +993,30 @@ nsHtml5ElementName::initializeStatics() ELEMENT_NAMES[96] = ELT_OPTGROUP; ELEMENT_NAMES[97] = ELT_CENTER; ELEMENT_NAMES[98] = ELT_FEGAUSSIANBLUR; - ELEMENT_NAMES[99] = ELT_MOVER; - ELEMENT_NAMES[100] = ELT_NOBR; - ELEMENT_NAMES[101] = ELT_SOLIDCOLOR; - ELEMENT_NAMES[102] = ELT_ADDRESS; - ELEMENT_NAMES[103] = ELT_DETAILS; - ELEMENT_NAMES[104] = ELT_MS; - ELEMENT_NAMES[105] = ELT_NOFRAMES; - ELEMENT_NAMES[106] = ELT_PLUS; - ELEMENT_NAMES[107] = ELT_TIMES; - ELEMENT_NAMES[108] = ELT_BASEFONT; - ELEMENT_NAMES[109] = ELT_DETERMINANT; - ELEMENT_NAMES[110] = ELT_FONT_FACE_FORMAT; - ELEMENT_NAMES[111] = ELT_FEOFFSET; - ELEMENT_NAMES[112] = ELT_FONT; - ELEMENT_NAMES[113] = ELT_INPUT; - ELEMENT_NAMES[114] = ELT_LIST; - ELEMENT_NAMES[115] = ELT_MOMENTABOUT; - ELEMENT_NAMES[116] = ELT_NOSCRIPT; - ELEMENT_NAMES[117] = ELT_OUTERPRODUCT; - ELEMENT_NAMES[118] = ELT_PLAINTEXT; - ELEMENT_NAMES[119] = ELT_RADIALGRADIENT; - ELEMENT_NAMES[120] = ELT_SUBSET; - ELEMENT_NAMES[121] = ELT_UPLIMIT; - ELEMENT_NAMES[122] = ELT_FEDROPSHADOW; + ELEMENT_NAMES[99] = ELT_METER; + ELEMENT_NAMES[100] = ELT_MLABELEDTR; + ELEMENT_NAMES[101] = ELT_TR; + ELEMENT_NAMES[102] = ELT_ARCCOS; + ELEMENT_NAMES[103] = ELT_DEFS; + ELEMENT_NAMES[104] = ELT_INTEGERS; + ELEMENT_NAMES[105] = ELT_MINUS; + ELEMENT_NAMES[106] = ELT_PROGRESS; + ELEMENT_NAMES[107] = ELT_SEMANTICS; + ELEMENT_NAMES[108] = ELT_ARCCOT; + ELEMENT_NAMES[109] = ELT_GT; + ELEMENT_NAMES[110] = ELT_EQUIVALENT; + ELEMENT_NAMES[111] = ELT_FRAMESET; + ELEMENT_NAMES[112] = ELT_FEDISTANTLIGHT; + ELEMENT_NAMES[113] = ELT_IDENT; + ELEMENT_NAMES[114] = ELT_LINEARGRADIENT; + ELEMENT_NAMES[115] = ELT_MSQRT; + ELEMENT_NAMES[116] = ELT_NOTPRSUBSET; + ELEMENT_NAMES[117] = ELT_OBJECT; + ELEMENT_NAMES[118] = ELT_PRSUBSET; + ELEMENT_NAMES[119] = ELT_RECT; + ELEMENT_NAMES[120] = ELT_SCALARPRODUCT; + ELEMENT_NAMES[121] = ELT_TEXT; + ELEMENT_NAMES[122] = ELT_SDEV; ELEMENT_NAMES[123] = ELT_VIEW; ELEMENT_NAMES[124] = ELT_ISINDEX; ELEMENT_NAMES[125] = ELT_FEMORPHOLOGY; @@ -1096,54 +1094,54 @@ nsHtml5ElementName::initializeStatics() ELEMENT_NAMES[197] = ELT_FOOTER; ELEMENT_NAMES[198] = ELT_HANDLER; ELEMENT_NAMES[199] = ELT_MARKER; - ELEMENT_NAMES[200] = ELT_MUNDEROVER; - ELEMENT_NAMES[201] = ELT_MLABELEDTR; - ELEMENT_NAMES[202] = ELT_NOTANUMBER; - ELEMENT_NAMES[203] = ELT_TR; - ELEMENT_NAMES[204] = ELT_SELECTOR; - ELEMENT_NAMES[205] = ELT_ARCCOS; - ELEMENT_NAMES[206] = ELT_CANVAS; - ELEMENT_NAMES[207] = ELT_DEFS; - ELEMENT_NAMES[208] = ELT_EXISTS; - ELEMENT_NAMES[209] = ELT_INTEGERS; - ELEMENT_NAMES[210] = ELT_MPRESCRIPTS; - ELEMENT_NAMES[211] = ELT_MINUS; - ELEMENT_NAMES[212] = ELT_NATURALNUMBERS; - ELEMENT_NAMES[213] = ELT_PROGRESS; - ELEMENT_NAMES[214] = ELT_REALS; - ELEMENT_NAMES[215] = ELT_SEMANTICS; - ELEMENT_NAMES[216] = ELT_DT; - ELEMENT_NAMES[217] = ELT_ARCCOT; - ELEMENT_NAMES[218] = ELT_CARTESIANPRODUCT; - ELEMENT_NAMES[219] = ELT_GT; - ELEMENT_NAMES[220] = ELT_DATALIST; - ELEMENT_NAMES[221] = ELT_EQUIVALENT; - ELEMENT_NAMES[222] = ELT_FOREIGNOBJECT; - ELEMENT_NAMES[223] = ELT_FRAMESET; - ELEMENT_NAMES[224] = ELT_FESPOTLIGHT; - ELEMENT_NAMES[225] = ELT_FEDISTANTLIGHT; - ELEMENT_NAMES[226] = ELT_LT; - ELEMENT_NAMES[227] = ELT_IDENT; - ELEMENT_NAMES[228] = ELT_LIMIT; - ELEMENT_NAMES[229] = ELT_LINEARGRADIENT; - ELEMENT_NAMES[230] = ELT_MOMENT; - ELEMENT_NAMES[231] = ELT_MSQRT; - ELEMENT_NAMES[232] = ELT_MTEXT; - ELEMENT_NAMES[233] = ELT_NOTPRSUBSET; - ELEMENT_NAMES[234] = ELT_NEST; - ELEMENT_NAMES[235] = ELT_OBJECT; - ELEMENT_NAMES[236] = ELT_OUTPUT; - ELEMENT_NAMES[237] = ELT_PRSUBSET; - ELEMENT_NAMES[238] = ELT_TT; - ELEMENT_NAMES[239] = ELT_RECT; - ELEMENT_NAMES[240] = ELT_ROOT; - ELEMENT_NAMES[241] = ELT_SCALARPRODUCT; - ELEMENT_NAMES[242] = ELT_SCRIPT; - ELEMENT_NAMES[243] = ELT_TEXT; - ELEMENT_NAMES[244] = ELT_VECTORPRODUCT; - ELEMENT_NAMES[245] = ELT_SDEV; - ELEMENT_NAMES[246] = ELT_MROW; - ELEMENT_NAMES[247] = ELT_SHADOW; + ELEMENT_NAMES[200] = ELT_MOVER; + ELEMENT_NAMES[201] = ELT_MERROR; + ELEMENT_NAMES[202] = ELT_NOBR; + ELEMENT_NAMES[203] = ELT_POWER; + ELEMENT_NAMES[204] = ELT_SOLIDCOLOR; + ELEMENT_NAMES[205] = ELT_VECTOR; + ELEMENT_NAMES[206] = ELT_ADDRESS; + ELEMENT_NAMES[207] = ELT_COMPLEXES; + ELEMENT_NAMES[208] = ELT_DETAILS; + ELEMENT_NAMES[209] = ELT_IMPLIES; + ELEMENT_NAMES[210] = ELT_MS; + ELEMENT_NAMES[211] = ELT_MMULTISCRIPTS; + ELEMENT_NAMES[212] = ELT_NOFRAMES; + ELEMENT_NAMES[213] = ELT_PRIMES; + ELEMENT_NAMES[214] = ELT_PLUS; + ELEMENT_NAMES[215] = ELT_RATIONALS; + ELEMENT_NAMES[216] = ELT_TIMES; + ELEMENT_NAMES[217] = ELT_APPLET; + ELEMENT_NAMES[218] = ELT_BASEFONT; + ELEMENT_NAMES[219] = ELT_CONTENT; + ELEMENT_NAMES[220] = ELT_DETERMINANT; + ELEMENT_NAMES[221] = ELT_EMPTYSET; + ELEMENT_NAMES[222] = ELT_FONT_FACE_FORMAT; + ELEMENT_NAMES[223] = ELT_FIELDSET; + ELEMENT_NAMES[224] = ELT_FEOFFSET; + ELEMENT_NAMES[225] = ELT_FEPOINTLIGHT; + ELEMENT_NAMES[226] = ELT_FONT; + ELEMENT_NAMES[227] = ELT_INTERSECT; + ELEMENT_NAMES[228] = ELT_INPUT; + ELEMENT_NAMES[229] = ELT_LOWLIMIT; + ELEMENT_NAMES[230] = ELT_LIST; + ELEMENT_NAMES[231] = ELT_MROOT; + ELEMENT_NAMES[232] = ELT_MOMENTABOUT; + ELEMENT_NAMES[233] = ELT_NOTSUBSET; + ELEMENT_NAMES[234] = ELT_NOSCRIPT; + ELEMENT_NAMES[235] = ELT_RT; + ELEMENT_NAMES[236] = ELT_OUTERPRODUCT; + ELEMENT_NAMES[237] = ELT_PRODUCT; + ELEMENT_NAMES[238] = ELT_PLAINTEXT; + ELEMENT_NAMES[239] = ELT_QUOTIENT; + ELEMENT_NAMES[240] = ELT_RADIALGRADIENT; + ELEMENT_NAMES[241] = ELT_SELECT; + ELEMENT_NAMES[242] = ELT_SUBSET; + ELEMENT_NAMES[243] = ELT_TFOOT; + ELEMENT_NAMES[244] = ELT_UPLIMIT; + ELEMENT_NAMES[245] = ELT_MENU; + ELEMENT_NAMES[246] = ELT_FEDROPSHADOW; + ELEMENT_NAMES[247] = ELT_MATRIXROW; ELEMENT_NAMES[248] = ELT_APPROX; ELEMENT_NAMES[249] = ELT_FECONVOLVEMATRIX; ELEMENT_NAMES[250] = ELT_MATRIX; @@ -1296,7 +1294,6 @@ nsHtml5ElementName::initializeStatics() ELEMENT_NAMES[397] = ELT_HEADER; ELEMENT_NAMES[398] = ELT_OR; ELEMENT_NAMES[399] = ELT_MUNDER; - ELEMENT_NAMES[400] = ELT_METER; } void @@ -1690,7 +1687,6 @@ nsHtml5ElementName::releaseStatics() delete ELT_FEDROPSHADOW; delete ELT_MROW; delete ELT_MATRIXROW; - delete ELT_SHADOW; delete ELT_VIEW; delete ELT_APPROX; delete ELT_FECOLORMATRIX; diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 5236d18873..da259d4da8 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -596,7 +596,6 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_FEDROPSHADOW; static nsHtml5ElementName* ELT_MROW; static nsHtml5ElementName* ELT_MATRIXROW; - static nsHtml5ElementName* ELT_SHADOW; static nsHtml5ElementName* ELT_VIEW; static nsHtml5ElementName* ELT_APPROX; static nsHtml5ElementName* ELT_FECOLORMATRIX; diff --git a/parser/htmlparser/nsElementTable.cpp b/parser/htmlparser/nsElementTable.cpp index 84e3af6ba7..f8522c5725 100644 --- a/parser/htmlparser/nsElementTable.cpp +++ b/parser/htmlparser/nsElementTable.cpp @@ -178,7 +178,6 @@ static const HTMLElement gHTMLElements[] = { ELEM(script, (kSpecial|kHeadContent), false) ELEM(section, kBlock, false) ELEM(select, kFormControl, false) - ELEM(shadow, kFlowEntity, false) ELEM(small, kFontStyle, false) ELEM(source, kSpecial, true) ELEM(span, kSpecial, false) diff --git a/parser/htmlparser/nsHTMLTagList.h b/parser/htmlparser/nsHTMLTagList.h index e6f1f644cb..80d737ffb6 100644 --- a/parser/htmlparser/nsHTMLTagList.h +++ b/parser/htmlparser/nsHTMLTagList.h @@ -153,7 +153,6 @@ HTML_HTMLELEMENT_TAG(samp) HTML_TAG(script, Script, Script) HTML_HTMLELEMENT_TAG(section) HTML_TAG(select, Select, Select) -HTML_TAG(shadow, Shadow, Shadow) HTML_HTMLELEMENT_TAG(small) HTML_TAG(source, Source, Source) HTML_TAG(span, Span, Span) |