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

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

Issue 2460813002: Make slots in non-shadow trees participate in a flat tree (Closed)
Patch Set: update expectation 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 28 matching lines...) Expand all
39 class AssignedNodesOptions; 39 class AssignedNodesOptions;
40 40
41 class CORE_EXPORT HTMLSlotElement final : public HTMLElement { 41 class CORE_EXPORT HTMLSlotElement final : public HTMLElement {
42 DEFINE_WRAPPERTYPEINFO(); 42 DEFINE_WRAPPERTYPEINFO();
43 43
44 public: 44 public:
45 DECLARE_NODE_FACTORY(HTMLSlotElement); 45 DECLARE_NODE_FACTORY(HTMLSlotElement);
46 46
47 const HeapVector<Member<Node>>& assignedNodes(); 47 const HeapVector<Member<Node>>& assignedNodes();
48 const HeapVector<Member<Node>>& getDistributedNodes(); 48 const HeapVector<Member<Node>>& getDistributedNodes();
49 const HeapVector<Member<Node>> getDistributedNodesForBinding();
49 const HeapVector<Member<Node>> assignedNodesForBinding( 50 const HeapVector<Member<Node>> assignedNodesForBinding(
50 const AssignedNodesOptions&); 51 const AssignedNodesOptions&);
51 52
52 Node* firstDistributedNode() const { 53 Node* firstDistributedNode() const {
54 DCHECK(supportsDistribution());
53 return m_distributedNodes.isEmpty() ? nullptr 55 return m_distributedNodes.isEmpty() ? nullptr
54 : m_distributedNodes.first().get(); 56 : m_distributedNodes.first().get();
55 } 57 }
56 Node* lastDistributedNode() const { 58 Node* lastDistributedNode() const {
59 DCHECK(supportsDistribution());
57 return m_distributedNodes.isEmpty() ? nullptr 60 return m_distributedNodes.isEmpty() ? nullptr
58 : m_distributedNodes.last().get(); 61 : m_distributedNodes.last().get();
59 } 62 }
60 63
61 Node* distributedNodeNextTo(const Node&) const; 64 Node* distributedNodeNextTo(const Node&) const;
62 Node* distributedNodePreviousTo(const Node&) const; 65 Node* distributedNodePreviousTo(const Node&) const;
63 66
64 void appendAssignedNode(Node&); 67 void appendAssignedNode(Node&);
65 68
66 void resolveDistributedNodes(); 69 void resolveDistributedNodes();
(...skipping 19 matching lines...) Expand all
86 // 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
87 // dirty. e.g. To detect a slotchange event in DOM mutations. 90 // dirty. e.g. To detect a slotchange event in DOM mutations.
88 bool hasAssignedNodesSlow() const; 91 bool hasAssignedNodesSlow() const;
89 bool findHostChildWithSameSlotName() const; 92 bool findHostChildWithSameSlotName() const;
90 93
91 void enqueueSlotChangeEvent(); 94 void enqueueSlotChangeEvent();
92 95
93 void clearDistribution(); 96 void clearDistribution();
94 void saveAndClearDistribution(); 97 void saveAndClearDistribution();
95 98
96 bool supportsDistribution() const { return isInShadowTree(); } 99 bool supportsDistribution() const { return isInV1ShadowTree(); }
97 void updateDistributedNodesManually();
98 100
99 static AtomicString normalizeSlotName(const AtomicString&); 101 static AtomicString normalizeSlotName(const AtomicString&);
100 102
101 DECLARE_VIRTUAL_TRACE(); 103 DECLARE_VIRTUAL_TRACE();
102 104
103 private: 105 private:
104 HTMLSlotElement(Document&); 106 HTMLSlotElement(Document&);
105 107
106 InsertionNotificationRequest insertedInto(ContainerNode*) final; 108 InsertionNotificationRequest insertedInto(ContainerNode*) final;
107 void removedFrom(ContainerNode*) final; 109 void removedFrom(ContainerNode*) final;
108 void willRecalcStyle(StyleRecalcChange) final; 110 void willRecalcStyle(StyleRecalcChange) final;
109 111
110 void dispatchSlotChangeEvent(); 112 void dispatchSlotChangeEvent();
111 113
112 HeapVector<Member<Node>> m_assignedNodes; 114 HeapVector<Member<Node>> m_assignedNodes;
113 HeapVector<Member<Node>> m_distributedNodes; 115 HeapVector<Member<Node>> m_distributedNodes;
114 HeapVector<Member<Node>> m_oldDistributedNodes; 116 HeapVector<Member<Node>> m_oldDistributedNodes;
115 HeapHashMap<Member<const Node>, size_t> m_distributedIndices; 117 HeapHashMap<Member<const Node>, size_t> m_distributedIndices;
116 bool m_slotchangeEventEnqueued = false; 118 bool m_slotchangeEventEnqueued = false;
117 }; 119 };
118 120
119 } // namespace blink 121 } // namespace blink
120 122
121 #endif // HTMLSlotElement_h 123 #endif // HTMLSlotElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Position.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