| 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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class CORE_EXPORT ElementShadow final : public GarbageCollectedFinalized<Element
Shadow> { | 42 class CORE_EXPORT ElementShadow final : public GarbageCollectedFinalized<Element
Shadow> { |
| 43 WTF_MAKE_NONCOPYABLE(ElementShadow); | 43 WTF_MAKE_NONCOPYABLE(ElementShadow); |
| 44 public: | 44 public: |
| 45 static RawPtr<ElementShadow> create(); | 45 static RawPtr<ElementShadow> create(); |
| 46 ~ElementShadow(); | 46 ~ElementShadow(); |
| 47 | 47 |
| 48 Element* host() const; | 48 Element* host() const; |
| 49 ShadowRoot& youngestShadowRoot() const { ASSERT(m_shadowRoots.head()); retur
n *m_shadowRoots.head(); } | 49 ShadowRoot& youngestShadowRoot() const { DCHECK(m_shadowRoots.head()); retur
n *m_shadowRoots.head(); } |
| 50 ShadowRoot* oldestShadowRoot() const { return m_shadowRoots.tail(); } | 50 ShadowRoot* oldestShadowRoot() const { return m_shadowRoots.tail(); } |
| 51 ElementShadow* containingShadow() const; | 51 ElementShadow* containingShadow() const; |
| 52 | 52 |
| 53 ShadowRoot* shadowRootIfV1() const | 53 ShadowRoot* shadowRootIfV1() const |
| 54 { | 54 { |
| 55 if (isV1()) | 55 if (isV1()) |
| 56 return &youngestShadowRoot(); | 56 return &youngestShadowRoot(); |
| 57 return nullptr; | 57 return nullptr; |
| 58 } | 58 } |
| 59 | 59 |
| 60 HTMLSlotElement* assignedSlotFor(const Node& node) const | 60 HTMLSlotElement* assignedSlotFor(const Node& node) const |
| 61 { | 61 { |
| 62 ASSERT(m_slotAssignment); | 62 DCHECK(m_slotAssignment); |
| 63 return m_slotAssignment->assignedSlotFor(node); | 63 return m_slotAssignment->assignedSlotFor(node); |
| 64 } | 64 } |
| 65 | 65 |
| 66 ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType); | 66 ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType); |
| 67 | 67 |
| 68 bool hasSameStyles(const ElementShadow*) const; | 68 bool hasSameStyles(const ElementShadow*) const; |
| 69 | 69 |
| 70 void attach(const Node::AttachContext&); | 70 void attach(const Node::AttachContext&); |
| 71 void detach(const Node::AttachContext&); | 71 void detach(const Node::AttachContext&); |
| 72 | 72 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 DoublyLinkedList<ShadowRoot> m_shadowRoots; | 120 DoublyLinkedList<ShadowRoot> m_shadowRoots; |
| 121 bool m_needsDistributionRecalc; | 121 bool m_needsDistributionRecalc; |
| 122 bool m_needsSelectFeatureSet; | 122 bool m_needsSelectFeatureSet; |
| 123 | 123 |
| 124 // TODO(hayato): ShadowRoot should be an owner of SlotAssigment | 124 // TODO(hayato): ShadowRoot should be an owner of SlotAssigment |
| 125 Member<SlotAssignment> m_slotAssignment; | 125 Member<SlotAssignment> m_slotAssignment; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 inline Element* ElementShadow::host() const | 128 inline Element* ElementShadow::host() const |
| 129 { | 129 { |
| 130 ASSERT(!m_shadowRoots.isEmpty()); | 130 DCHECK(!m_shadowRoots.isEmpty()); |
| 131 return youngestShadowRoot().host(); | 131 return youngestShadowRoot().host(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 inline ShadowRoot* Node::youngestShadowRoot() const | 134 inline ShadowRoot* Node::youngestShadowRoot() const |
| 135 { | 135 { |
| 136 if (!isElementNode()) | 136 if (!isElementNode()) |
| 137 return 0; | 137 return 0; |
| 138 return toElement(this)->youngestShadowRoot(); | 138 return toElement(this)->youngestShadowRoot(); |
| 139 } | 139 } |
| 140 | 140 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 162 inline void ElementShadow::distributeIfNeeded() | 162 inline void ElementShadow::distributeIfNeeded() |
| 163 { | 163 { |
| 164 if (m_needsDistributionRecalc) | 164 if (m_needsDistributionRecalc) |
| 165 distribute(); | 165 distribute(); |
| 166 m_needsDistributionRecalc = false; | 166 m_needsDistributionRecalc = false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace blink | 169 } // namespace blink |
| 170 | 170 |
| 171 #endif | 171 #endif |
| OLD | NEW |