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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.h

Issue 2420043002: Stop re-signaling a slotchange event (Closed)
Patch Set: rebased Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 short tabIndex() const override; 85 short tabIndex() const override;
86 AtomicString name() const; 86 AtomicString name() const;
87 87
88 // This method can be slow because this has to traverse the children of a 88 // This method can be slow because this has to traverse the children of a
89 // shadow host. This method should be used only when m_assignedNodes is 89 // shadow host. This method should be used only when m_assignedNodes is
90 // dirty. e.g. To detect a slotchange event in DOM mutations. 90 // dirty. e.g. To detect a slotchange event in DOM mutations.
91 bool hasAssignedNodesSlow() const; 91 bool hasAssignedNodesSlow() const;
92 bool findHostChildWithSameSlotName() const; 92 bool findHostChildWithSameSlotName() const;
93 93
94 void enqueueSlotChangeEvent();
95
96 void clearDistribution(); 94 void clearDistribution();
97 void saveAndClearDistribution(); 95 void saveAndClearDistribution();
98 96
99 bool supportsDistribution() const { return isInV1ShadowTree(); } 97 bool supportsDistribution() const { return isInV1ShadowTree(); }
98 void didSlotChange(SlotChangeType);
100 99
101 static AtomicString normalizeSlotName(const AtomicString&); 100 static AtomicString normalizeSlotName(const AtomicString&);
102 101
103 DECLARE_VIRTUAL_TRACE(); 102 DECLARE_VIRTUAL_TRACE();
104 103
105 private: 104 private:
106 HTMLSlotElement(Document&); 105 HTMLSlotElement(Document&);
107 106
108 InsertionNotificationRequest insertedInto(ContainerNode*) final; 107 InsertionNotificationRequest insertedInto(ContainerNode*) final;
109 void removedFrom(ContainerNode*) final; 108 void removedFrom(ContainerNode*) final;
110 void willRecalcStyle(StyleRecalcChange) final; 109 void willRecalcStyle(StyleRecalcChange) final;
111 110
111 void enqueueSlotChangeEvent();
112 void dispatchSlotChangeEvent(); 112 void dispatchSlotChangeEvent();
113 113
114 HeapVector<Member<Node>> m_assignedNodes; 114 HeapVector<Member<Node>> m_assignedNodes;
115 HeapVector<Member<Node>> m_distributedNodes; 115 HeapVector<Member<Node>> m_distributedNodes;
116 HeapVector<Member<Node>> m_oldDistributedNodes; 116 HeapVector<Member<Node>> m_oldDistributedNodes;
117 HeapHashMap<Member<const Node>, size_t> m_distributedIndices; 117 HeapHashMap<Member<const Node>, size_t> m_distributedIndices;
118 bool m_slotchangeEventEnqueued = false; 118 bool m_slotchangeEventEnqueued = false;
119 }; 119 };
120 120
121 } // namespace blink 121 } // namespace blink
122 122
123 #endif // HTMLSlotElement_h 123 #endif // HTMLSlotElement_h
OLDNEW
« 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