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

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

Issue 1899653002: Support slotchange event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix Created 4 years, 8 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 9da0aff786a4221f00e2387a0890516993b9e257..9c155249c7fef27ef57d3357aa3081669369527c 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 { ASSERT(!needsDistributionRecalc()); return m_assignedNodes; }
+ const HeapVector<Member<Node>>& assignedNodes() const { return m_assignedNodes; }
const HeapVector<Member<Node>>& getDistributedNodes();
const HeapVector<Member<Node>> assignedNodesForBinding(const AssignedNodesOptions&);
@@ -54,15 +54,20 @@ public:
Node* distributedNodePreviousTo(const Node&) const;
void appendAssignedNode(Node&);
+ void willUpdateAssignment();
void appendDistributedNode(Node&);
void appendDistributedNodesFrom(const HTMLSlotElement& other);
void willUpdateDistribution();
+ void appendFallbackNode(Node&);
+ void willUpdateFallback();
- bool hasSlotChangeEventListener();
-
+ void didUpdateAssignment();
+ void updateFallbackNodes();
void updateDistributedNodesWithFallback();
void didUpdateDistribution();
+ void fireSlotChangeEvent();
+
void attach(const AttachContext& = AttachContext()) final;
void detach(const AttachContext& = AttachContext()) final;
@@ -76,6 +81,13 @@ public:
private:
HTMLSlotElement(Document&);
+ enum AssignmentState {
+ AssignmentOnGoing,
+ AssignmentDone,
+ AssignmentChanged,
+ AssignmentUnchanged
+ };
+
enum DistributionState {
DistributionOnGoing,
DistributionDone,
@@ -90,14 +102,21 @@ private:
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;
};
} // 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