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

Unified Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.h

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/html/HTMLSlotElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.h b/third_party/WebKit/Source/core/html/HTMLSlotElement.h
index 9c155249c7fef27ef57d3357aa3081669369527c..9721bdaa5043171ccd25bd9b3d2ce9560fd8eaea 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.h
@@ -43,7 +43,7 @@ class CORE_EXPORT HTMLSlotElement final : public HTMLElement {
public:
DECLARE_NODE_FACTORY(HTMLSlotElement);
- const HeapVector<Member<Node>>& assignedNodes() const { return m_assignedNodes; }
+ const HeapVector<Member<Node>>& assignedNodes();
const HeapVector<Member<Node>>& getDistributedNodes();
const HeapVector<Member<Node>> assignedNodesForBinding(const AssignedNodesOptions&);
@@ -54,19 +54,12 @@ public:
Node* distributedNodePreviousTo(const Node&) const;
void appendAssignedNode(Node&);
- void willUpdateAssignment();
+
+ void resolveDistributedNodes();
void appendDistributedNode(Node&);
void appendDistributedNodesFrom(const HTMLSlotElement& other);
- void willUpdateDistribution();
- void appendFallbackNode(Node&);
- void willUpdateFallback();
- void didUpdateAssignment();
- void updateFallbackNodes();
void updateDistributedNodesWithFallback();
- void didUpdateDistribution();
-
- void fireSlotChangeEvent();
void attach(const AttachContext& = AttachContext()) final;
void detach(const AttachContext& = AttachContext()) final;
@@ -76,47 +69,33 @@ public:
short tabIndex() const override;
AtomicString name() const;
+ // This method can be slow because this has to traverse the children of a shadow host.
+ // This method should be used only when m_assignedNodes is dirty.
+ // e.g. To detect a slotchange event in DOM mutations.
+ bool hasAssignedNodesSlow() const;
+ bool findHostChildWithSameSlotName() const;
+
+ void enqueueSlotChangeEvent();
+
+ void clearDistribution();
+
+ static AtomicString normalizeSlotName(const AtomicString&);
+
DECLARE_VIRTUAL_TRACE();
private:
HTMLSlotElement(Document&);
- enum AssignmentState {
- AssignmentOnGoing,
- AssignmentDone,
- AssignmentChanged,
- AssignmentUnchanged
- };
-
- enum DistributionState {
- DistributionOnGoing,
- DistributionDone,
- DistributionChanged,
- DistributionUnchanged
- };
-
- void clearDistribution();
- void childrenChanged(const ChildrenChange&) final;
InsertionNotificationRequest insertedInto(ContainerNode*) final;
void removedFrom(ContainerNode*) final;
void willRecalcStyle(StyleRecalcChange) final;
void dispatchSlotChangeEvent();
- bool assignmentChanged();
- bool distributionChanged();
- bool fallbackChanged();
HeapVector<Member<Node>> m_assignedNodes;
HeapVector<Member<Node>> m_distributedNodes;
- HeapVector<Member<Node>> m_fallbackNodes;
HeapHashMap<Member<const Node>, size_t> m_distributedIndices;
- HeapVector<Member<Node>> m_oldAssignedNodes;
- // TODO(hayato): Remove m_oldDistibutedNodes and make SlotAssignment check the diffirence between old and new distributed nodes for each slot to save the memories.
- HeapVector<Member<Node>> m_oldDistributedNodes;
- HeapVector<Member<Node>> m_oldFallbackNodes;
- DistributionState m_distributionState;
- AssignmentState m_assignmentState;
- bool m_slotchangeEventAdded;
+ bool m_slotchangeEventEnqueued = false;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp ('k') | third_party/WebKit/Source/core/html/HTMLSlotElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698