OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Node* distributedNodePreviousTo(const Node&) const; | 54 Node* distributedNodePreviousTo(const Node&) const; |
55 | 55 |
56 void appendAssignedNode(Node&); | 56 void appendAssignedNode(Node&); |
57 | 57 |
58 void resolveDistributedNodes(); | 58 void resolveDistributedNodes(); |
59 void appendDistributedNode(Node&); | 59 void appendDistributedNode(Node&); |
60 void appendDistributedNodesFrom(const HTMLSlotElement& other); | 60 void appendDistributedNodesFrom(const HTMLSlotElement& other); |
61 | 61 |
62 void updateDistributedNodesWithFallback(); | 62 void updateDistributedNodesWithFallback(); |
63 | 63 |
| 64 void lazyReattachDistributedNodesIfNeeded(); |
| 65 |
64 void attach(const AttachContext& = AttachContext()) final; | 66 void attach(const AttachContext& = AttachContext()) final; |
65 void detach(const AttachContext& = AttachContext()) final; | 67 void detach(const AttachContext& = AttachContext()) final; |
66 | 68 |
67 void attributeChanged(const QualifiedName&, const AtomicString& oldValue, co
nst AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) fina
l; | 69 void attributeChanged(const QualifiedName&, const AtomicString& oldValue, co
nst AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) fina
l; |
68 | 70 |
69 short tabIndex() const override; | 71 short tabIndex() const override; |
70 AtomicString name() const; | 72 AtomicString name() const; |
71 | 73 |
72 // This method can be slow because this has to traverse the children of a sh
adow host. | 74 // This method can be slow because this has to traverse the children of a sh
adow host. |
73 // This method should be used only when m_assignedNodes is dirty. | 75 // This method should be used only when m_assignedNodes is dirty. |
74 // e.g. To detect a slotchange event in DOM mutations. | 76 // e.g. To detect a slotchange event in DOM mutations. |
75 bool hasAssignedNodesSlow() const; | 77 bool hasAssignedNodesSlow() const; |
76 bool findHostChildWithSameSlotName() const; | 78 bool findHostChildWithSameSlotName() const; |
77 | 79 |
78 void enqueueSlotChangeEvent(); | 80 void enqueueSlotChangeEvent(); |
79 | 81 |
80 void clearDistribution(); | 82 void clearDistribution(); |
| 83 void saveAndClearDistribution(); |
81 | 84 |
82 static AtomicString normalizeSlotName(const AtomicString&); | 85 static AtomicString normalizeSlotName(const AtomicString&); |
83 | 86 |
84 DECLARE_VIRTUAL_TRACE(); | 87 DECLARE_VIRTUAL_TRACE(); |
85 | 88 |
86 private: | 89 private: |
87 HTMLSlotElement(Document&); | 90 HTMLSlotElement(Document&); |
88 | 91 |
89 InsertionNotificationRequest insertedInto(ContainerNode*) final; | 92 InsertionNotificationRequest insertedInto(ContainerNode*) final; |
90 void removedFrom(ContainerNode*) final; | 93 void removedFrom(ContainerNode*) final; |
91 void willRecalcStyle(StyleRecalcChange) final; | 94 void willRecalcStyle(StyleRecalcChange) final; |
92 | 95 |
93 void dispatchSlotChangeEvent(); | 96 void dispatchSlotChangeEvent(); |
94 | 97 |
95 HeapVector<Member<Node>> m_assignedNodes; | 98 HeapVector<Member<Node>> m_assignedNodes; |
96 HeapVector<Member<Node>> m_distributedNodes; | 99 HeapVector<Member<Node>> m_distributedNodes; |
| 100 HeapVector<Member<Node>> m_oldDistributedNodes; |
97 HeapHashMap<Member<const Node>, size_t> m_distributedIndices; | 101 HeapHashMap<Member<const Node>, size_t> m_distributedIndices; |
98 bool m_slotchangeEventEnqueued = false; | 102 bool m_slotchangeEventEnqueued = false; |
99 }; | 103 }; |
100 | 104 |
101 } // namespace blink | 105 } // namespace blink |
102 | 106 |
103 #endif // HTMLSlotElement_h | 107 #endif // HTMLSlotElement_h |
OLD | NEW |