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

Side by Side 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: wip 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 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 25 matching lines...) Expand all
36 36
37 namespace blink { 37 namespace blink {
38 38
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 public: 43 public:
44 DECLARE_NODE_FACTORY(HTMLSlotElement); 44 DECLARE_NODE_FACTORY(HTMLSlotElement);
45 45
46 const HeapVector<Member<Node>>& assignedNodes() const { return m_assignedNod es; } 46 const HeapVector<Member<Node>>& assignedNodes();
47 const HeapVector<Member<Node>>& getDistributedNodes(); 47 const HeapVector<Member<Node>>& getDistributedNodes();
48 const HeapVector<Member<Node>> assignedNodesForBinding(const AssignedNodesOp tions&); 48 const HeapVector<Member<Node>> assignedNodesForBinding(const AssignedNodesOp tions&);
49 49
50 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n ullptr : m_distributedNodes.first().get(); } 50 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n ullptr : m_distributedNodes.first().get(); }
51 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu llptr : m_distributedNodes.last().get(); } 51 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu llptr : m_distributedNodes.last().get(); }
52 52
53 Node* distributedNodeNextTo(const Node&) const; 53 Node* distributedNodeNextTo(const Node&) const;
54 Node* distributedNodePreviousTo(const Node&) const; 54 Node* distributedNodePreviousTo(const Node&) const;
55 55
56 void appendAssignedNode(Node&); 56 void appendAssignedNode(Node&);
57 void willUpdateAssignment();
58 void appendDistributedNode(Node&); 57 void appendDistributedNode(Node&);
59 void appendDistributedNodesFrom(const HTMLSlotElement& other); 58 void appendDistributedNodesFrom(const HTMLSlotElement& other);
60 void willUpdateDistribution();
61 void appendFallbackNode(Node&);
62 void willUpdateFallback();
63 59
64 void didUpdateAssignment();
65 void updateFallbackNodes();
66 void updateDistributedNodesWithFallback(); 60 void updateDistributedNodesWithFallback();
67 void didUpdateDistribution();
68
69 void fireSlotChangeEvent();
70 61
71 void attach(const AttachContext& = AttachContext()) final; 62 void attach(const AttachContext& = AttachContext()) final;
72 void detach(const AttachContext& = AttachContext()) final; 63 void detach(const AttachContext& = AttachContext()) final;
73 64
74 void attributeChanged(const QualifiedName&, const AtomicString& oldValue, co nst AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) fina l; 65 void attributeChanged(const QualifiedName&, const AtomicString& oldValue, co nst AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) fina l;
75 66
76 short tabIndex() const override; 67 short tabIndex() const override;
77 AtomicString name() const; 68 AtomicString name() const;
78 69
70 bool hasAssignedNodesSynchronously() const;
esprehn 2016/05/23 06:41:01 what does the sync mean on this? Can you add a com
hayato 2016/05/24 13:23:39 Yeah, I agree this is a confusing name.. I renamed
71 bool findHostChildWithSameSlotName() const;
72
73 void enqueueSlotChangeEvent();
74
75 void clearDistribution();
76
77 static AtomicString normalizeSlotName(const AtomicString&);
78
79 DECLARE_VIRTUAL_TRACE(); 79 DECLARE_VIRTUAL_TRACE();
80 80
81 private: 81 private:
82 HTMLSlotElement(Document&); 82 HTMLSlotElement(Document&);
83 83
84 enum AssignmentState {
85 AssignmentOnGoing,
86 AssignmentDone,
87 AssignmentChanged,
88 AssignmentUnchanged
89 };
90
91 enum DistributionState {
92 DistributionOnGoing,
93 DistributionDone,
94 DistributionChanged,
95 DistributionUnchanged
96 };
97
98 void clearDistribution();
99 void childrenChanged(const ChildrenChange&) final;
100 InsertionNotificationRequest insertedInto(ContainerNode*) final; 84 InsertionNotificationRequest insertedInto(ContainerNode*) final;
101 void removedFrom(ContainerNode*) final; 85 void removedFrom(ContainerNode*) final;
102 void willRecalcStyle(StyleRecalcChange) final; 86 void willRecalcStyle(StyleRecalcChange) final;
103 87
104 void dispatchSlotChangeEvent(); 88 void dispatchSlotChangeEvent();
105 bool assignmentChanged();
106 bool distributionChanged();
107 bool fallbackChanged();
108 89
109 HeapVector<Member<Node>> m_assignedNodes; 90 HeapVector<Member<Node>> m_assignedNodes;
110 HeapVector<Member<Node>> m_distributedNodes; 91 HeapVector<Member<Node>> m_distributedNodes;
111 HeapVector<Member<Node>> m_fallbackNodes;
112 HeapHashMap<Member<const Node>, size_t> m_distributedIndices; 92 HeapHashMap<Member<const Node>, size_t> m_distributedIndices;
113 HeapVector<Member<Node>> m_oldAssignedNodes; 93 bool m_slotchangeEventEnqueued = false;
114 // TODO(hayato): Remove m_oldDistibutedNodes and make SlotAssignment check t he diffirence between old and new distributed nodes for each slot to save the me mories.
115 HeapVector<Member<Node>> m_oldDistributedNodes;
116 HeapVector<Member<Node>> m_oldFallbackNodes;
117 DistributionState m_distributionState;
118 AssignmentState m_assignmentState;
119 bool m_slotchangeEventAdded;
120 }; 94 };
121 95
122 } // namespace blink 96 } // namespace blink
123 97
124 #endif // HTMLSlotElement_h 98 #endif // HTMLSlotElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698