OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 23 matching lines...) Expand all Loading... |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/css/CSSSelectorList.h" | 35 #include "core/css/CSSSelectorList.h" |
36 #include "core/dom/shadow/DistributedNodes.h" | 36 #include "core/dom/shadow/DistributedNodes.h" |
37 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
38 #include "core/html/HTMLElement.h" | 38 #include "core/html/HTMLElement.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class CORE_EXPORT InsertionPoint : public HTMLElement { | 42 class CORE_EXPORT InsertionPoint : public HTMLElement { |
43 public: | 43 public: |
44 virtual ~InsertionPoint(); | 44 ~InsertionPoint() override; |
45 | 45 |
46 bool hasDistribution() const { return !m_distributedNodes.isEmpty(); } | 46 bool hasDistribution() const { return !m_distributedNodes.isEmpty(); } |
47 void setDistributedNodes(DistributedNodes&); | 47 void setDistributedNodes(DistributedNodes&); |
48 void clearDistribution() { m_distributedNodes.clear(); } | 48 void clearDistribution() { m_distributedNodes.clear(); } |
49 bool isActive() const; | 49 bool isActive() const; |
50 bool canBeActive() const; | 50 bool canBeActive() const; |
51 | 51 |
52 bool isShadowInsertionPoint() const; | 52 bool isShadowInsertionPoint() const; |
53 bool isContentInsertionPoint() const; | 53 bool isContentInsertionPoint() const; |
54 | 54 |
55 PassRefPtrWillBeRawPtr<StaticNodeList> getDistributedNodes(); | 55 PassRefPtrWillBeRawPtr<StaticNodeList> getDistributedNodes(); |
56 | 56 |
57 virtual bool canAffectSelector() const { return false; } | 57 virtual bool canAffectSelector() const { return false; } |
58 | 58 |
59 virtual void attach(const AttachContext& = AttachContext()) override; | 59 void attach(const AttachContext& = AttachContext()) override; |
60 virtual void detach(const AttachContext& = AttachContext()) override; | 60 void detach(const AttachContext& = AttachContext()) override; |
61 | 61 |
62 bool shouldUseFallbackElements() const; | 62 bool shouldUseFallbackElements() const; |
63 | 63 |
64 size_t distributedNodesSize() const { return m_distributedNodes.size(); } | 64 size_t distributedNodesSize() const { return m_distributedNodes.size(); } |
65 Node* distributedNodeAt(size_t index) const { return m_distributedNodes.at(
index).get(); } | 65 Node* distributedNodeAt(size_t index) const { return m_distributedNodes.at(
index).get(); } |
66 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? 0
: m_distributedNodes.first().get(); } | 66 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? 0
: m_distributedNodes.first().get(); } |
67 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? 0
: m_distributedNodes.last().get(); } | 67 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? 0
: m_distributedNodes.last().get(); } |
68 Node* distributedNodeNextTo(const Node* node) const { return m_distributedNo
des.nextTo(node); } | 68 Node* distributedNodeNextTo(const Node* node) const { return m_distributedNo
des.nextTo(node); } |
69 Node* distributedNodePreviousTo(const Node* node) const { return m_distribut
edNodes.previousTo(node); } | 69 Node* distributedNodePreviousTo(const Node* node) const { return m_distribut
edNodes.previousTo(node); } |
70 | 70 |
71 DECLARE_VIRTUAL_TRACE(); | 71 DECLARE_VIRTUAL_TRACE(); |
72 | 72 |
73 protected: | 73 protected: |
74 InsertionPoint(const QualifiedName&, Document&); | 74 InsertionPoint(const QualifiedName&, Document&); |
75 virtual bool layoutObjectIsNeeded(const ComputedStyle&) override; | 75 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
76 virtual void childrenChanged(const ChildrenChange&) override; | 76 void childrenChanged(const ChildrenChange&) override; |
77 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 77 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
78 virtual void removedFrom(ContainerNode*) override; | 78 void removedFrom(ContainerNode*) override; |
79 virtual void willRecalcStyle(StyleRecalcChange) override; | 79 void willRecalcStyle(StyleRecalcChange) override; |
80 | 80 |
81 private: | 81 private: |
82 bool isInsertionPoint() const = delete; // This will catch anyone doing an u
nnecessary check. | 82 bool isInsertionPoint() const = delete; // This will catch anyone doing an u
nnecessary check. |
83 | 83 |
84 DistributedNodes m_distributedNodes; | 84 DistributedNodes m_distributedNodes; |
85 bool m_registeredWithShadowRoot; | 85 bool m_registeredWithShadowRoot; |
86 }; | 86 }; |
87 | 87 |
88 typedef WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>, 1> DestinationInser
tionPoints; | 88 typedef WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>, 1> DestinationInser
tionPoints; |
89 | 89 |
(...skipping 23 matching lines...) Expand all Loading... |
113 return 0; | 113 return 0; |
114 } | 114 } |
115 | 115 |
116 const InsertionPoint* resolveReprojection(const Node*); | 116 const InsertionPoint* resolveReprojection(const Node*); |
117 | 117 |
118 void collectDestinationInsertionPoints(const Node&, WillBeHeapVector<RawPtrWillB
eMember<InsertionPoint>, 8>& results); | 118 void collectDestinationInsertionPoints(const Node&, WillBeHeapVector<RawPtrWillB
eMember<InsertionPoint>, 8>& results); |
119 | 119 |
120 } // namespace blink | 120 } // namespace blink |
121 | 121 |
122 #endif // InsertionPoint_h | 122 #endif // InsertionPoint_h |
OLD | NEW |