| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 bool shouldUseFallbackElements() const; | 62 bool shouldUseFallbackElements() const; |
| 63 | 63 |
| 64 size_t size() const { return m_distribution.size(); } | 64 size_t size() const { return m_distribution.size(); } |
| 65 Node* at(size_t index) const { return m_distribution.at(index).get(); } | 65 Node* at(size_t index) const { return m_distribution.at(index).get(); } |
| 66 Node* first() const { return m_distribution.isEmpty() ? 0 : m_distribution.f
irst().get(); } | 66 Node* first() const { return m_distribution.isEmpty() ? 0 : m_distribution.f
irst().get(); } |
| 67 Node* last() const { return m_distribution.isEmpty() ? 0 : m_distribution.la
st().get(); } | 67 Node* last() const { return m_distribution.isEmpty() ? 0 : m_distribution.la
st().get(); } |
| 68 Node* nextTo(const Node* node) const { return m_distribution.nextTo(node); } | 68 Node* nextTo(const Node* node) const { return m_distribution.nextTo(node); } |
| 69 Node* previousTo(const Node* node) const { return m_distribution.previousTo(
node); } | 69 Node* previousTo(const Node* node) const { return m_distribution.previousTo(
node); } |
| 70 | 70 |
| 71 virtual void trace(Visitor*) OVERRIDE; |
| 72 |
| 71 protected: | 73 protected: |
| 72 InsertionPoint(const QualifiedName&, Document&); | 74 InsertionPoint(const QualifiedName&, Document&); |
| 73 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; | 75 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; |
| 74 virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node*
afterChange, int childCountDelta) OVERRIDE; | 76 virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node*
afterChange, int childCountDelta) OVERRIDE; |
| 75 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 77 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
| 76 virtual void removedFrom(ContainerNode*) OVERRIDE; | 78 virtual void removedFrom(ContainerNode*) OVERRIDE; |
| 77 virtual void willRecalcStyle(StyleRecalcChange) OVERRIDE; | 79 virtual void willRecalcStyle(StyleRecalcChange) OVERRIDE; |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 ContentDistribution m_distribution; | 82 ContentDistribution m_distribution; |
| 81 bool m_registeredWithShadowRoot; | 83 bool m_registeredWithShadowRoot; |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 typedef Vector<RefPtr<InsertionPoint> > DestinationInsertionPoints; | 86 typedef WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> > DestinationInserti
onPoints; |
| 85 | 87 |
| 86 DEFINE_ELEMENT_TYPE_CASTS(InsertionPoint, isInsertionPoint()); | 88 DEFINE_ELEMENT_TYPE_CASTS(InsertionPoint, isInsertionPoint()); |
| 87 | 89 |
| 88 inline bool isActiveInsertionPoint(const Node& node) | 90 inline bool isActiveInsertionPoint(const Node& node) |
| 89 { | 91 { |
| 90 return node.isInsertionPoint() && toInsertionPoint(node).isActive(); | 92 return node.isInsertionPoint() && toInsertionPoint(node).isActive(); |
| 91 } | 93 } |
| 92 | 94 |
| 93 inline bool isActiveShadowInsertionPoint(const Node& node) | 95 inline bool isActiveShadowInsertionPoint(const Node& node) |
| 94 { | 96 { |
| 95 return node.isInsertionPoint() && toInsertionPoint(node).isShadowInsertionPo
int(); | 97 return node.isInsertionPoint() && toInsertionPoint(node).isShadowInsertionPo
int(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 inline ElementShadow* shadowWhereNodeCanBeDistributed(const Node& node) | 100 inline ElementShadow* shadowWhereNodeCanBeDistributed(const Node& node) |
| 99 { | 101 { |
| 100 Node* parent = node.parentNode(); | 102 Node* parent = node.parentNode(); |
| 101 if (!parent) | 103 if (!parent) |
| 102 return 0; | 104 return 0; |
| 103 if (parent->isShadowRoot() && !toShadowRoot(parent)->isYoungest()) | 105 if (parent->isShadowRoot() && !toShadowRoot(parent)->isYoungest()) |
| 104 return node.shadowHost()->shadow(); | 106 return node.shadowHost()->shadow(); |
| 105 if (isActiveInsertionPoint(*parent)) | 107 if (isActiveInsertionPoint(*parent)) |
| 106 return node.shadowHost()->shadow(); | 108 return node.shadowHost()->shadow(); |
| 107 if (parent->isElementNode()) | 109 if (parent->isElementNode()) |
| 108 return toElement(parent)->shadow(); | 110 return toElement(parent)->shadow(); |
| 109 return 0; | 111 return 0; |
| 110 } | 112 } |
| 111 | 113 |
| 112 const InsertionPoint* resolveReprojection(const Node*); | 114 const InsertionPoint* resolveReprojection(const Node*); |
| 113 | 115 |
| 114 void collectDestinationInsertionPoints(const Node&, Vector<InsertionPoint*, 8>&
results); | 116 void collectDestinationInsertionPoints(const Node&, WillBeHeapVector<RawPtrWillB
eMember<InsertionPoint>, 8>& results); |
| 115 | 117 |
| 116 } // namespace WebCore | 118 } // namespace WebCore |
| 117 | 119 |
| 118 #endif // InsertionPoint_h | 120 #endif // InsertionPoint_h |
| OLD | NEW |