diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:08:22 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:08:22 -0400 |
commit | 8beb65dd501cbdcfd6a793027b5de2a1fdfc7149 (patch) | |
tree | 4b524fb1a1888b37bc347dc65c7c200979fe54aa | |
parent | 5524318fe73a1123da10491a6a545b50af88ea60 (diff) | |
download | uxp-8beb65dd501cbdcfd6a793027b5de2a1fdfc7149.tar.gz |
Bug 1418002 - Remove HTMLContentElement
Tag #1375
23 files changed, 140 insertions, 1317 deletions
diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp index 391b7c326a..dc356fc01b 100644 --- a/dom/base/ChildIterator.cpp +++ b/dom/base/ChildIterator.cpp @@ -7,7 +7,6 @@ #include "ChildIterator.h" #include "nsContentUtils.h" #include "mozilla/dom/XBLChildrenElement.h" -#include "mozilla/dom/HTMLContentElement.h" #include "mozilla/dom/ShadowRoot.h" #include "nsIAnonymousContentCreator.h" #include "nsIFrame.h" @@ -18,33 +17,29 @@ namespace dom { class MatchedNodes { public: - explicit MatchedNodes(HTMLContentElement* aInsertionPoint) - : mIsContentElement(true), mContentElement(aInsertionPoint) {} - + explicit MatchedNodes() + : mIsContentElement(false), mChildrenElement(nullptr) {} explicit MatchedNodes(XBLChildrenElement* aInsertionPoint) : mIsContentElement(false), mChildrenElement(aInsertionPoint) {} uint32_t Length() const { - return mIsContentElement ? mContentElement->MatchedNodes().Length() - : mChildrenElement->InsertedChildrenLength(); + return mChildrenElement ? mChildrenElement->InsertedChildrenLength() : 0; } nsIContent* operator[](int32_t aIndex) const { - return mIsContentElement ? mContentElement->MatchedNodes()[aIndex] - : mChildrenElement->InsertedChild(aIndex); + return mChildrenElement ? mChildrenElement->InsertedChild(aIndex) : nullptr; } bool IsEmpty() const { - return mIsContentElement ? mContentElement->MatchedNodes().IsEmpty() - : !mChildrenElement->HasInsertedChildren(); + return mChildrenElement && !mChildrenElement->HasInsertedChildren(); } protected: + // Leftover from Shadow DOM v0. bool mIsContentElement; union { - HTMLContentElement* mContentElement; XBLChildrenElement* mChildrenElement; }; }; @@ -57,9 +52,9 @@ GetMatchedNodesForPoint(nsIContent* aContent) return MatchedNodes(static_cast<XBLChildrenElement*>(aContent)); } + return MatchedNodes(); // Web components case - MOZ_ASSERT(aContent->IsHTMLElement(nsGkAtoms::content)); - return MatchedNodes(HTMLContentElement::FromContent(aContent)); + // XXX handle <slot> element? } nsIContent* diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index e00bb69d83..97214e0507 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -14,7 +14,6 @@ #include "nsIDOMHTMLElement.h" #include "nsIStyleSheetLinkingElement.h" #include "mozilla/dom/Element.h" -#include "mozilla/dom/HTMLContentElement.h" #include "nsXBLPrototypeBinding.h" #include "mozilla/StyleSheet.h" #include "mozilla/StyleSheetInlines.h" @@ -224,35 +223,6 @@ ShadowRoot::GetElementsByClassName(const nsAString& aClasses) } void -ShadowRoot::AddInsertionPoint(HTMLContentElement* aInsertionPoint) -{ - TreeOrderComparator comparator; - mInsertionPoints.InsertElementSorted(aInsertionPoint, comparator); -} - -void -ShadowRoot::RemoveInsertionPoint(HTMLContentElement* aInsertionPoint) -{ - mInsertionPoints.RemoveElement(aInsertionPoint); -} - -void -ShadowRoot::RemoveDestInsertionPoint(nsIContent* aInsertionPoint, - nsTArray<nsIContent*>& aDestInsertionPoints) -{ - // Remove the insertion point from the destination insertion points. - // Also remove all succeeding insertion points because it is no longer - // possible for the content to be distributed into deeper node trees. - int32_t index = aDestInsertionPoints.IndexOf(aInsertionPoint); - - // It's possible that we already removed the insertion point while processing - // other insertion point removals. - if (index >= 0) { - aDestInsertionPoints.SetLength(index); - } -} - -void ShadowRoot::DistributionChanged() { // FIXME(emilio): We could be more granular in a bunch of cases. @@ -269,133 +239,10 @@ ShadowRoot::DistributionChanged() shell->DestroyFramesForAndRestyle(host); } -const HTMLContentElement* -ShadowRoot::DistributeSingleNode(nsIContent* aContent) -{ - // Find the insertion point to which the content belongs. - HTMLContentElement* foundInsertionPoint = nullptr; - for (HTMLContentElement* insertionPoint : mInsertionPoints) { - if (insertionPoint->Match(aContent)) { - if (insertionPoint->MatchedNodes().Contains(aContent)) { - // Node is already matched into the insertion point. We are done. - return insertionPoint; - } - - // Matching may cause the insertion point to drop fallback content. - if (insertionPoint->MatchedNodes().IsEmpty() && - insertionPoint->HasChildren()) { - // This match will cause the insertion point to drop all fallback - // content and used matched nodes instead. Give up on the optimization - // and just distribute all nodes. - DistributeAllNodes(); - MOZ_ASSERT(insertionPoint->MatchedNodes().Contains(aContent)); - return insertionPoint; - } - foundInsertionPoint = insertionPoint; - break; - } - } - - if (!foundInsertionPoint) { - return nullptr; - } - - // Find the index into the insertion point. - nsCOMArray<nsIContent>& matchedNodes = foundInsertionPoint->MatchedNodes(); - // Find the appropriate position in the matched node list for the - // newly distributed content. - bool isIndexFound = false; - 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. - if (childIterator.Seek(aContent, matchedNodes[i])) { - // aContent was found before the current matched node. - foundInsertionPoint->InsertMatchedNode(i, aContent); - isIndexFound = true; - break; - } - } - - if (!isIndexFound) { - // We have still not found an index in the insertion point, - // thus it must be at the end. - MOZ_ASSERT(childIterator.Seek(aContent, nullptr), - "Trying to match a node that is not a candidate to be matched"); - foundInsertionPoint->AppendMatchedNode(aContent); - } - - return foundInsertionPoint; -} - -const HTMLContentElement* -ShadowRoot::RemoveDistributedNode(nsIContent* aContent) -{ - // Find insertion point containing the content and remove the node. - for (HTMLContentElement* insertionPoint : mInsertionPoints) { - if (!insertionPoint->MatchedNodes().Contains(aContent)) { - continue; - } - - // Removing the matched node may cause the insertion point to use - // fallback content. - if (insertionPoint->MatchedNodes().Length() == 1 && - insertionPoint->HasChildren()) { - // Removing the matched node will cause fallback content to be - // used instead. Give up optimization and distribute all nodes. - DistributeAllNodes(); - return insertionPoint; - } - - insertionPoint->RemoveMatchedNode(aContent); - return insertionPoint; - } - - return nullptr; -} - void ShadowRoot::DistributeAllNodes() { - // Create node pool. - nsTArray<nsIContent*> nodePool; - ExplicitChildIterator childIterator(GetHost()); - for (nsIContent* content = childIterator.GetNextChild(); content; - content = childIterator.GetNextChild()) { - nodePool.AppendElement(content); - } - - nsTArray<ShadowRoot*> shadowsToUpdate; - - for (HTMLContentElement* insertionPoint : mInsertionPoints) { - insertionPoint->ClearMatchedNodes(); - // Assign matching nodes from node pool. - for (uint32_t j = 0; j < nodePool.Length(); j++) { - if (insertionPoint->Match(nodePool[j])) { - insertionPoint->AppendMatchedNode(nodePool[j]); - nodePool.RemoveElementAt(j--); - } - } - - // Keep track of instances where the content insertion point is distributed - // (parent of insertion point has a ShadowRoot). - nsIContent* insertionParent = insertionPoint->GetParent(); - MOZ_ASSERT(insertionParent, "The only way for an insertion point to be in the" - "mInsertionPoints array is to be a descendant of a" - "ShadowRoot, in which case, it should have a parent"); - - // If the parent of the insertion point has a ShadowRoot, the nodes distributed - // to the insertion point must be reprojected to the insertion points of the - // parent's ShadowRoot. - ShadowRoot* parentShadow = insertionParent->GetShadowRoot(); - if (parentShadow && !shadowsToUpdate.Contains(parentShadow)) { - shadowsToUpdate.AppendElement(parentShadow); - } - } - - for (ShadowRoot* shadow : shadowsToUpdate) { - shadow->DistributeAllNodes(); - } + //XXX Handle <slot>. DistributionChanged(); } @@ -475,13 +322,6 @@ ShadowRoot::IsPooledNode(nsIContent* aContent) const return true; } - if (auto* content = HTMLContentElement::FromContentOrNull(container)) { - // Fallback content will end up in pool if its parent is a child of the host. - return content->IsInsertionPoint() && - content->MatchedNodes().IsEmpty() && - container->GetParentNode() == host; - } - return false; } @@ -497,13 +337,6 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument, return; } - // Attributes may change insertion point matching, find its new distribution. - // - // FIXME(emilio): What about state changes? - if (!RedistributeElement(aElement)) { - return; - } - if (!aElement->IsInComposedDoc()) { return; } @@ -513,52 +346,10 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument, return; } + //XXX optimize this! shell->DestroyFramesForAndRestyle(aElement); } -bool -ShadowRoot::RedistributeElement(Element* aElement) -{ - auto* oldInsertionPoint = RemoveDistributedNode(aElement); - auto* newInsertionPoint = DistributeSingleNode(aElement); - - if (oldInsertionPoint == newInsertionPoint) { - if (oldInsertionPoint) { - if (auto* shadow = oldInsertionPoint->GetParent()->GetShadowRoot()) { - return shadow->RedistributeElement(aElement); - } - } - - return false; - } - - while (oldInsertionPoint) { - // 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. - auto* shadow = oldInsertionPoint->GetParent()->GetShadowRoot(); - if (!shadow) { - break; - } - - oldInsertionPoint = shadow->RemoveDistributedNode(aElement); - } - - while (newInsertionPoint) { - // 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. - auto* shadow = newInsertionPoint->GetParent()->GetShadowRoot(); - if (!shadow) { - break; - } - - newInsertionPoint = shadow->DistributeSingleNode(aElement); - } - - return true; -} - void ShadowRoot::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer, @@ -583,31 +374,6 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument, mInsertionPointChanged = false; return; } - - // Add insertion point to destination insertion points of fallback content. - if (nsContentUtils::IsContentInsertionPoint(aContainer)) { - HTMLContentElement* content = HTMLContentElement::FromContent(aContainer); - if (content && content->MatchedNodes().IsEmpty()) { - aChild->DestInsertionPoints().AppendElement(aContainer); - } - } - - // Watch for new nodes added to the pool because the node - // may need to be added to an insertion point. - if (IsPooledNode(aChild)) { - auto* insertionPoint = DistributeSingleNode(aChild); - while (insertionPoint) { - // 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. - auto* parentShadow = insertionPoint->GetParent()->GetShadowRoot(); - if (!parentShadow) { - break; - } - - insertionPoint = parentShadow->DistributeSingleNode(aChild); - } - } } void @@ -622,34 +388,6 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument, mInsertionPointChanged = false; return; } - - // Clear destination insertion points for removed - // fallback content. - if (nsContentUtils::IsContentInsertionPoint(aContainer)) { - HTMLContentElement* content = HTMLContentElement::FromContent(aContainer); - if (content->MatchedNodes().IsEmpty()) { - aChild->DestInsertionPoints().Clear(); - } - } - - // Watch for node that is removed from the pool because - // it may need to be removed from an insertion point. - if (IsPooledNode(aChild)) { - auto* insertionPoint = RemoveDistributedNode(aChild); - while (insertionPoint) { - // 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. - auto* parentShadow = insertionPoint->GetParent()->GetShadowRoot(); - if (!parentShadow) { - break; - } - - insertionPoint = parentShadow->RemoveDistributedNode(aChild); - } - } } nsresult diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h index 4a5b54e85a..5efff5be7c 100644 --- a/dom/base/ShadowRoot.h +++ b/dom/base/ShadowRoot.h @@ -24,7 +24,6 @@ namespace mozilla { namespace dom { class Element; -class HTMLContentElement; class ShadowRootStyleSheetList; class ShadowRoot final : public DocumentFragment, @@ -74,28 +73,6 @@ public: private: /** - * Distributes a single explicit child of the pool host to the content - * insertion points in this ShadowRoot. - * - * Returns the insertion point the element is distributed to after this call. - * - * Note that this doesn't handle distributing the node in the insertion point - * parent's shadow root. - */ - const HTMLContentElement* DistributeSingleNode(nsIContent* aContent); - - /** - * Removes a single explicit child of the pool host from the content - * insertion points in this ShadowRoot. - * - * Returns the old insertion point, if any. - * - * Note that this doesn't handle removing the node in the returned insertion - * point parent's shadow root. - */ - const HTMLContentElement* RemoveDistributedNode(nsIContent* aContent); - - /** * Redistributes a node of the pool, and returns whether the distribution * changed. */ @@ -109,9 +86,6 @@ private: bool IsPooledNode(nsIContent* aChild) const; public: - void AddInsertionPoint(HTMLContentElement* aInsertionPoint); - void RemoveInsertionPoint(HTMLContentElement* aInsertionPoint); - void SetInsertionPointChanged() { mInsertionPointChanged = true; } void SetAssociatedBinding(nsXBLBinding* aBinding) { mAssociatedBinding = aBinding; } @@ -120,9 +94,6 @@ public: static ShadowRoot* FromNode(nsINode* aNode); - static void RemoveDestInsertionPoint(nsIContent* aInsertionPoint, - nsTArray<nsIContent*>& aDestInsertionPoints); - // WebIDL methods. Element* GetElementById(const nsAString& aElementId); already_AddRefed<nsContentList> @@ -147,13 +118,6 @@ protected: ShadowRootMode mMode; - // 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 - // points are kept alive by the parent node, thus weak references are held - // by the array. - nsTArray<HTMLContentElement*> mInsertionPoints; - nsTHashtable<nsIdentifierMapEntry> mIdentifierMap; nsXBLPrototypeBinding* mProtoBinding; diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 3d23bedea5..038da24b43 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -45,7 +45,6 @@ #include "mozilla/dom/FileSystemSecurity.h" #include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLTemplateElement.h" -#include "mozilla/dom/HTMLContentElement.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/dom/Promise.h" @@ -7036,9 +7035,8 @@ nsContentUtils::IsContentInsertionPoint(nsIContent* aContent) } // Check if the content is a web components content insertion point. - HTMLContentElement* contentElement = - HTMLContentElement::FromContent(aContent); - return contentElement && contentElement->IsInsertionPoint(); + // XXX handle <slot>? + return false; } // static @@ -7055,14 +7053,6 @@ nsContentUtils::HasDistributedChildren(nsIContent* aContent) return true; } - HTMLContentElement* contentEl = HTMLContentElement::FromContent(aContent); - if (contentEl && contentEl->IsInsertionPoint()) { - // Children of a content insertion point are distributed to the - // content insertion point if the content insertion point does - // not match any nodes (fallback content). - return contentEl->MatchedNodes().IsEmpty(); - } - return false; } diff --git a/dom/html/HTMLContentElement.cpp b/dom/html/HTMLContentElement.cpp deleted file mode 100644 index 15d79c761a..0000000000 --- a/dom/html/HTMLContentElement.cpp +++ /dev/null @@ -1,379 +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/HTMLContentElement.h" -#include "mozilla/dom/HTMLContentElementBinding.h" -#include "mozilla/dom/HTMLUnknownElement.h" -#include "mozilla/dom/NodeListBinding.h" -#include "mozilla/dom/ShadowRoot.h" -#include "mozilla/css/StyleRule.h" -#include "nsGkAtoms.h" -#include "nsStyleConsts.h" -#include "nsIAtom.h" -#include "nsCSSRuleProcessor.h" -#include "nsRuleData.h" -#include "nsRuleProcessorData.h" -#include "nsRuleWalker.h" -#include "nsCSSParser.h" -#include "nsDocument.h" - -// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Content) to add check for web components -// being enabled. -nsGenericHTMLElement* -NS_NewHTMLContentElement(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::IsHTMLContentElement. - // - // 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::HTMLContentElement(nodeInfoArg); -} - -using namespace mozilla::dom; - -HTMLContentElement::HTMLContentElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) - : nsGenericHTMLElement(aNodeInfo), mValidSelector(true), mIsInsertionPoint(false) -{ -} - -HTMLContentElement::~HTMLContentElement() -{ -} - -NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLContentElement, - nsGenericHTMLElement, - mMatchedNodes) - -NS_IMPL_ADDREF_INHERITED(HTMLContentElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLContentElement, Element) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLContentElement) -NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) - -NS_IMPL_ELEMENT_CLONE(HTMLContentElement) - -JSObject* -HTMLContentElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) -{ - return HTMLContentElementBinding::Wrap(aCx, this, aGivenProto); -} - -nsresult -HTMLContentElement::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) { - nsINode* parentNode = nsINode::GetParentNode(); - while (parentNode && parentNode != containingShadow) { - if (parentNode->IsHTMLContentElement()) { - // Content element in fallback content is not an insertion point. - return NS_OK; - } - parentNode = parentNode->GetParentNode(); - } - - // If the content element is being inserted into a ShadowRoot, - // add this element to the list of insertion points. - mIsInsertionPoint = true; - containingShadow->AddInsertionPoint(this); - containingShadow->SetInsertionPointChanged(); - } - - return NS_OK; -} - -void -HTMLContentElement::UnbindFromTree(bool aDeep, bool aNullParent) -{ - RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow(); - - nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); - - if (oldContainingShadow && !GetContainingShadow() && mIsInsertionPoint) { - oldContainingShadow->RemoveInsertionPoint(this); - - // Remove all the matched nodes now that the - // insertion point is no longer an insertion point. - ClearMatchedNodes(); - oldContainingShadow->SetInsertionPointChanged(); - - mIsInsertionPoint = false; - } -} - -void -HTMLContentElement::AppendMatchedNode(nsIContent* aContent) -{ - mMatchedNodes.AppendElement(aContent); - nsTArray<nsIContent*>& destInsertionPoint = aContent->DestInsertionPoints(); - destInsertionPoint.AppendElement(this); - - if (mMatchedNodes.Length() == 1) { - // Fallback content gets dropped so we need to updated fallback - // content distribution. - UpdateFallbackDistribution(); - } -} - -void -HTMLContentElement::UpdateFallbackDistribution() -{ - for (nsIContent* child = nsINode::GetFirstChild(); - child; - child = child->GetNextSibling()) { - nsTArray<nsIContent*>& destInsertionPoint = child->DestInsertionPoints(); - destInsertionPoint.Clear(); - if (mMatchedNodes.IsEmpty()) { - destInsertionPoint.AppendElement(this); - } - } -} - -void -HTMLContentElement::RemoveMatchedNode(nsIContent* aContent) -{ - mMatchedNodes.RemoveElement(aContent); - ShadowRoot::RemoveDestInsertionPoint(this, aContent->DestInsertionPoints()); - - if (mMatchedNodes.IsEmpty()) { - // Fallback content is activated so we need to update fallback - // content distribution. - UpdateFallbackDistribution(); - } -} - -void -HTMLContentElement::InsertMatchedNode(uint32_t aIndex, nsIContent* aContent) -{ - mMatchedNodes.InsertElementAt(aIndex, aContent); - nsTArray<nsIContent*>& destInsertionPoint = aContent->DestInsertionPoints(); - destInsertionPoint.AppendElement(this); - - if (mMatchedNodes.Length() == 1) { - // Fallback content gets dropped so we need to updated fallback - // content distribution. - UpdateFallbackDistribution(); - } -} - -void -HTMLContentElement::ClearMatchedNodes() -{ - for (uint32_t i = 0; i < mMatchedNodes.Length(); i++) { - ShadowRoot::RemoveDestInsertionPoint(this, mMatchedNodes[i]->DestInsertionPoints()); - } - - mMatchedNodes.Clear(); - - UpdateFallbackDistribution(); -} - -static bool -IsValidContentSelectors(nsCSSSelector* aSelector) -{ - nsCSSSelector* currentSelector = aSelector; - while (currentSelector) { - // Blacklist invalid selector fragments. - if (currentSelector->IsPseudoElement() || - currentSelector->mPseudoClassList || - currentSelector->mNegations || - currentSelector->mOperator) { - return false; - } - - currentSelector = currentSelector->mNext; - } - - return true; -} - -nsresult -HTMLContentElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, - const nsAttrValue* aValue, - const nsAttrValue* aOldValue, bool aNotify) -{ - if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::select) { - if (aValue) { - // Select attribute was updated, the insertion point may match different - // elements. - nsIDocument* doc = OwnerDoc(); - nsCSSParser parser(doc->CSSLoader()); - - mValidSelector = true; - mSelectorList = nullptr; - - nsAutoString valueStr; - aValue->ToString(valueStr); - nsresult rv = parser.ParseSelectorString(valueStr, - doc->GetDocumentURI(), - // Bug 11240 - 0, // XXX get the line number! - getter_Transfers(mSelectorList)); - - // We don't want to return an exception if parsing failed because - // the spec does not define it as an exception case. - if (NS_SUCCEEDED(rv)) { - // Ensure that all the selectors are valid - nsCSSSelectorList* selectors = mSelectorList; - while (selectors) { - if (!IsValidContentSelectors(selectors->mSelectors)) { - // If we have an invalid selector, we can not match anything. - mValidSelector = false; - mSelectorList = nullptr; - break; - } - selectors = selectors->mNext; - } - } - - if (ShadowRoot* containingShadow = GetContainingShadow()) { - containingShadow->DistributeAllNodes(); - } - } else { - // The select attribute was removed. This insertion point becomes - // a universal selector. - mValidSelector = true; - mSelectorList = nullptr; - - if (ShadowRoot* containingShadow = GetContainingShadow()) { - containingShadow->DistributeAllNodes(); - } - } - } - - return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue, - aOldValue, aNotify); -} - -bool -HTMLContentElement::Match(nsIContent* aContent) -{ - if (!mValidSelector) { - return false; - } - - if (mSelectorList) { - nsIDocument* doc = OwnerDoc(); - ShadowRoot* containingShadow = GetContainingShadow(); - nsIContent* host = containingShadow->GetHost(); - - TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited, - doc, TreeMatchContext::eNeverMatchVisited); - doc->FlushPendingLinkUpdates(); - matchingContext.SetHasSpecifiedScope(); - matchingContext.AddScopeElement(host->AsElement()); - - if (!aContent->IsElement()) { - return false; - } - - return nsCSSRuleProcessor::SelectorListMatches(aContent->AsElement(), - matchingContext, - mSelectorList); - } - - return true; -} - -already_AddRefed<DistributedContentList> -HTMLContentElement::GetDistributedNodes() -{ - RefPtr<DistributedContentList> list = new DistributedContentList(this); - return list.forget(); -} - -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DistributedContentList, mParent, - mDistributedNodes) - -NS_INTERFACE_TABLE_HEAD(DistributedContentList) - NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY - NS_INTERFACE_TABLE(DistributedContentList, nsINodeList, nsIDOMNodeList) - NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(DistributedContentList) -NS_INTERFACE_MAP_END - -NS_IMPL_CYCLE_COLLECTING_ADDREF(DistributedContentList) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DistributedContentList) - -DistributedContentList::DistributedContentList(HTMLContentElement* aHostElement) - : mParent(aHostElement) -{ - MOZ_COUNT_CTOR(DistributedContentList); - - if (aHostElement->IsInsertionPoint()) { - if (aHostElement->MatchedNodes().IsEmpty()) { - // Fallback content. - nsINode* contentNode = aHostElement; - for (nsIContent* content = contentNode->GetFirstChild(); - content; - content = content->GetNextSibling()) { - mDistributedNodes.AppendElement(content); - } - } else { - mDistributedNodes.AppendElements(aHostElement->MatchedNodes()); - } - } -} - -DistributedContentList::~DistributedContentList() -{ - MOZ_COUNT_DTOR(DistributedContentList); -} - -nsIContent* -DistributedContentList::Item(uint32_t aIndex) -{ - return mDistributedNodes.SafeElementAt(aIndex); -} - -NS_IMETHODIMP -DistributedContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn) -{ - nsIContent* item = Item(aIndex); - if (!item) { - return NS_ERROR_FAILURE; - } - - return CallQueryInterface(item, aReturn); -} - -NS_IMETHODIMP -DistributedContentList::GetLength(uint32_t* aLength) -{ - *aLength = mDistributedNodes.Length(); - return NS_OK; -} - -int32_t -DistributedContentList::IndexOf(nsIContent* aContent) -{ - return mDistributedNodes.IndexOf(aContent); -} - -JSObject* -DistributedContentList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) -{ - return NodeListBinding::Wrap(aCx, this, aGivenProto); -} - diff --git a/dom/html/HTMLContentElement.h b/dom/html/HTMLContentElement.h deleted file mode 100644 index 630e26d17d..0000000000 --- a/dom/html/HTMLContentElement.h +++ /dev/null @@ -1,126 +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_HTMLContentElement_h__ -#define mozilla_dom_HTMLContentElement_h__ - -#include "nsAutoPtr.h" -#include "nsINodeList.h" -#include "nsGenericHTMLElement.h" - -struct nsCSSSelectorList; - -namespace mozilla { -namespace dom { - -class DistributedContentList; - -class HTMLContentElement final : public nsGenericHTMLElement -{ -public: - explicit HTMLContentElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLContentElement, - nsGenericHTMLElement) - - NS_IMPL_FROMCONTENT_HELPER(HTMLContentElement, IsHTMLContentElement()) - - virtual bool IsHTMLContentElement() const override { return true; } - - virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override; - - virtual nsIDOMNode* AsDOMNode() override { return this; } - - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, - bool aCompileEventHandlers) override; - - virtual void UnbindFromTree(bool aDeep = true, - bool aNullParent = true) override; - - /** - * Returns whether if the selector of this insertion point - * matches the provided content. - */ - bool Match(nsIContent* aContent); - bool IsInsertionPoint() const { return mIsInsertionPoint; } - nsCOMArray<nsIContent>& MatchedNodes() { return mMatchedNodes; } - void AppendMatchedNode(nsIContent* aContent); - void RemoveMatchedNode(nsIContent* aContent); - void InsertMatchedNode(uint32_t aIndex, nsIContent* aContent); - void ClearMatchedNodes(); - - // WebIDL methods. - already_AddRefed<DistributedContentList> GetDistributedNodes(); - void GetSelect(nsAString& aSelect) - { - Element::GetAttr(kNameSpaceID_None, nsGkAtoms::select, aSelect); - } - void SetSelect(const nsAString& aSelect) - { - Element::SetAttr(kNameSpaceID_None, nsGkAtoms::select, aSelect, true); - } - -protected: - virtual ~HTMLContentElement(); - - virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; - - /** - * Updates the destination insertion points of the fallback - * content of this insertion point. If there are nodes matched - * to this insertion point, then destination insertion points - * of fallback are cleared, otherwise, this insertion point - * is a destination insertion point. - */ - void UpdateFallbackDistribution(); - - virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, - const nsAttrValue* aValue, - const nsAttrValue* aOldValue, - bool aNotify) override; - - /** - * An array of nodes from the ShadowRoot host that match the - * content insertion selector. - */ - nsCOMArray<nsIContent> mMatchedNodes; - - nsAutoPtr<nsCSSSelectorList> mSelectorList; - bool mValidSelector; - bool mIsInsertionPoint; -}; - -class DistributedContentList : public nsINodeList -{ -public: - explicit DistributedContentList(HTMLContentElement* aHostElement); - - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DistributedContentList) - - // nsIDOMNodeList - NS_DECL_NSIDOMNODELIST - - // nsINodeList - virtual nsIContent* Item(uint32_t aIndex) override; - virtual int32_t IndexOf(nsIContent* aContent) override; - virtual nsINode* GetParentObject() override { return mParent; } - virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; -protected: - virtual ~DistributedContentList(); - RefPtr<HTMLContentElement> mParent; - nsCOMArray<nsIContent> mDistributedNodes; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_HTMLContentElement_h__ - diff --git a/dom/html/moz.build b/dom/html/moz.build index 79554df219..342b027a5d 100644 --- a/dom/html/moz.build +++ b/dom/html/moz.build @@ -52,7 +52,6 @@ EXPORTS.mozilla.dom += [ 'HTMLBRElement.h', 'HTMLButtonElement.h', 'HTMLCanvasElement.h', - 'HTMLContentElement.h', 'HTMLDataElement.h', 'HTMLDataListElement.h', 'HTMLDetailsElement.h', @@ -131,7 +130,6 @@ UNIFIED_SOURCES += [ 'HTMLBRElement.cpp', 'HTMLButtonElement.cpp', 'HTMLCanvasElement.cpp', - 'HTMLContentElement.cpp', 'HTMLDataElement.cpp', 'HTMLDataListElement.cpp', 'HTMLDetailsElement.cpp', diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini index 2cfd747c4e..d56196272b 100644 --- a/dom/tests/mochitest/webcomponents/mochitest.ini +++ b/dom/tests/mochitest/webcomponents/mochitest.ini @@ -25,11 +25,7 @@ skip-if = !debug # TestFunctions only applied in debug builds [test_custom_element_define.html] [test_custom_element_define_parser.html] [test_custom_element_template.html] -[test_nested_content_element.html] -[test_dest_insertion_points.html] -[test_fallback_dest_insertion_points.html] [test_detached_style.html] -[test_dynamic_content_element_matching.html] [test_document_adoptnode.html] [test_document_importnode.html] [test_document_register.html] diff --git a/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html deleted file mode 100644 index 2d4a92ed28..0000000000 --- a/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html +++ /dev/null @@ -1,73 +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 content element. -var shadowRoot = host.createShadowRoot(); -shadowRoot.innerHTML = '<div id="innerhost"><content id="innercontent" select=".red"></content></div>'; -var innerContent = shadowRoot.getElementById("innercontent"); - -var span = document.createElement("span"); -span.setAttribute("class", "red blue"); -is(host.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty when not being distributed."); - -host.appendChild(span); - -is(span.getDestinationInsertionPoints().length, 1, "Destination insertion points should only contain a single content insertion point."); -is(span.getDestinationInsertionPoints()[0], innerContent, "Content element should contain destination insertion point."); - -// Test destination insertion points of redistributed node. -var innerHost = shadowRoot.getElementById("innerhost"); -var innerShadowRoot = innerHost.createShadowRoot(); -innerShadowRoot.innerHTML = '<content id="innerinnercontent" select=".blue"></content>'; - -var innerInnerContent = innerShadowRoot.getElementById("innerinnercontent"); - -is(span.getDestinationInsertionPoints().length, 2, "Redistributed node should have 2 destination insertion points."); -is(span.getDestinationInsertionPoints()[1], innerInnerContent, "Nested content insertion point should be in list of destination insertion points."); - -// Test destination insertion points after removing reprojection onto second content element. -span.setAttribute("class", "red"); -is(span.getDestinationInsertionPoints().length, 1, "Destination insertion points should only contain 1 insertion point after removing reprojection."); -is(span.getDestinationInsertionPoints()[0], innerContent, "First content element should be only insertion point after removing reprojection."); - -// Test destination insertion points after removing the projected content from the host. -host.removeChild(span); -is(span.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after being removed from the shadow host."); - -// Test destination insertion points of distributed content after removing insertion point. -var div = document.createElement("div"); -div.setAttribute("class", "red blue"); -host.appendChild(div); - -is(div.getDestinationInsertionPoints().length, 2, "Div should be distributed into 2 insertion points."); - -innerShadowRoot.removeChild(innerInnerContent); - -is(div.getDestinationInsertionPoints().length, 1, "Div should be distributed into insertion point in one ShadowRoot."); -is(div.getDestinationInsertionPoints()[0], innerContent, "Destination insertion points should only contain content insertion point in first ShadowRoot."); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html b/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html deleted file mode 100644 index c9af76610c..0000000000 --- a/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html +++ /dev/null @@ -1,50 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=806506 ---> -<head> - <title>Test for dynamic changes to content matching content elements</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> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a> -<script> -// Create ShadowRoot. -var elem = document.createElement("div"); -var root = elem.createShadowRoot(); - -var redInsertionPoint = document.createElement("content"); -redInsertionPoint.select = "*[data-color=red]"; - -var blueInsertionPoint = document.createElement("content"); -blueInsertionPoint.select = "*[data-color=blue]"; - -root.appendChild(redInsertionPoint); -root.appendChild(blueInsertionPoint); - -is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes."); -is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should have no distrubted nodes."); - -var matchElement = document.createElement("div"); -matchElement.setAttribute("data-color", "red"); -elem.appendChild(matchElement); - -is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes."); -is(redInsertionPoint.getDistributedNodes().length, 1, "Red insertion point should match recently inserted div."); - -matchElement.setAttribute("data-color", "blue"); -is(blueInsertionPoint.getDistributedNodes().length, 1, "Blue insertion point should match element after changing attribute value."); -is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should not match element after changing attribute value."); - -matchElement.removeAttribute("data-color"); - -is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes after removing the matching attribute."); -is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should have no distrubted nodes after removing the matching attribute."); - -</script> -</body> -</html> - diff --git a/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html deleted file mode 100644 index 4eefa165f2..0000000000 --- a/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html +++ /dev/null @@ -1,71 +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 content element. -var shadowRoot = host.createShadowRoot(); -shadowRoot.innerHTML = '<div id="innerhost"><content id="innercontent"></content></div>'; - -var fallback = document.createElement("span"); -var innerContent = shadowRoot.getElementById("innercontent"); - -innerContent.appendChild(fallback); - -is(fallback.getDestinationInsertionPoints().length, 1, "Active fallback content should be distributed to insertion point."); -is(fallback.getDestinationInsertionPoints()[0], innerContent, "Insertion point should be in list of destination insertion points."); - -// Test destination insertion points of reprojected fallback content. -var innerHost = shadowRoot.getElementById("innerhost"); -var innerShadowRoot = innerHost.createShadowRoot(); -innerShadowRoot.innerHTML = '<content id="innerinnercontent"></content>'; - -var innerInnerContent = innerShadowRoot.getElementById("innerinnercontent"); - -is(fallback.getDestinationInsertionPoints().length, 2, "Fallback content should have been distributed into parent and reprojected into another insertion point."); -is(fallback.getDestinationInsertionPoints()[1], innerInnerContent, "Destination insertion points should contain content element to which the node was reprojected."); - -// Test destination insertion points of fallback content that was dropped due to content element matching a node in the host. -var span = document.createElement("span"); -host.appendChild(span); - -is(fallback.getDestinationInsertionPoints().length, 0, "After dropping insertion points, fallback content should not have any nodes in destination insertion points list."); - -// Test destination insertion points of fallback content after reactivating by dropping matched content on host. -host.removeChild(span); -is(fallback.getDestinationInsertionPoints().length, 2, "Fallback content should have 2 destination insertion points after being reactivated."); -is(fallback.getDestinationInsertionPoints()[0], innerContent, "First destination insertion point should be the parent content"); -is(fallback.getDestinationInsertionPoints()[1], innerInnerContent, "Second destination insertion point should be the content to which the node is reprojected."); - -// Test destination insertion points of fallback content after removed from the tree. -innerContent.removeChild(fallback); -is(fallback.getDestinationInsertionPoints().length, 0, "Fallback content is no longer fallback content, destination insertion points should be empty."); - -// Test destination insertion points of child of non-insertion point content element. -var notInsertionPointContent = document.createElement("content"); -var notFallback = document.createElement("span"); -notInsertionPointContent.appendChild(notFallback); -is(notFallback.getDestinationInsertionPoints().length, 0, "Child of non-insertion point content should not be distributed to any nodes."); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_nested_content_element.html b/dom/tests/mochitest/webcomponents/test_nested_content_element.html deleted file mode 100644 index 1d98d2996b..0000000000 --- a/dom/tests/mochitest/webcomponents/test_nested_content_element.html +++ /dev/null @@ -1,127 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=806506 ---> -<head> - <title>Test for HTMLContent element</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 id="grabme"></div> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a> -<script> - -/** - * Constructs a node with a nested ShadowRoot with the following structure: - * <span> - - - - - - - - - - <ShadowRoot> - * <span> <span> - - - - - - - - - - <ShadowRoot> - * id=one id=four <span> - * data-color=red data-color=orange id=eleven - * <span> <span> <content> - * id=two id=five id=twelve - * data-color=blue data-color=purple select=secondSelect - * <span> <content> <span> - * id=three id=six id=thirteen - * data-color=green select=firstSelect - * <span> - * id=seven - * <content> - * id=eight - * <span> - * id=nine - * <span> - * id=ten - * data-color=grey - */ -function constructTree(firstSelect, secondSelect) { - var rootSpan = document.createElement("span"); - rootSpan.innerHTML = '<span id="one" data-color="red"></span><span id="two" data-color="blue"></span><span id="three" data-color="green"></span>'; - var firstShadow = rootSpan.createShadowRoot(); - firstShadow.innerHTML = '<span id="four" data-color="orange"><span id="five" data-color="purple"></span><content id="six" select="' + firstSelect + '"><span id="seven"></span><content id="eight"></content><span id="nine"></span></content><span id="ten"></span></span>'; - var secondShadow = firstShadow.firstChild.createShadowRoot(); - secondShadow.innerHTML = '<span id="eleven"></span><content id="twelve" select="' + secondSelect + '"></content><span id="thirteen"></span>'; - return rootSpan; -} - -// Create a tree with content that matches on everything and check node distribution. -var allSpan = constructTree("*", "*"); -var firstContent = allSpan.shadowRoot.getElementById("six"); -var firstDistNodes = firstContent.getDistributedNodes(); -is(firstDistNodes.length, 3, "Universal selector should match all nodes."); -// Check the order of the distributed nodes. -is(firstDistNodes.item(0).id, "one", "First distributed node should have id of 'one'"); -is(firstDistNodes.item(1).id, "two", "Second distributed node should have id of 'two'"); -is(firstDistNodes.item(2).id, "three", "Third distributed node should have id of 'three'"); -var secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve"); -var secondDistNodes = secondContent.getDistributedNodes(); -is(secondDistNodes.length, 5, "Universial selector should match all nodes including those distributed into content."); -// Check the order of the distribute nodes. -is(secondDistNodes.item(0).id, "five", "First distributed node should have id of 'five'"); -is(secondDistNodes.item(1).id, "one", "Second distributed (reprojected) node should have id of 'one'"); -is(secondDistNodes.item(2).id, "two", "Third distributed (reprojected) node should have id of 'two'"); -is(secondDistNodes.item(3).id, "three", "Fourth distributed (reprojected) node should have id of 'three'"); -is(secondDistNodes.item(4).id, "ten", "Fifth distributed node should have id of 'ten'"); - -// Append an element after id=two and make sure that it is inserted into the corrent -// position in the insertion points. -var additionalSpan = document.createElement("span"); -additionalSpan.id = "additional"; - -// Insert the additional span in the third position, before the span with id=three. -allSpan.insertBefore(additionalSpan, allSpan.childNodes.item(2)); -firstDistNodes = firstContent.getDistributedNodes(); -secondDistNodes = secondContent.getDistributedNodes(); -is(firstDistNodes.length, 4, "First insertion point should match one more node."); -is(firstDistNodes.item(2).id, "additional", "Additional span should have been inserted into the third position of the first insertion point."); - -is(secondDistNodes.length, 6, "Second insertion point should match one more node."); -is(secondDistNodes.item(3).id, "additional", "Additional span should have been inserted into the fourth position of the second insertion point."); - -function nodeListDoesNotContain(nodeList, element) { - for (var i = 0; i < nodeList.length; i++) { - if (nodeList[i] == element) { - return false; - } - } - return true; -} - -// Remove the span with id=one and check that it is removed from all insertion points. -allSpan = constructTree("*", "*"); -var spanOne = allSpan.firstChild; -allSpan.removeChild(spanOne); -firstContent = allSpan.shadowRoot.getElementById("six"); -ok(nodeListDoesNotContain(firstContent.getDistributedNodes(), spanOne), "Child removed from host should not appear in insertion point node list."); -secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve"); -ok(nodeListDoesNotContain(secondContent.getDistributedNodes(), spanOne), "Child removed from host should not appear in nested insertion point node list."); - -// Make sure <content> in fallback content is inactive. -// First insertion point will not match anything and will use fallback content. -allSpan = constructTree("#nomatch", "*"); -var fallbackInsertionPoint = allSpan.shadowRoot.getElementById("eight"); -is(fallbackInsertionPoint.getDistributedNodes().length, 0, "Insertion points in default content should be inactive."); - -// Insertion points with non-universal selectors. -allSpan = constructTree("span[data-color=blue]", "*"); -firstContent = allSpan.shadowRoot.getElementById("six"); -is(firstContent.getDistributedNodes().length, 1, "Insertion point selector should only match one node."); -is(firstContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector."); -secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve"); -is(secondContent.getDistributedNodes().length, 3, "Second insertion point should match two children and one reprojected node."); -is(secondContent.getDistributedNodes()[1].dataset.color, "blue", "Projected node should match selector."); - -allSpan = constructTree("span[data-color=blue]", "span[data-color=blue]"); -firstContent = allSpan.shadowRoot.getElementById("six"); -is(firstContent.getDistributedNodes().length, 1, "Insertion point selector should only match one node."); -is(firstContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector."); -secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve"); -is(secondContent.getDistributedNodes().length, 1, "Insertion point should only match reprojected node."); -is(secondContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector."); - -// Make sure that dynamically appended default content will get distributed. -</script> -</body> -</html> - diff --git a/dom/webidl/HTMLContentElement.webidl b/dom/webidl/HTMLContentElement.webidl deleted file mode 100644 index ea809f120c..0000000000 --- a/dom/webidl/HTMLContentElement.webidl +++ /dev/null @@ -1,20 +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 HTMLContentElement : HTMLElement -{ - attribute DOMString select; - NodeList getDistributedNodes(); -}; - diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index ae97bbb30b..d76a58e1f7 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -177,7 +177,6 @@ WEBIDL_FILES = [ 'HTMLButtonElement.webidl', 'HTMLCanvasElement.webidl', 'HTMLCollection.webidl', - 'HTMLContentElement.webidl', 'HTMLDataElement.webidl', 'HTMLDataListElement.webidl', 'HTMLDetailsElement.webidl', diff --git a/editor/libeditor/HTMLEditUtils.cpp b/editor/libeditor/HTMLEditUtils.cpp index 89abbe49cb..aa0afda98c 100644 --- a/editor/libeditor/HTMLEditUtils.cpp +++ b/editor/libeditor/HTMLEditUtils.cpp @@ -634,7 +634,6 @@ static const ElementInfo kElements[eHTMLTag_userdefined] = { GROUP_TABLE_CONTENT | GROUP_COLGROUP_CONTENT, GROUP_NONE), ELEM(colgroup, true, false, GROUP_NONE, GROUP_COLGROUP_CONTENT), - ELEM(content, true, false, GROUP_NONE, GROUP_INLINE_ELEMENT), ELEM(data, true, false, GROUP_PHRASE, GROUP_INLINE_ELEMENT), ELEM(datalist, true, diff --git a/layout/inspector/tests/test_bug522601.xhtml b/layout/inspector/tests/test_bug522601.xhtml index 7c5a9e79c5..c49f2fa83c 100644 --- a/layout/inspector/tests/test_bug522601.xhtml +++ b/layout/inspector/tests/test_bug522601.xhtml @@ -237,6 +237,8 @@ addLoadEvent(function() { testFunc(walkerAnon, "previousNode", $("display"), "step back to root (anon)"); testFunc(walkerAnon, "previousNode", null, "step back past root (anon)"); + //XXXsmaug update this test for Shadow DOM v1! bug 1421539 + /*if (Element.prototype.createShadowRoot) { var shadowdiv = document.querySelector('#test-shadow'); var shadowRoot = shadowdiv.createShadowRoot(); var h = document.createElement("header"); @@ -266,6 +268,7 @@ addLoadEvent(function() { SimpleTest.finish(); }); + }*/ ]]> </script> diff --git a/layout/reftests/forms/legend/reftest.list b/layout/reftests/forms/legend/reftest.list index 879835a59b..03e25eb201 100644 --- a/layout/reftests/forms/legend/reftest.list +++ b/layout/reftests/forms/legend/reftest.list @@ -1,3 +1,3 @@ == legend.html legend-ref.html -fuzzy-if(skiaContent,1,7) pref(dom.webcomponents.enabled,true) == shadow-dom.html shadow-dom-ref.html +#bug 1418002 fuzzy-if(skiaContent,1,7) pref(dom.webcomponents.enabled,true) == shadow-dom.html shadow-dom-ref.html == 1273433.html 1273433-ref.html diff --git a/layout/reftests/webcomponents/reftest.list b/layout/reftests/webcomponents/reftest.list index e0a30a520b..280cd204e3 100644 --- a/layout/reftests/webcomponents/reftest.list +++ b/layout/reftests/webcomponents/reftest.list @@ -3,13 +3,13 @@ pref(dom.webcomponents.enabled,true) == basic-shadow-1.html basic-shadow-1-ref.h pref(dom.webcomponents.enabled,true) == basic-shadow-2.html basic-shadow-2-ref.html pref(dom.webcomponents.enabled,true) == basic-shadow-3.html basic-shadow-3-ref.html 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 +#bug 1421542 pref(dom.webcomponents.enabled,true) == basic-insertion-point-1.html basic-insertion-point-1-ref.html +#bug 1421542 pref(dom.webcomponents.enabled,true) == basic-insertion-point-2.html basic-insertion-point-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) == update-dist-node-descendants-1.html update-dist-node-descendants-1-ref.html +#bug 1421542 pref(dom.webcomponents.enabled,true) == nested-insertion-point-1.html nested-insertion-point-1-ref.html +#bug 1421542 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 +#bug 1421542 pref(dom.webcomponents.enabled,true) == dynamic-insertion-point-distribution-1.html dynamic-insertion-point-distribution-1-ref.html pref(dom.webcomponents.enabled,true) == dynamic-insertion-point-distribution-2.html dynamic-insertion-point-distribution-2-ref.html pref(dom.webcomponents.enabled,true) == remove-append-shadow-host-1.html remove-append-shadow-host-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 5ab5a4ff89..4b87d3fde2 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 @@ -1987,10 +1987,6 @@ public final class ElementName // CPPONLY: NS_NewHTMLUnknownElement, // CPPONLY: NS_NewSVGUnknownElement, TreeBuilder.OTHER); - public static final ElementName CONTENT = new ElementName("content", "content", - // CPPONLY: NS_NewHTMLContentElement, - // CPPONLY: NS_NewSVGUnknownElement, - TreeBuilder.OTHER); public static final ElementName GT = new ElementName("gt", "gt", // CPPONLY: NS_NewHTMLUnknownElement, // CPPONLY: NS_NewSVGUnknownElement, @@ -2277,14 +2273,14 @@ public final class ElementName FIELDSET, DATA, LI, - COMPLEXES, + CANVAS, QUOTIENT, PRE, ARTICLE, DIALOG, ARCTAN, LISTENER, - RATIONALS, + REALS, MROOT, MROW, GEQ, @@ -2296,9 +2292,9 @@ public final class ElementName INTERVAL, MN, BR, - POWER, - MMULTISCRIPTS, - CONTENT, + NOTANUMBER, + MPRESCRIPTS, + CARTESIANPRODUCT, INTERSECT, RT, SCRIPT, @@ -2321,11 +2317,11 @@ public final class ElementName OPTION, MALIGNGROUP, FECOMPONENTTRANSFER, - MERROR, - VECTOR, - IMPLIES, - PRIMES, - APPLET, + MUNDEROVER, + SELECTOR, + EXISTS, + NATURALNUMBERS, + DT, EMPTYSET, FEPOINTLIGHT, LOWLIMIT, @@ -2371,16 +2367,16 @@ public final class ElementName OPTGROUP, CENTER, FEGAUSSIANBLUR, - MOVER, - NOBR, - SOLIDCOLOR, - ADDRESS, - DETAILS, - MS, - NOFRAMES, - PLUS, - TIMES, - BASEFONT, + METER, + MLABELEDTR, + TR, + ARCCOS, + DEFS, + INTEGERS, + MINUS, + PROGRESS, + SEMANTICS, + ARCCOT, DETERMINANT, FONT_FACE_FORMAT, FEOFFSET, @@ -2472,25 +2468,25 @@ 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, + MOVER, + MERROR, + NOBR, + POWER, + SOLIDCOLOR, + VECTOR, + ADDRESS, + COMPLEXES, + DETAILS, + IMPLIES, + MS, + MMULTISCRIPTS, + NOFRAMES, + PRIMES, + PLUS, + RATIONALS, + TIMES, + APPLET, + BASEFONT, GT, DATALIST, EQUIVALENT, @@ -2672,7 +2668,6 @@ public final class ElementName HEADER, OR, MUNDER, - METER, }; private final static int[] ELEMENT_HASHES = { 1909280949, @@ -2680,14 +2675,14 @@ public final class ElementName 2001349704, 1681770564, 1818230786, - 1983002201, + 1982935782, 2007257240, 58773795, 1747176599, 1782357526, 1897999926, 1970938456, - 1990969577, + 1990969429, 2005181733, 2055514836, 54061139, @@ -2699,9 +2694,9 @@ public final class ElementName 1868641064, 1902641154, 1963982850, - 1973040373, - 1988486813, - 1999917383, + 1971981018, + 1988486811, + 1999745104, 2002882873, 2005925890, 2008340774, @@ -2724,11 +2719,11 @@ public final class ElementName 1905563974, 1938171179, 1967788867, - 1971628838, - 1976348214, - 1986140359, - 1989812374, - 1998724870, + 1971467002, + 1974775352, + 1984294038, + 1988972590, + 1998585858, 2000825752, 2001392796, 2004557976, @@ -2774,16 +2769,16 @@ public final class ElementName 1939219752, 1966223078, 1968053806, - 1971466997, - 1971938532, - 1974771450, - 1982173479, - 1983633431, - 1986527234, - 1988763672, - 1990074116, - 1991909525, - 1999397992, + 1971465813, + 1971703386, + 1973420034, + 1982106678, + 1983533124, + 1986351224, + 1988502165, + 1990037800, + 1991350601, + 1998883894, 2000439531, 2001281328, 2001349736, @@ -2875,25 +2870,25 @@ 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, + 1971466997, + 1971628838, + 1971938532, + 1973040373, + 1974771450, + 1976348214, + 1982173479, + 1983002201, + 1983633431, + 1986140359, + 1986527234, + 1988486813, + 1988763672, + 1989812374, + 1990074116, + 1990969577, + 1991909525, + 1998724870, + 1999397992, 2000158722, 2000525512, 2000965834, @@ -3075,6 +3070,5 @@ public final class ElementName 1968836118, 1970798594, 1971457766, - 1971465813, }; } diff --git a/parser/html/nsHtml5ElementName.cpp b/parser/html/nsHtml5ElementName.cpp index 788c9e36cf..ecdfb102d4 100644 --- a/parser/html/nsHtml5ElementName.cpp +++ b/parser/html/nsHtml5ElementName.cpp @@ -416,7 +416,6 @@ nsHtml5ElementName* nsHtml5ElementName::ELT_APPLET = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_ARCCOT = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_BASEFONT = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_CARTESIANPRODUCT = nullptr; -nsHtml5ElementName* nsHtml5ElementName::ELT_CONTENT = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_GT = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_DETERMINANT = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_DATALIST = 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, 2055514836, 54061139, 62390273, 1730150402, 1749395095, 1756625221, 1798693940, 1868641064, 1902641154, 1963982850, 1973040373, 1988486813, 1999917383, 2002882873, 2005925890, 2008340774, 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, 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, 1971466997, 1971938532, 1974771450, 1982173479, 1983633431, 1986527234, 1988763672, 1990074116, 1991909525, 1999397992, 2000439531, 2001281328, 2001349736, 2001495140, 2003183333, 2004719812, 2005279787, 2005719336, 2006036556, 2006896969, 2007781534, 2008165414, 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, 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, 2008325940, 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, 1971465813 }; +static int32_t const ELEMENT_HASHES_DATA[] = { 1909280949, 1753057319, 2001349704, 1681770564, 1818230786, 1982935782, 2007257240, 58773795, 1747176599, 1782357526, 1897999926, 1970938456, 1990969429, 2005181733, 2055514836, 54061139, 62390273, 1730150402, 1749395095, 1756625221, 1798693940, 1868641064, 1902641154, 1963982850, 1971981018, 1988486811, 1999745104, 2002882873, 2005925890, 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, 2000825752, 2001392796, 2004557976, 2005543977, 2006560839, 2008125638, 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, 2000439531, 2001281328, 2001349736, 2001495140, 2003183333, 2004719812, 2005279787, 2005719336, 2006036556, 2006896969, 2007781534, 2008165414, 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, 2000158722, 2000525512, 2000965834, 2001309869, 2001349720, 2001392795, 2001392798, 2002780162, 2003062853, 2004557973, 2004635806, 2005160150, 2005231925, 2005324101, 2005543979, 2005766372, 2006028454, 2006329158, 2006592552, 2006974466, 2007601444, 2007803172, 2008133709, 2008325940, 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() @@ -824,7 +823,6 @@ nsHtml5ElementName::initializeStatics() ELT_ARCCOT = new nsHtml5ElementName(nsHtml5Atoms::arccot, nsHtml5Atoms::arccot, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_BASEFONT = new nsHtml5ElementName(nsHtml5Atoms::basefont, nsHtml5Atoms::basefont, NS_NewHTMLElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL); ELT_CARTESIANPRODUCT = new nsHtml5ElementName(nsHtml5Atoms::cartesianproduct, nsHtml5Atoms::cartesianproduct, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); - ELT_CONTENT = new nsHtml5ElementName(nsHtml5Atoms::content, nsHtml5Atoms::content, NS_NewHTMLContentElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_GT = new nsHtml5ElementName(nsHtml5Atoms::gt, nsHtml5Atoms::gt, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_DETERMINANT = new nsHtml5ElementName(nsHtml5Atoms::determinant, nsHtml5Atoms::determinant, NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); ELT_DATALIST = new nsHtml5ElementName(nsHtml5Atoms::datalist, nsHtml5Atoms::datalist, NS_NewHTMLDataListElement, NS_NewSVGUnknownElement, nsHtml5TreeBuilder::OTHER); @@ -895,20 +893,20 @@ 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[3] = ELT_DATA; ELEMENT_NAMES[4] = ELT_LI; - ELEMENT_NAMES[5] = ELT_COMPLEXES; + ELEMENT_NAMES[5] = ELT_CANVAS; ELEMENT_NAMES[6] = ELT_QUOTIENT; 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[12] = ELT_REALS; ELEMENT_NAMES[13] = ELT_MROOT; ELEMENT_NAMES[14] = ELT_MROW; ELEMENT_NAMES[15] = ELT_GEQ; @@ -920,9 +918,9 @@ 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[24] = ELT_NOTANUMBER; + ELEMENT_NAMES[25] = ELT_MPRESCRIPTS; + ELEMENT_NAMES[26] = ELT_CARTESIANPRODUCT; ELEMENT_NAMES[27] = ELT_INTERSECT; ELEMENT_NAMES[28] = ELT_RT; ELEMENT_NAMES[29] = ELT_SCRIPT; @@ -945,11 +943,11 @@ 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[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_EMPTYSET; ELEMENT_NAMES[55] = ELT_FEPOINTLIGHT; ELEMENT_NAMES[56] = ELT_LOWLIMIT; @@ -995,16 +993,16 @@ 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[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_DETERMINANT; ELEMENT_NAMES[110] = ELT_FONT_FACE_FORMAT; ELEMENT_NAMES[111] = ELT_FEOFFSET; @@ -1096,25 +1094,25 @@ 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[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_GT; ELEMENT_NAMES[220] = ELT_DATALIST; ELEMENT_NAMES[221] = ELT_EQUIVALENT; @@ -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 @@ -1633,7 +1630,6 @@ nsHtml5ElementName::releaseStatics() delete ELT_ARCCOT; delete ELT_BASEFONT; delete ELT_CARTESIANPRODUCT; - delete ELT_CONTENT; delete ELT_GT; delete ELT_DETERMINANT; delete ELT_DATALIST; diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 022c610f4f..131b9e6281 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -539,7 +539,6 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_ARCCOT; static nsHtml5ElementName* ELT_BASEFONT; static nsHtml5ElementName* ELT_CARTESIANPRODUCT; - static nsHtml5ElementName* ELT_CONTENT; static nsHtml5ElementName* ELT_GT; static nsHtml5ElementName* ELT_DETERMINANT; static nsHtml5ElementName* ELT_DATALIST; diff --git a/parser/htmlparser/nsElementTable.cpp b/parser/htmlparser/nsElementTable.cpp index 48fe4aeded..a04282bf14 100644 --- a/parser/htmlparser/nsElementTable.cpp +++ b/parser/htmlparser/nsElementTable.cpp @@ -62,7 +62,6 @@ static const HTMLElement gHTMLElements[] = { ELEM(code, ____, true) ELEM(col, ____, ____) ELEM(colgroup, ____, true) - ELEM(content, ____, true) ELEM(data, ____, true) ELEM(datalist, ____, true) ELEM(dd, ____, true) diff --git a/parser/htmlparser/nsHTMLTagList.h b/parser/htmlparser/nsHTMLTagList.h index b3bd7b0b72..6f2316ac79 100644 --- a/parser/htmlparser/nsHTMLTagList.h +++ b/parser/htmlparser/nsHTMLTagList.h @@ -71,7 +71,6 @@ HTML_HTMLELEMENT_TAG(cite) HTML_HTMLELEMENT_TAG(code) HTML_TAG(col, TableCol, TableCol) HTML_TAG(colgroup, TableCol, TableCol) -HTML_TAG(content, Content, Content) HTML_TAG(data, Data, Data) HTML_TAG(datalist, DataList, DataList) HTML_HTMLELEMENT_TAG(dd) |