Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/shadow/ElementShadow.h |
| diff --git a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h |
| index ea06f7786de792acfe1a44ddf5d0918c224697e7..346add4b88104aec29e73227f65791aa406c93b3 100644 |
| --- a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h |
| +++ b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h |
| @@ -31,6 +31,7 @@ |
| #include "core/dom/shadow/InsertionPoint.h" |
| #include "core/dom/shadow/SelectRuleFeatureSet.h" |
| #include "core/dom/shadow/ShadowRoot.h" |
| +#include "core/dom/shadow/SlotAssignment.h" |
| #include "platform/heap/Handle.h" |
| #include "wtf/DoublyLinkedList.h" |
| #include "wtf/HashMap.h" |
| @@ -51,6 +52,19 @@ public: |
| ShadowRoot* oldestShadowRoot() const { return m_shadowRoots.tail(); } |
| ElementShadow* containingShadow() const; |
| + ShadowRoot* shadowRootIfV1() const |
| + { |
| + if (isV1()) |
| + return &youngestShadowRoot(); |
| + return nullptr; |
| + } |
| + |
| + HTMLSlotElement* assignedSlotFor(const Node& node) const |
| + { |
| + ASSERT(m_slotAssignment); |
| + return m_slotAssignment->assignedSlotFor(node); |
| + } |
| + |
| ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType); |
| bool hasSameStyles(const ElementShadow*) const; |
| @@ -69,6 +83,8 @@ public: |
| void didDistributeNode(const Node*, InsertionPoint*); |
| + bool isV1() const { return youngestShadowRoot().isV1(); }; |
| + |
| DECLARE_TRACE(); |
| private: |
| @@ -90,8 +106,6 @@ private: |
| bool needsSelectFeatureSet() const { return m_needsSelectFeatureSet; } |
| void setNeedsSelectFeatureSet() { m_needsSelectFeatureSet = true; } |
| - bool isV1() const { return youngestShadowRoot().type() == ShadowRootType::Open || youngestShadowRoot().type() == ShadowRootType::Closed; }; |
| - |
| #if ENABLE(OILPAN) |
| // The cost of |new| in Oilpan is lower than non-Oilpan. We should reduce |
| // the size of HashMap entry. |
| @@ -106,6 +120,11 @@ private: |
| DoublyLinkedList<ShadowRoot> m_shadowRoots; |
| bool m_needsDistributionRecalc; |
| bool m_needsSelectFeatureSet; |
| + |
| + // TODO(hayato): ShadowRoot should be an owner of SlotAssigment |
| + OwnPtr<SlotAssignment> m_slotAssignment; |
| + |
| + friend std::ostream& operator<<(std::ostream&, const ElementShadow&); |
|
kochi
2015/12/09 08:57:34
Is this for debugging?
hayato
2015/12/09 10:25:40
Done. I forgot to remove it.
|
| }; |
| inline Element* ElementShadow::host() const |
| @@ -128,6 +147,13 @@ inline ShadowRoot* Element::youngestShadowRoot() const |
| return 0; |
| } |
| +inline ShadowRoot* Element::shadowRootIfV1() const |
| +{ |
| + if (ElementShadow* shadow = this->shadow()) |
| + return shadow->shadowRootIfV1(); |
| + return nullptr; |
| +} |
| + |
| inline ElementShadow* ElementShadow::containingShadow() const |
| { |
| if (ShadowRoot* parentRoot = host()->containingShadowRoot()) |