summaryrefslogtreecommitdiffstats
path: root/dom/base/nsContentUtils.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 07:10:54 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 07:10:54 -0400
commite31ed5b07466d4a579fe4b025f97c971003fbc3f (patch)
treeabd621b87578770973591fd03608993334f6af64 /dom/base/nsContentUtils.cpp
parent8beb65dd501cbdcfd6a793027b5de2a1fdfc7149 (diff)
downloadUXP-e31ed5b07466d4a579fe4b025f97c971003fbc3f.tar
UXP-e31ed5b07466d4a579fe4b025f97c971003fbc3f.tar.gz
UXP-e31ed5b07466d4a579fe4b025f97c971003fbc3f.tar.lz
UXP-e31ed5b07466d4a579fe4b025f97c971003fbc3f.tar.xz
UXP-e31ed5b07466d4a579fe4b025f97c971003fbc3f.zip
Bug 1409975 - Implement node distribution for shadow tree slots
* Implementation for assignedNodes * Include slots in the flat tree * Fix event get-the-parent algorithm for a node * Update and add reftests for Shadow DOM v1 * Update web platform tests expectations Tag #1375
Diffstat (limited to 'dom/base/nsContentUtils.cpp')
-rw-r--r--dom/base/nsContentUtils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index 038da24b4..62be71b4a 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -44,6 +44,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FileSystemSecurity.h"
#include "mozilla/dom/HTMLMediaElement.h"
+#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
@@ -7053,6 +7054,13 @@ nsContentUtils::HasDistributedChildren(nsIContent* aContent)
return true;
}
+ HTMLSlotElement* slotEl = HTMLSlotElement::FromContent(aContent);
+ if (slotEl && slotEl->GetContainingShadow()) {
+ // Children of a slot are rendered if the slot does not have any assigned
+ // nodes (fallback content).
+ return slotEl->AssignedNodes().IsEmpty();
+ }
+
return false;
}