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 24 matching lines...) Expand all Loading... |
35 #include "core/html/HTMLElement.h" | 35 #include "core/html/HTMLElement.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class CORE_EXPORT HTMLSlotElement final : public HTMLElement { | 39 class CORE_EXPORT HTMLSlotElement final : public HTMLElement { |
40 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
41 public: | 41 public: |
42 DECLARE_NODE_FACTORY(HTMLSlotElement); | 42 DECLARE_NODE_FACTORY(HTMLSlotElement); |
43 | 43 |
44 const WillBeHeapVector<RefPtrWillBeMember<Node>> getAssignedNodes() const {
return m_assignedNodes; } | 44 const WillBeHeapVector<RefPtrWillBeMember<Node>> getAssignedNodes() const {
return m_assignedNodes; } |
| 45 // TODO(hayato): Support fallback contents of slot elements |
45 const WillBeHeapVector<RefPtrWillBeMember<Node>> getDistributedNodes() const
{ return m_distributedNodes; } | 46 const WillBeHeapVector<RefPtrWillBeMember<Node>> getDistributedNodes() const
{ return m_distributedNodes; } |
46 | 47 |
47 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n
ullptr : m_distributedNodes.first().get(); } | 48 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n
ullptr : m_distributedNodes.first().get(); } |
48 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu
llptr : m_distributedNodes.last().get(); } | 49 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu
llptr : m_distributedNodes.last().get(); } |
49 | 50 |
50 // TODO(hayato): This takes O(N). Make it O(1) with node-to-index hash table
. | 51 // TODO(hayato): This takes O(N). Make it O(1) with node-to-index hash table
. |
51 Node* distributedNodeNextTo(const Node&) const; | 52 Node* distributedNodeNextTo(const Node&) const; |
52 Node* distributedNodePreviousTo(const Node&) const; | 53 Node* distributedNodePreviousTo(const Node&) const; |
53 | 54 |
54 void appendAssignedNode(Node&); | 55 void appendAssignedNode(Node&); |
55 void appendDistributedNode(Node&); | 56 void appendDistributedNode(Node&); |
56 void appendDistributedNodes(const WillBeHeapVector<RefPtrWillBeMember<Node>>
&); | 57 void appendDistributedNodes(const WillBeHeapVector<RefPtrWillBeMember<Node>>
&); |
57 void clearDistribution(); | 58 void clearDistribution(); |
58 | 59 |
59 void updateDistributedNodesWithFallback(); | |
60 | |
61 void attach(const AttachContext& = AttachContext()) override; | 60 void attach(const AttachContext& = AttachContext()) override; |
62 void detach(const AttachContext& = AttachContext()) override; | 61 void detach(const AttachContext& = AttachContext()) override; |
63 | 62 |
64 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
65 | 64 |
66 private: | 65 private: |
67 HTMLSlotElement(Document&); | 66 HTMLSlotElement(Document&); |
68 | 67 |
69 WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes; | 68 WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes; |
70 // TODO(hayato): Share code with DistributedNode class | 69 // TODO(hayato): Share code with DistributedNode class |
71 WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes; | 70 WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes; |
72 }; | 71 }; |
73 | 72 |
74 } // namespace blink | 73 } // namespace blink |
75 | 74 |
76 #endif // HTMLSlotElement_h | 75 #endif // HTMLSlotElement_h |
OLD | NEW |