Bug 1319255 part 3. Don't create special elements for <shadow> and <content> unless webcomponents are enabled. r=wchen
This commit is contained in:
@@ -8,10 +8,31 @@
|
||||
|
||||
#include "ChildIterator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocument.h"
|
||||
#include "mozilla/dom/HTMLShadowElement.h"
|
||||
#include "mozilla/dom/HTMLUnknownElement.h"
|
||||
#include "mozilla/dom/HTMLShadowElementBinding.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Shadow)
|
||||
// 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user