2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-12-02 14:26:11 +04:00
|
|
|
/* 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/Preferences.h"
|
|
|
|
#include "mozilla/dom/ShadowRoot.h"
|
|
|
|
#include "mozilla/dom/ShadowRootBinding.h"
|
|
|
|
#include "mozilla/dom/DocumentFragment.h"
|
2013-12-02 14:26:12 +04:00
|
|
|
#include "ChildIterator.h"
|
2013-12-02 14:26:11 +04:00
|
|
|
#include "nsContentUtils.h"
|
2013-12-02 14:26:12 +04:00
|
|
|
#include "nsIStyleSheetLinkingElement.h"
|
2013-12-02 14:26:11 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2017-12-04 11:06:34 +03:00
|
|
|
#include "mozilla/dom/HTMLSlotElement.h"
|
2013-12-02 14:26:11 +04:00
|
|
|
#include "nsXBLPrototypeBinding.h"
|
2017-12-04 11:06:40 +03:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2016-09-26 15:03:25 +03:00
|
|
|
#include "mozilla/StyleSheet.h"
|
|
|
|
#include "mozilla/StyleSheetInlines.h"
|
2013-12-02 14:26:11 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(ShadowRoot)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ShadowRoot,
|
|
|
|
DocumentFragment)
|
2017-12-18 00:29:10 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDOMStyleSheets)
|
2015-07-22 19:42:01 +03:00
|
|
|
for (auto iter = tmp->mIdentifierMap.ConstIter(); !iter.Done();
|
|
|
|
iter.Next()) {
|
|
|
|
iter.Get()->Traverse(&cb);
|
|
|
|
}
|
2013-12-02 14:26:11 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2017-09-25 18:09:26 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ShadowRoot)
|
|
|
|
if (tmp->GetHost()) {
|
|
|
|
tmp->GetHost()->RemoveMutationObserver(tmp);
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
2017-12-18 00:29:10 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDOMStyleSheets)
|
2013-12-02 14:26:11 +04:00
|
|
|
tmp->mIdentifierMap.Clear();
|
2017-09-25 18:09:26 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(DocumentFragment)
|
2013-12-02 14:26:11 +04:00
|
|
|
|
2017-08-30 02:02:48 +03:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ShadowRoot)
|
2013-12-02 14:26:11 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
2013-12-02 14:26:12 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
|
2013-12-02 14:26:11 +04:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(DocumentFragment)
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(ShadowRoot, DocumentFragment)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(ShadowRoot, DocumentFragment)
|
|
|
|
|
2018-02-25 20:01:42 +03:00
|
|
|
ShadowRoot::ShadowRoot(Element* aElement, ShadowRootMode aMode,
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
2017-09-25 18:09:26 +03:00
|
|
|
: DocumentFragment(aNodeInfo)
|
2017-12-21 01:29:21 +03:00
|
|
|
, DocumentOrShadowRoot(*this)
|
2018-02-25 20:01:42 +03:00
|
|
|
, mMode(aMode)
|
|
|
|
, mServoStyles(Servo_AuthorStyles_Create())
|
2017-09-25 18:09:26 +03:00
|
|
|
, mIsComposedDocParticipant(false)
|
2013-12-02 14:26:11 +04:00
|
|
|
{
|
2017-09-06 11:37:17 +03:00
|
|
|
SetHost(aElement);
|
2014-06-07 12:42:53 +04:00
|
|
|
|
|
|
|
// Nodes in a shadow tree should never store a value
|
|
|
|
// in the subtree root pointer, nodes in the shadow tree
|
|
|
|
// track the subtree root using GetContainingShadow().
|
|
|
|
ClearSubtreeRootPointer();
|
|
|
|
|
2013-12-02 14:26:11 +04:00
|
|
|
SetFlags(NODE_IS_IN_SHADOW_TREE);
|
2014-06-07 12:42:53 +04:00
|
|
|
|
2017-09-06 11:37:17 +03:00
|
|
|
ExtendedDOMSlots()->mBindingParent = aElement;
|
2017-07-18 01:25:49 +03:00
|
|
|
ExtendedDOMSlots()->mContainingShadow = this;
|
2013-12-02 14:26:12 +04:00
|
|
|
|
|
|
|
// 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.
|
2017-09-25 18:09:26 +03:00
|
|
|
GetHost()->AddMutationObserver(this);
|
2013-12-02 14:26:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ShadowRoot::~ShadowRoot()
|
|
|
|
{
|
2017-10-17 19:22:29 +03:00
|
|
|
if (auto* host = GetHost()) {
|
2018-02-25 20:01:42 +03:00
|
|
|
// mHost may have been unlinked.
|
2017-10-17 19:22:29 +03:00
|
|
|
host->RemoveMutationObserver(this);
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
|
2018-03-29 19:49:10 +03:00
|
|
|
if (IsComposedDocParticipant()) {
|
|
|
|
OwnerDoc()->RemoveComposedDocShadowRoot(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!OwnerDoc()->IsComposedDocShadowRoot(*this));
|
|
|
|
|
2014-06-07 12:42:53 +04:00
|
|
|
UnsetFlags(NODE_IS_IN_SHADOW_TREE);
|
|
|
|
|
|
|
|
// nsINode destructor expects mSubtreeRoot == this.
|
|
|
|
SetSubtreeRootPointer(this);
|
2013-12-02 14:26:11 +04:00
|
|
|
}
|
|
|
|
|
2018-03-29 19:49:10 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::SetIsComposedDocParticipant(bool aIsComposedDocParticipant)
|
|
|
|
{
|
|
|
|
bool changed = mIsComposedDocParticipant != aIsComposedDocParticipant;
|
|
|
|
mIsComposedDocParticipant = aIsComposedDocParticipant;
|
|
|
|
if (!changed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIDocument* doc = OwnerDoc();
|
|
|
|
if (IsComposedDocParticipant()) {
|
|
|
|
doc->AddComposedDocShadowRoot(*this);
|
|
|
|
} else {
|
|
|
|
doc->RemoveComposedDocShadowRoot(*this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-02 14:26:11 +04:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
ShadowRoot::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-12-02 14:26:11 +04:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
return mozilla::dom::ShadowRootBinding::Wrap(aCx, this, aGivenProto);
|
2013-12-02 14:26:11 +04:00
|
|
|
}
|
|
|
|
|
2018-03-04 13:41:13 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::CloneInternalDataFrom(ShadowRoot* aOther)
|
|
|
|
{
|
|
|
|
size_t sheetCount = aOther->SheetCount();
|
|
|
|
for (size_t i = 0; i < sheetCount; ++i) {
|
|
|
|
StyleSheet* sheet = aOther->SheetAt(i);
|
|
|
|
if (sheet->IsApplicable()) {
|
|
|
|
RefPtr<StyleSheet> clonedSheet =
|
|
|
|
sheet->Clone(nullptr, nullptr, nullptr, nullptr);
|
|
|
|
if (clonedSheet) {
|
|
|
|
AppendStyleSheet(*clonedSheet.get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::InvalidateStyleAndLayoutOnSubtree(Element* aElement)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aElement);
|
|
|
|
|
|
|
|
if (!IsComposedDocParticipant()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(GetComposedDoc() == OwnerDoc());
|
|
|
|
|
|
|
|
nsIPresShell* shell = OwnerDoc()->GetShell();
|
|
|
|
if (!shell) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
shell->DestroyFramesForAndRestyle(aElement);
|
|
|
|
}
|
|
|
|
|
2017-12-04 11:06:34 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::AddSlot(HTMLSlotElement* aSlot)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aSlot);
|
|
|
|
|
|
|
|
// Note that if name attribute missing, the slot is a default slot.
|
2018-02-25 19:33:28 +03:00
|
|
|
nsAutoString name;
|
2017-12-04 11:06:34 +03:00
|
|
|
aSlot->GetName(name);
|
|
|
|
|
|
|
|
nsTArray<HTMLSlotElement*>* currentSlots = mSlotMap.LookupOrAdd(name);
|
|
|
|
MOZ_ASSERT(currentSlots);
|
|
|
|
|
2018-02-25 19:33:28 +03:00
|
|
|
HTMLSlotElement* oldSlot = currentSlots->SafeElementAt(0);
|
2017-12-04 11:06:34 +03:00
|
|
|
|
|
|
|
TreeOrderComparator comparator;
|
|
|
|
currentSlots->InsertElementSorted(aSlot, comparator);
|
|
|
|
|
|
|
|
HTMLSlotElement* currentSlot = currentSlots->ElementAt(0);
|
|
|
|
if (currentSlot != aSlot) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldSlot && oldSlot != currentSlot) {
|
|
|
|
// Move assigned nodes from old slot to new slot.
|
2018-03-13 17:27:50 +03:00
|
|
|
InvalidateStyleAndLayoutOnSubtree(oldSlot);
|
2017-12-04 11:06:37 +03:00
|
|
|
const nsTArray<RefPtr<nsINode>>& assignedNodes = oldSlot->AssignedNodes();
|
2018-03-13 17:27:50 +03:00
|
|
|
bool doEnqueueSlotChange = false;
|
2017-12-04 11:06:34 +03:00
|
|
|
while (assignedNodes.Length() > 0) {
|
|
|
|
nsINode* assignedNode = assignedNodes[0];
|
|
|
|
|
|
|
|
oldSlot->RemoveAssignedNode(assignedNode);
|
|
|
|
currentSlot->AppendAssignedNode(assignedNode);
|
2017-12-19 18:16:33 +03:00
|
|
|
doEnqueueSlotChange = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (doEnqueueSlotChange) {
|
|
|
|
oldSlot->EnqueueSlotChangeEvent();
|
|
|
|
currentSlot->EnqueueSlotChangeEvent();
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
} else {
|
2018-03-13 17:27:50 +03:00
|
|
|
bool doEnqueueSlotChange = false;
|
2017-12-04 11:06:34 +03:00
|
|
|
// Otherwise add appropriate nodes to this slot from the host.
|
|
|
|
for (nsIContent* child = GetHost()->GetFirstChild();
|
|
|
|
child;
|
|
|
|
child = child->GetNextSibling()) {
|
|
|
|
nsAutoString slotName;
|
2017-12-07 21:13:50 +03:00
|
|
|
if (child->IsElement()) {
|
|
|
|
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
|
|
|
}
|
2018-03-13 17:27:50 +03:00
|
|
|
if (!child->IsSlotable() || !slotName.Equals(name)) {
|
|
|
|
continue;
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
2018-03-13 17:27:50 +03:00
|
|
|
doEnqueueSlotChange = true;
|
|
|
|
currentSlot->AppendAssignedNode(child);
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
2017-12-19 18:16:33 +03:00
|
|
|
|
|
|
|
if (doEnqueueSlotChange) {
|
|
|
|
currentSlot->EnqueueSlotChangeEvent();
|
|
|
|
}
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::RemoveSlot(HTMLSlotElement* aSlot)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aSlot);
|
|
|
|
|
|
|
|
nsAutoString name;
|
|
|
|
aSlot->GetName(name);
|
|
|
|
|
2018-02-25 19:33:28 +03:00
|
|
|
SlotArray* currentSlots = mSlotMap.Get(name);
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(currentSlots && currentSlots->Contains(aSlot),
|
|
|
|
"Slot to deregister wasn't found?");
|
|
|
|
if (currentSlots->Length() == 1) {
|
|
|
|
MOZ_ASSERT(currentSlots->ElementAt(0) == aSlot);
|
|
|
|
mSlotMap.Remove(name);
|
2017-12-19 18:16:33 +03:00
|
|
|
|
2018-02-25 19:33:28 +03:00
|
|
|
if (!aSlot->AssignedNodes().IsEmpty()) {
|
|
|
|
aSlot->ClearAssignedNodes();
|
|
|
|
aSlot->EnqueueSlotChangeEvent();
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
2018-02-25 19:33:28 +03:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool wasFirstSlot = currentSlots->ElementAt(0) == aSlot;
|
|
|
|
currentSlots->RemoveElement(aSlot);
|
|
|
|
|
|
|
|
// Move assigned nodes from removed slot to the next slot in
|
|
|
|
// tree order with the same name.
|
|
|
|
if (!wasFirstSlot) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLSlotElement* replacementSlot = currentSlots->ElementAt(0);
|
|
|
|
const nsTArray<RefPtr<nsINode>>& assignedNodes = aSlot->AssignedNodes();
|
|
|
|
bool slottedNodesChanged = !assignedNodes.IsEmpty();
|
|
|
|
while (!assignedNodes.IsEmpty()) {
|
|
|
|
nsINode* assignedNode = assignedNodes[0];
|
|
|
|
|
|
|
|
aSlot->RemoveAssignedNode(assignedNode);
|
|
|
|
replacementSlot->AppendAssignedNode(assignedNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (slottedNodesChanged) {
|
|
|
|
aSlot->EnqueueSlotChangeEvent();
|
|
|
|
replacementSlot->EnqueueSlotChangeEvent();
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-17 00:56:05 +03:00
|
|
|
// FIXME(emilio): There's a bit of code duplication between this and the
|
|
|
|
// equivalent ServoStyleSet methods, it'd be nice to not duplicate it...
|
2013-12-02 14:26:12 +04:00
|
|
|
void
|
2018-03-17 00:56:05 +03:00
|
|
|
ShadowRoot::RuleAdded(StyleSheet& aSheet, css::Rule& aRule)
|
2013-12-02 14:26:12 +04:00
|
|
|
{
|
2018-03-17 00:56:05 +03:00
|
|
|
if (mStyleRuleMap) {
|
|
|
|
mStyleRuleMap->RuleAdded(*aSheet.AsServo(), aRule);
|
|
|
|
}
|
|
|
|
|
|
|
|
Servo_AuthorStyles_ForceDirty(mServoStyles.get());
|
|
|
|
ApplicableRulesChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::RuleRemoved(StyleSheet& aSheet, css::Rule& aRule)
|
|
|
|
{
|
|
|
|
if (mStyleRuleMap) {
|
|
|
|
mStyleRuleMap->RuleRemoved(*aSheet.AsServo(), aRule);
|
|
|
|
}
|
|
|
|
|
|
|
|
Servo_AuthorStyles_ForceDirty(mServoStyles.get());
|
|
|
|
ApplicableRulesChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::RuleChanged(StyleSheet&, css::Rule*) {
|
2018-02-25 20:01:42 +03:00
|
|
|
Servo_AuthorStyles_ForceDirty(mServoStyles.get());
|
2018-03-17 00:56:05 +03:00
|
|
|
ApplicableRulesChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::ApplicableRulesChanged()
|
|
|
|
{
|
|
|
|
if (!IsComposedDocParticipant()) {
|
|
|
|
return;
|
|
|
|
}
|
2018-02-18 16:35:57 +03:00
|
|
|
|
2018-02-25 20:01:42 +03:00
|
|
|
nsIDocument* doc = OwnerDoc();
|
2018-02-18 16:35:57 +03:00
|
|
|
if (nsIPresShell* shell = doc->GetShell()) {
|
|
|
|
doc->BeginUpdate(UPDATE_STYLE);
|
|
|
|
shell->RecordShadowStyleChange(*this);
|
|
|
|
doc->EndUpdate(UPDATE_STYLE);
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-17 00:56:05 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::InsertSheetAt(size_t aIndex, StyleSheet& aSheet)
|
|
|
|
{
|
|
|
|
DocumentOrShadowRoot::InsertSheetAt(aIndex, aSheet);
|
|
|
|
if (aSheet.IsApplicable()) {
|
|
|
|
InsertSheetIntoAuthorData(aIndex, aSheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::AppendStyleSheet(StyleSheet& aSheet)
|
|
|
|
{
|
|
|
|
DocumentOrShadowRoot::AppendStyleSheet(aSheet);
|
|
|
|
if (aSheet.IsApplicable()) {
|
|
|
|
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), aSheet.AsServo());
|
|
|
|
if (mStyleRuleMap) {
|
|
|
|
mStyleRuleMap->SheetAdded(*aSheet.AsServo());
|
|
|
|
}
|
|
|
|
ApplicableRulesChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-02 14:26:12 +04:00
|
|
|
void
|
2018-02-25 20:01:42 +03:00
|
|
|
ShadowRoot::InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent)
|
2013-12-02 14:26:12 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIStyleSheetLinkingElement>
|
|
|
|
linkingElement = do_QueryInterface(aLinkingContent);
|
2017-12-18 00:29:10 +03:00
|
|
|
|
|
|
|
// FIXME(emilio, bug 1410578): <link> should probably also be allowed here.
|
2013-12-02 14:26:12 +04:00
|
|
|
MOZ_ASSERT(linkingElement, "The only styles in a ShadowRoot should come "
|
|
|
|
"from <style>.");
|
|
|
|
|
|
|
|
linkingElement->SetStyleSheet(aSheet); // This sets the ownerNode on the sheet
|
|
|
|
|
|
|
|
// Find the correct position to insert into the style sheet list (must
|
|
|
|
// be in tree order).
|
2017-12-18 00:29:10 +03:00
|
|
|
for (size_t i = 0; i <= SheetCount(); i++) {
|
|
|
|
if (i == SheetCount()) {
|
|
|
|
AppendStyleSheet(*aSheet);
|
2018-03-17 00:56:05 +03:00
|
|
|
return;
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
|
2018-02-25 20:01:42 +03:00
|
|
|
StyleSheet* sheet = SheetAt(i);
|
|
|
|
nsINode* sheetOwningNode = sheet->GetOwnerNode();
|
2016-02-24 10:01:12 +03:00
|
|
|
if (nsContentUtils::PositionIsBefore(aLinkingContent, sheetOwningNode)) {
|
2017-12-18 00:29:10 +03:00
|
|
|
InsertSheetAt(i, *aSheet);
|
2018-03-17 00:56:05 +03:00
|
|
|
return;
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
}
|
2018-03-17 00:56:05 +03:00
|
|
|
}
|
2013-12-02 14:26:12 +04:00
|
|
|
|
2018-03-17 00:56:05 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::InsertSheetIntoAuthorData(size_t aIndex, StyleSheet& aSheet)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(SheetAt(aIndex) == &aSheet);
|
|
|
|
MOZ_ASSERT(aSheet.IsApplicable());
|
|
|
|
|
|
|
|
if (mStyleRuleMap) {
|
|
|
|
mStyleRuleMap->SheetAdded(*aSheet.AsServo());
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = aIndex + 1; i < SheetCount(); ++i) {
|
|
|
|
StyleSheet* beforeSheet = SheetAt(i);
|
|
|
|
if (!beforeSheet->IsApplicable()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
Servo_AuthorStyles_InsertStyleSheetBefore(
|
|
|
|
mServoStyles.get(), aSheet.AsServo(), beforeSheet->AsServo());
|
|
|
|
ApplicableRulesChanged();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), aSheet.AsServo());
|
|
|
|
ApplicableRulesChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::StyleSheetApplicableStateChanged(StyleSheet& aSheet, bool aApplicable)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mStyleSheets.Contains(&aSheet));
|
|
|
|
if (aApplicable) {
|
|
|
|
int32_t index = IndexOfSheet(aSheet);
|
|
|
|
MOZ_RELEASE_ASSERT(index >= 0);
|
|
|
|
InsertSheetIntoAuthorData(size_t(index), aSheet);
|
|
|
|
} else {
|
|
|
|
if (mStyleRuleMap) {
|
|
|
|
mStyleRuleMap->SheetRemoved(*aSheet.AsServo());
|
|
|
|
}
|
|
|
|
Servo_AuthorStyles_RemoveStyleSheet(mServoStyles.get(), aSheet.AsServo());
|
|
|
|
ApplicableRulesChanged();
|
2014-06-07 12:42:54 +04:00
|
|
|
}
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-26 15:03:25 +03:00
|
|
|
ShadowRoot::RemoveSheet(StyleSheet* aSheet)
|
2013-12-02 14:26:12 +04:00
|
|
|
{
|
2017-12-21 01:29:21 +03:00
|
|
|
DocumentOrShadowRoot::RemoveSheet(*aSheet);
|
2014-06-07 12:42:54 +04:00
|
|
|
if (aSheet->IsApplicable()) {
|
2018-03-17 00:56:05 +03:00
|
|
|
if (mStyleRuleMap) {
|
|
|
|
mStyleRuleMap->SheetRemoved(*aSheet->AsServo());
|
|
|
|
}
|
|
|
|
Servo_AuthorStyles_RemoveStyleSheet(mServoStyles.get(), aSheet->AsServo());
|
|
|
|
ApplicableRulesChanged();
|
2014-06-07 12:42:54 +04:00
|
|
|
}
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
|
2013-12-02 14:26:11 +04:00
|
|
|
void
|
2017-10-03 01:05:19 +03:00
|
|
|
ShadowRoot::AddToIdTable(Element* aElement, nsAtom* aId)
|
2013-12-02 14:26:11 +04:00
|
|
|
{
|
2017-04-13 22:12:20 +03:00
|
|
|
nsIdentifierMapEntry* entry = mIdentifierMap.PutEntry(aId);
|
2013-12-02 14:26:11 +04:00
|
|
|
if (entry) {
|
|
|
|
entry->AddIdElement(aElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-10-03 01:05:19 +03:00
|
|
|
ShadowRoot::RemoveFromIdTable(Element* aElement, nsAtom* aId)
|
2013-12-02 14:26:11 +04:00
|
|
|
{
|
2017-04-13 22:12:20 +03:00
|
|
|
nsIdentifierMapEntry* entry = mIdentifierMap.GetEntry(aId);
|
2013-12-02 14:26:11 +04:00
|
|
|
if (entry) {
|
|
|
|
entry->RemoveIdElement(aElement);
|
|
|
|
if (entry->IsEmpty()) {
|
2016-02-09 05:52:21 +03:00
|
|
|
mIdentifierMap.RemoveEntry(entry);
|
2013-12-02 14:26:11 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-04 11:06:40 +03:00
|
|
|
nsresult
|
|
|
|
ShadowRoot::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
|
|
|
{
|
|
|
|
aVisitor.mCanHandle = true;
|
2017-12-18 19:07:36 +03:00
|
|
|
aVisitor.mRootOfClosedTree = IsClosed();
|
2018-02-15 13:08:42 +03:00
|
|
|
// Inform that we're about to exit the current scope.
|
|
|
|
aVisitor.mRelatedTargetRetargetedInCurrentScope = false;
|
2017-12-04 11:06:40 +03:00
|
|
|
|
|
|
|
// https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6
|
|
|
|
if (!aVisitor.mEvent->mFlags.mComposed) {
|
|
|
|
nsCOMPtr<nsIContent> originalTarget =
|
|
|
|
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
|
|
|
if (originalTarget->GetContainingShadow() == this) {
|
|
|
|
// If we do stop propagation, we still want to propagate
|
|
|
|
// the event to chrome (nsPIDOMWindow::GetParentTarget()).
|
|
|
|
// The load event is special in that we don't ever propagate it
|
|
|
|
// to chrome.
|
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> win = OwnerDoc()->GetWindow();
|
|
|
|
EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != eLoad
|
|
|
|
? win->GetParentTarget() : nullptr;
|
|
|
|
|
2017-12-18 19:07:36 +03:00
|
|
|
aVisitor.SetParentTarget(parentTarget, true);
|
2017-12-04 11:06:40 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIContent* shadowHost = GetHost();
|
2017-12-18 19:07:36 +03:00
|
|
|
aVisitor.SetParentTarget(shadowHost, false);
|
2017-12-04 11:06:40 +03:00
|
|
|
|
2018-02-15 13:08:42 +03:00
|
|
|
nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mEvent->mTarget));
|
|
|
|
if (content && content->GetBindingParent() == shadowHost) {
|
|
|
|
aVisitor.mEventTargetAtParent = shadowHost;
|
|
|
|
}
|
2017-12-04 11:06:40 +03:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
ShadowRoot::SlotAssignment
|
|
|
|
ShadowRoot::SlotAssignmentFor(nsIContent* aContent)
|
2017-12-04 11:06:34 +03:00
|
|
|
{
|
|
|
|
nsAutoString slotName;
|
|
|
|
// Note that if slot attribute is missing, assign it to the first default
|
|
|
|
// slot, if exists.
|
2017-12-07 21:13:50 +03:00
|
|
|
if (aContent->IsElement()) {
|
|
|
|
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
|
|
|
}
|
|
|
|
|
2017-12-04 11:06:34 +03:00
|
|
|
nsTArray<HTMLSlotElement*>* slots = mSlotMap.Get(slotName);
|
|
|
|
if (!slots) {
|
2018-03-13 17:27:50 +03:00
|
|
|
return { };
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
HTMLSlotElement* slot = slots->ElementAt(0);
|
|
|
|
MOZ_ASSERT(slot);
|
|
|
|
|
|
|
|
// Find the appropriate position in the assigned node list for the
|
|
|
|
// newly assigned content.
|
2017-12-04 11:06:37 +03:00
|
|
|
const nsTArray<RefPtr<nsINode>>& assignedNodes = slot->AssignedNodes();
|
2017-12-04 11:06:34 +03:00
|
|
|
nsIContent* currentContent = GetHost()->GetFirstChild();
|
2018-01-04 18:47:29 +03:00
|
|
|
Maybe<uint32_t> insertionIndex;
|
2017-12-04 11:06:34 +03:00
|
|
|
for (uint32_t i = 0; i < assignedNodes.Length(); i++) {
|
|
|
|
// Seek through the host's explicit children until the
|
|
|
|
// assigned content is found.
|
|
|
|
while (currentContent && currentContent != assignedNodes[i]) {
|
|
|
|
if (currentContent == aContent) {
|
2018-01-04 18:47:29 +03:00
|
|
|
insertionIndex.emplace(i);
|
|
|
|
break;
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
currentContent = currentContent->GetNextSibling();
|
|
|
|
}
|
|
|
|
|
2018-01-04 18:47:29 +03:00
|
|
|
if (insertionIndex) {
|
2017-12-04 11:06:34 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
return { slot, insertionIndex };
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
void
|
|
|
|
ShadowRoot::MaybeReassignElement(Element* aElement)
|
2017-12-04 11:06:34 +03:00
|
|
|
{
|
2018-03-13 17:27:50 +03:00
|
|
|
MOZ_ASSERT(aElement->GetParent() == GetHost());
|
|
|
|
HTMLSlotElement* oldSlot = aElement->GetAssignedSlot();
|
|
|
|
SlotAssignment assignment = SlotAssignmentFor(aElement);
|
2017-12-04 11:06:34 +03:00
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
if (assignment.mSlot == oldSlot) {
|
|
|
|
// Nothing to do here.
|
|
|
|
return;
|
|
|
|
}
|
2017-12-04 11:06:34 +03:00
|
|
|
|
2018-03-28 20:21:13 +03:00
|
|
|
if (IsComposedDocParticipant()) {
|
|
|
|
if (nsIPresShell* shell = OwnerDoc()->GetShell()) {
|
|
|
|
shell->SlotAssignmentWillChange(*aElement, oldSlot, assignment.mSlot);
|
|
|
|
}
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
if (oldSlot) {
|
|
|
|
oldSlot->RemoveAssignedNode(aElement);
|
|
|
|
oldSlot->EnqueueSlotChangeEvent();
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
if (assignment.mSlot) {
|
|
|
|
if (assignment.mIndex) {
|
|
|
|
assignment.mSlot->InsertAssignedNode(*assignment.mIndex, aElement);
|
|
|
|
} else {
|
|
|
|
assignment.mSlot->AppendAssignedNode(aElement);
|
|
|
|
}
|
|
|
|
assignment.mSlot->EnqueueSlotChangeEvent();
|
|
|
|
}
|
2017-12-04 11:06:34 +03:00
|
|
|
}
|
|
|
|
|
2018-01-15 09:42:47 +03:00
|
|
|
Element*
|
|
|
|
ShadowRoot::GetActiveElement()
|
|
|
|
{
|
|
|
|
return GetRetargetedFocusedElement();
|
|
|
|
}
|
|
|
|
|
2013-12-02 14:26:12 +04:00
|
|
|
void
|
|
|
|
ShadowRoot::GetInnerHTML(nsAString& aInnerHTML)
|
|
|
|
{
|
|
|
|
GetMarkup(false, aInnerHTML);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowRoot::SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetInnerHTMLInternal(aInnerHTML, aError);
|
|
|
|
}
|
|
|
|
|
2013-12-02 14:26:12 +04:00
|
|
|
void
|
2018-03-01 14:36:58 +03:00
|
|
|
ShadowRoot::AttributeChanged(Element* aElement,
|
2013-12-02 14:26:12 +04:00
|
|
|
int32_t aNameSpaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2015-07-25 09:01:19 +03:00
|
|
|
int32_t aModType,
|
|
|
|
const nsAttrValue* aOldValue)
|
2013-12-02 14:26:12 +04:00
|
|
|
{
|
2017-12-04 11:06:34 +03:00
|
|
|
if (aNameSpaceID != kNameSpaceID_None || aAttribute != nsGkAtoms::slot) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
if (aElement->GetParent() != GetHost()) {
|
2013-12-02 14:26:12 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:27:50 +03:00
|
|
|
MaybeReassignElement(aElement);
|
2017-10-18 17:03:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-03-01 14:36:58 +03:00
|
|
|
ShadowRoot::ContentAppended(nsIContent* aFirstNewContent)
|
2017-10-18 17:03:41 +03:00
|
|
|
{
|
|
|
|
for (nsIContent* content = aFirstNewContent;
|
|
|
|
content;
|
|
|
|
content = content->GetNextSibling()) {
|
2018-03-01 14:36:58 +03:00
|
|
|
ContentInserted(content);
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-03-01 14:36:58 +03:00
|
|
|
ShadowRoot::ContentInserted(nsIContent* aChild)
|
2013-12-02 14:26:12 +04:00
|
|
|
{
|
2018-03-01 14:36:58 +03:00
|
|
|
// Check to ensure that the child not an anonymous subtree root because
|
|
|
|
// even though its parent could be the host it may not be in the host's child
|
|
|
|
// list.
|
|
|
|
if (aChild->IsRootOfAnonymousSubtree()) {
|
2013-12-02 14:26:12 +04:00
|
|
|
return;
|
|
|
|
}
|
2017-12-04 11:06:34 +03:00
|
|
|
|
2017-12-19 18:16:33 +03:00
|
|
|
if (!aChild->IsSlotable()) {
|
2017-12-04 11:06:34 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-01 14:36:58 +03:00
|
|
|
if (aChild->GetParent() == GetHost()) {
|
2018-03-13 17:27:50 +03:00
|
|
|
SlotAssignment assignment = SlotAssignmentFor(aChild);
|
|
|
|
if (!assignment.mSlot) {
|
|
|
|
return;
|
2017-12-19 18:16:33 +03:00
|
|
|
}
|
2018-03-13 17:27:50 +03:00
|
|
|
|
|
|
|
// Fallback content will go away, let layout know.
|
|
|
|
if (assignment.mSlot->AssignedNodes().IsEmpty()) {
|
|
|
|
InvalidateStyleAndLayoutOnSubtree(assignment.mSlot);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (assignment.mIndex) {
|
|
|
|
assignment.mSlot->InsertAssignedNode(*assignment.mIndex, aChild);
|
|
|
|
} else {
|
|
|
|
assignment.mSlot->AppendAssignedNode(aChild);
|
|
|
|
}
|
|
|
|
assignment.mSlot->EnqueueSlotChangeEvent();
|
2017-12-19 18:16:33 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If parent's root is a shadow root, and parent is a slot whose assigned
|
|
|
|
// nodes is the empty list, then run signal a slot change for parent.
|
2018-03-22 00:39:04 +03:00
|
|
|
HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
|
2017-12-19 18:16:33 +03:00
|
|
|
if (slot && slot->GetContainingShadow() == this &&
|
|
|
|
slot->AssignedNodes().IsEmpty()) {
|
|
|
|
slot->EnqueueSlotChangeEvent();
|
|
|
|
}
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-03-01 14:36:58 +03:00
|
|
|
ShadowRoot::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
|
2013-12-02 14:26:12 +04:00
|
|
|
{
|
2018-03-01 14:36:58 +03:00
|
|
|
// Check to ensure that the child not an anonymous subtree root because
|
|
|
|
// even though its parent could be the host it may not be in the host's child
|
|
|
|
// list.
|
|
|
|
if (aChild->IsRootOfAnonymousSubtree()) {
|
2013-12-02 14:26:12 +04:00
|
|
|
return;
|
|
|
|
}
|
2017-12-04 11:06:34 +03:00
|
|
|
|
2017-12-19 18:16:33 +03:00
|
|
|
if (!aChild->IsSlotable()) {
|
2017-12-04 11:06:34 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-01 14:36:58 +03:00
|
|
|
if (aChild->GetParent() == GetHost()) {
|
2018-03-13 17:27:50 +03:00
|
|
|
if (HTMLSlotElement* slot = aChild->GetAssignedSlot()) {
|
|
|
|
// If the slot is going to start showing fallback content, we need to tell
|
|
|
|
// layout about it.
|
|
|
|
if (slot->AssignedNodes().Length() == 1) {
|
|
|
|
InvalidateStyleAndLayoutOnSubtree(slot);
|
|
|
|
}
|
|
|
|
slot->RemoveAssignedNode(aChild);
|
2017-12-19 18:16:33 +03:00
|
|
|
slot->EnqueueSlotChangeEvent();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If parent's root is a shadow root, and parent is a slot whose assigned
|
|
|
|
// nodes is the empty list, then run signal a slot change for parent.
|
2018-03-22 00:39:04 +03:00
|
|
|
HTMLSlotElement* slot = HTMLSlotElement::FromNodeOrNull(aChild->GetParent());
|
2017-12-19 18:16:33 +03:00
|
|
|
if (slot && slot->GetContainingShadow() == this &&
|
|
|
|
slot->AssignedNodes().IsEmpty()) {
|
|
|
|
slot->EnqueueSlotChangeEvent();
|
|
|
|
}
|
2013-12-02 14:26:12 +04:00
|
|
|
}
|
|
|
|
|
2018-02-25 20:01:42 +03:00
|
|
|
ServoStyleRuleMap&
|
|
|
|
ShadowRoot::ServoStyleRuleMap()
|
|
|
|
{
|
|
|
|
if (!mStyleRuleMap) {
|
|
|
|
mStyleRuleMap = MakeUnique<mozilla::ServoStyleRuleMap>();
|
|
|
|
}
|
|
|
|
mStyleRuleMap->EnsureTable(*this);
|
|
|
|
return *mStyleRuleMap;
|
|
|
|
}
|
|
|
|
|
2015-07-07 04:26:29 +03:00
|
|
|
nsresult
|
2017-04-20 22:57:48 +03:00
|
|
|
ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
|
|
|
bool aPreallocateChildren) const
|
2015-07-07 04:26:29 +03:00
|
|
|
{
|
|
|
|
*aResult = nullptr;
|
2018-01-15 09:42:43 +03:00
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
2015-07-07 04:26:29 +03:00
|
|
|
}
|