| 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 29 matching lines...) Expand all Loading... |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class CORE_EXPORT ElementShadow final : public NoBaseWillBeGarbageCollectedFinal
ized<ElementShadow> { | 42 class CORE_EXPORT ElementShadow final : public NoBaseWillBeGarbageCollectedFinal
ized<ElementShadow> { |
| 43 WTF_MAKE_NONCOPYABLE(ElementShadow); | 43 WTF_MAKE_NONCOPYABLE(ElementShadow); |
| 44 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(ElementShadow); | 44 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(ElementShadow); |
| 45 public: | 45 public: |
| 46 static PassOwnPtrWillBeRawPtr<ElementShadow> create(); | 46 static PassOwnPtrWillBeRawPtr<ElementShadow> create(); |
| 47 ~ElementShadow(); | 47 ~ElementShadow(); |
| 48 | 48 |
| 49 Element* host() const; | 49 Element* host() const; |
| 50 ShadowRoot* youngestShadowRoot() const { return m_shadowRoots.head(); } | 50 ShadowRoot& youngestShadowRoot() const { ASSERT(m_shadowRoots.head()); retur
n *m_shadowRoots.head(); } |
| 51 ShadowRoot* oldestShadowRoot() const { return m_shadowRoots.tail(); } | 51 ShadowRoot* oldestShadowRoot() const { return m_shadowRoots.tail(); } |
| 52 ElementShadow* containingShadow() const; | 52 ElementShadow* containingShadow() const; |
| 53 | 53 |
| 54 ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType); | 54 ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType); |
| 55 | 55 |
| 56 bool hasSameStyles(const ElementShadow*) const; | 56 bool hasSameStyles(const ElementShadow*) const; |
| 57 | 57 |
| 58 void attach(const Node::AttachContext&); | 58 void attach(const Node::AttachContext&); |
| 59 void detach(const Node::AttachContext&); | 59 void detach(const Node::AttachContext&); |
| 60 | 60 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SelectRuleFeatureSet m_selectFeatures; | 99 SelectRuleFeatureSet m_selectFeatures; |
| 100 // FIXME: Oilpan: add a heap-based version of DoublyLinkedList<>. | 100 // FIXME: Oilpan: add a heap-based version of DoublyLinkedList<>. |
| 101 DoublyLinkedList<ShadowRoot> m_shadowRoots; | 101 DoublyLinkedList<ShadowRoot> m_shadowRoots; |
| 102 bool m_needsDistributionRecalc; | 102 bool m_needsDistributionRecalc; |
| 103 bool m_needsSelectFeatureSet; | 103 bool m_needsSelectFeatureSet; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 inline Element* ElementShadow::host() const | 106 inline Element* ElementShadow::host() const |
| 107 { | 107 { |
| 108 ASSERT(!m_shadowRoots.isEmpty()); | 108 ASSERT(!m_shadowRoots.isEmpty()); |
| 109 return youngestShadowRoot()->host(); | 109 return youngestShadowRoot().host(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 inline ShadowRoot* Node::youngestShadowRoot() const | 112 inline ShadowRoot* Node::youngestShadowRoot() const |
| 113 { | 113 { |
| 114 if (!isElementNode()) | 114 if (!isElementNode()) |
| 115 return 0; | 115 return 0; |
| 116 return toElement(this)->youngestShadowRoot(); | 116 return toElement(this)->youngestShadowRoot(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 inline ShadowRoot* Element::youngestShadowRoot() const | 119 inline ShadowRoot* Element::youngestShadowRoot() const |
| 120 { | 120 { |
| 121 if (ElementShadow* shadow = this->shadow()) | 121 if (ElementShadow* shadow = this->shadow()) |
| 122 return shadow->youngestShadowRoot(); | 122 return &shadow->youngestShadowRoot(); |
| 123 return 0; | 123 return 0; |
| 124 } | 124 } |
| 125 | 125 |
| 126 inline ElementShadow* ElementShadow::containingShadow() const | 126 inline ElementShadow* ElementShadow::containingShadow() const |
| 127 { | 127 { |
| 128 if (ShadowRoot* parentRoot = host()->containingShadowRoot()) | 128 if (ShadowRoot* parentRoot = host()->containingShadowRoot()) |
| 129 return parentRoot->owner(); | 129 return parentRoot->owner(); |
| 130 return 0; | 130 return 0; |
| 131 } | 131 } |
| 132 | 132 |
| 133 inline void ElementShadow::distributeIfNeeded() | 133 inline void ElementShadow::distributeIfNeeded() |
| 134 { | 134 { |
| 135 if (m_needsDistributionRecalc) | 135 if (m_needsDistributionRecalc) |
| 136 distribute(); | 136 distribute(); |
| 137 m_needsDistributionRecalc = false; | 137 m_needsDistributionRecalc = false; |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace | 140 } // namespace |
| 141 | 141 |
| 142 #endif | 142 #endif |
| OLD | NEW |