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

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

Issue 1489433002: Support the essential part of Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert Internals.* Created 5 years 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 21 matching lines...) Expand all
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 WillBeHeapVector<RefPtrWillBeMember<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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAttributeNames.in ('k') | third_party/WebKit/Source/core/html/HTMLSlotElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698