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

Unified Diff: third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp

Issue 1995203002: Rewrite Shadow DOM distribution engine to support partial synchronous distribution for v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No longer FAIL: imported/wpt/shadow-dom/HTMLSlotElement-interface.html Created 4 years, 7 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/shadow/ShadowRoot.cpp
diff --git a/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp b/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
index aabea3676888e38abbf631c0a70cf982949e3982..4d379568e1dbac73b9b58710f82c9fede316ace2 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
@@ -61,7 +61,6 @@ ShadowRoot::ShadowRoot(Document& document, ShadowRootType type)
, m_registeredWithParentShadowRoot(false)
, m_descendantInsertionPointsIsValid(false)
, m_delegatesFocus(false)
- , m_descendantSlotsIsValid(false)
{
}
@@ -107,16 +106,10 @@ void ShadowRoot::setOlderShadowRoot(ShadowRoot& root)
SlotAssignment& ShadowRoot::ensureSlotAssignment()
{
if (!m_slotAssignment)
- m_slotAssignment = SlotAssignment::create();
+ m_slotAssignment = SlotAssignment::create(*this);
return *m_slotAssignment;
}
-HTMLSlotElement* ShadowRoot::assignedSlotFor(const Node& node) const
-{
- DCHECK(m_slotAssignment);
- return m_slotAssignment->assignedSlotFor(node);
-}
-
Node* ShadowRoot::cloneNode(bool, ExceptionState& exceptionState)
{
exceptionState.throwDOMException(NotSupportedError, "ShadowRoot nodes are not clonable.");
@@ -300,63 +293,9 @@ StyleSheetList& ShadowRoot::styleSheets()
return *m_styleSheetList;
}
-void ShadowRoot::didAddSlot()
-{
- ensureSlotAssignment().didAddSlot();
- invalidateDescendantSlots();
-}
-
-void ShadowRoot::didRemoveSlot()
-{
- DCHECK(m_slotAssignment);
- m_slotAssignment->didRemoveSlot();
- invalidateDescendantSlots();
-}
-
-void ShadowRoot::invalidateDescendantSlots()
-{
- DCHECK(m_slotAssignment);
- m_descendantSlotsIsValid = false;
- m_slotAssignment->clearDescendantSlots();
-}
-
-unsigned ShadowRoot::descendantSlotCount() const
-{
- return m_slotAssignment ? m_slotAssignment->descendantSlotCount() : 0;
-}
-
-const HeapVector<Member<HTMLSlotElement>>& ShadowRoot::descendantSlots()
-{
- DEFINE_STATIC_LOCAL(HeapVector<Member<HTMLSlotElement>>, emptyList, (new HeapVector<Member<HTMLSlotElement>>));
- if (m_descendantSlotsIsValid) {
- DCHECK(m_slotAssignment);
- return m_slotAssignment->descendantSlots();
- }
- if (descendantSlotCount() == 0)
- return emptyList;
-
- DCHECK(m_slotAssignment);
- HeapVector<Member<HTMLSlotElement>> slots;
- slots.reserveCapacity(descendantSlotCount());
- for (HTMLSlotElement& slot : Traversal<HTMLSlotElement>::descendantsOf(rootNode()))
- slots.append(&slot);
- m_slotAssignment->setDescendantSlots(slots);
- m_descendantSlotsIsValid = true;
- return m_slotAssignment->descendantSlots();
-}
-
-void ShadowRoot::assignV1()
-{
- if (!m_slotAssignment)
- m_slotAssignment = SlotAssignment::create();
- m_slotAssignment->resolveAssignment(*this);
-}
-
void ShadowRoot::distributeV1()
{
- if (!m_slotAssignment)
- m_slotAssignment = SlotAssignment::create();
- m_slotAssignment->resolveDistribution(*this);
+ ensureSlotAssignment().resolveDistribution();
}
DEFINE_TRACE(ShadowRoot)
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h ('k') | third_party/WebKit/Source/core/dom/shadow/SlotAssignment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698