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

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

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 11 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 24 matching lines...) Expand all
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
46 const WillBeHeapVector<RefPtrWillBeMember<Node>> getDistributedNodes() const { return m_distributedNodes; } 45 const WillBeHeapVector<RefPtrWillBeMember<Node>> getDistributedNodes() const { return m_distributedNodes; }
47 46
48 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n ullptr : m_distributedNodes.first().get(); } 47 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(); } 48 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu llptr : m_distributedNodes.last().get(); }
50 49
51 // TODO(hayato): This takes O(N). Make it O(1) with node-to-index hash table . 50 // TODO(hayato): This takes O(N). Make it O(1) with node-to-index hash table .
52 Node* distributedNodeNextTo(const Node&) const; 51 Node* distributedNodeNextTo(const Node&) const;
53 Node* distributedNodePreviousTo(const Node&) const; 52 Node* distributedNodePreviousTo(const Node&) const;
54 53
55 void appendAssignedNode(Node&); 54 void appendAssignedNode(Node&);
56 void appendDistributedNode(Node&); 55 void appendDistributedNode(Node&);
57 void appendDistributedNodes(const WillBeHeapVector<RefPtrWillBeMember<Node>> &); 56 void appendDistributedNodes(const WillBeHeapVector<RefPtrWillBeMember<Node>> &);
58 void clearDistribution(); 57 void clearDistribution();
59 58
59 void updateDistributedNodesWithFallback();
60
60 void attach(const AttachContext& = AttachContext()) override; 61 void attach(const AttachContext& = AttachContext()) override;
61 void detach(const AttachContext& = AttachContext()) override; 62 void detach(const AttachContext& = AttachContext()) override;
62 63
63 DECLARE_VIRTUAL_TRACE(); 64 DECLARE_VIRTUAL_TRACE();
64 65
65 private: 66 private:
66 HTMLSlotElement(Document&); 67 HTMLSlotElement(Document&);
67 68
68 WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes; 69 WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes;
69 // TODO(hayato): Share code with DistributedNode class 70 // TODO(hayato): Share code with DistributedNode class
70 WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes; 71 WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes;
71 }; 72 };
72 73
73 } // namespace blink 74 } // namespace blink
74 75
75 #endif // HTMLSlotElement_h 76 #endif // HTMLSlotElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/SlotAssignment.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