Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index ea3cd128bc274b0b0adcda3a57418c2bfb133e47..b7b966df8df80242c9d86c8cec44a5a95223421f 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -968,6 +968,38 @@ bool Node::isSlotOrActiveInsertionPoint() const
return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this);
}
+bool Node::isInV1ShadowTree() const
+{
+ ShadowRoot* shadowRoot = containingShadowRoot();
+ return shadowRoot && shadowRoot->isV1();
+}
+
+bool Node::isInV0ShadowTree() const
+{
+ ShadowRoot* shadowRoot = containingShadowRoot();
+ return shadowRoot && !shadowRoot->isV1();
+}
+
+static ElementShadow* parentElementShadow(const Node& node)
+{
+ Element* parent = node.parentElement();
+ if (!parent)
+ return nullptr;
+ return parent->shadow();
+}
+
+bool Node::isChildOfV1ShadowHost() const
+{
+ ElementShadow* parentShadow = parentElementShadow(*this);
+ return parentShadow && parentShadow->isV1();
+}
+
+bool Node::isChildOfV0ShadowHost() const
+{
+ ElementShadow* parentShadow = parentElementShadow(*this);
+ return parentShadow && !parentShadow->isV1();
+}
+
Element* Node::shadowHost() const
{
if (ShadowRoot* root = containingShadowRoot())
@@ -2211,10 +2243,15 @@ PassRefPtrWillBeRawPtr<StaticNodeList> Node::getDestinationInsertionPoints()
HTMLSlotElement* Node::assignedSlot() const
{
ASSERT(!needsDistributionRecalc());
- Element* parent = parentElement();
- if (!parent)
- return nullptr;
- if (ElementShadow* shadow = parent->shadow()) {
+ if (ElementShadow* shadow = parentElementShadow(*this))
+ return shadow->assignedSlotFor(*this);
+ return nullptr;
+}
+
+HTMLSlotElement* Node::assignedSlotForBinding()
+{
+ updateDistribution();
+ if (ElementShadow* shadow = parentElementShadow(*this)) {
if (shadow->isV1() && shadow->isOpen())
return shadow->assignedSlotFor(*this);
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698