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

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: wip 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 28287de63542de7e60647294566ccc7bd048ab17..ad3bb4563894e8413417c41436c07fde5f7ee5ae 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.");
@@ -305,63 +298,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)

Powered by Google App Engine
This is Rietveld 408576698