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