| Index: third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.h
|
| diff --git a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h b/third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.h
|
| similarity index 55%
|
| copy from third_party/WebKit/Source/core/dom/shadow/ElementShadow.h
|
| copy to third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.h
|
| index 3a4fbb1fd402a8c5b3f52b4ab99e2a53479e8e1d..e6206069bdabbe9ffc2f649fa5f75b7dc8339a09 100644
|
| --- a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h
|
| +++ b/third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.h
|
| @@ -24,117 +24,55 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef ElementShadow_h
|
| -#define ElementShadow_h
|
| +#ifndef ElementShadowV0_h
|
| +#define ElementShadowV0_h
|
|
|
| #include "core/CoreExport.h"
|
| #include "core/dom/shadow/InsertionPoint.h"
|
| #include "core/dom/shadow/SelectRuleFeatureSet.h"
|
| -#include "core/dom/shadow/ShadowRoot.h"
|
| #include "platform/heap/Handle.h"
|
| -#include "wtf/HashMap.h"
|
| #include "wtf/Noncopyable.h"
|
|
|
| namespace blink {
|
|
|
| -class CORE_EXPORT ElementShadow final : public GarbageCollectedFinalized<ElementShadow> {
|
| - WTF_MAKE_NONCOPYABLE(ElementShadow);
|
| +class CORE_EXPORT ElementShadowV0 final : public GarbageCollectedFinalized<ElementShadowV0> {
|
| + WTF_MAKE_NONCOPYABLE(ElementShadowV0);
|
| public:
|
| - static ElementShadow* create();
|
| - ~ElementShadow();
|
| + static ElementShadowV0* create(ElementShadow&);
|
| + ~ElementShadowV0();
|
|
|
| - Element& host() const;
|
| - ShadowRoot& youngestShadowRoot() const;
|
| - ShadowRoot& oldestShadowRoot() const { DCHECK(m_shadowRoot); return *m_shadowRoot; }
|
| - ElementShadow* containingShadow() const;
|
| -
|
| - ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType);
|
| -
|
| - bool hasSameStyles(const ElementShadow*) const;
|
| -
|
| - void attach(const Node::AttachContext&);
|
| - void detach(const Node::AttachContext&);
|
| -
|
| - void distributeIfNeeded();
|
| - void setNeedsDistributionRecalc();
|
| - bool needsDistributionRecalc() const { return m_needsDistributionRecalc; }
|
| -
|
| - bool isV1() const { return youngestShadowRoot().isV1(); };
|
| - bool isOpenOrV0() const { return youngestShadowRoot().isOpenOrV0(); };
|
| -
|
| - // For only v0
|
| void willAffectSelector();
|
| const SelectRuleFeatureSet& ensureSelectFeatureSet();
|
|
|
| const InsertionPoint* finalDestinationInsertionPointFor(const Node*) const;
|
| const DestinationInsertionPoints* destinationInsertionPointsFor(const Node*) const;
|
|
|
| + void distribute();
|
| void didDistributeNode(const Node*, InsertionPoint*);
|
| + void clearDistribution();
|
|
|
| DECLARE_TRACE();
|
| DECLARE_TRACE_WRAPPERS();
|
|
|
| private:
|
| - ElementShadow();
|
| -
|
| - void appendShadowRoot(ShadowRoot&);
|
| + explicit ElementShadowV0(ElementShadow&);
|
|
|
| - void distribute();
|
| - void clearDistributionV0();
|
| -
|
| - void distributeV0();
|
| - void distributeV1();
|
| + ShadowRoot& youngestShadowRoot() const;
|
| + ShadowRoot& oldestShadowRoot() const;
|
|
|
| - void collectSelectFeatureSetFrom(ShadowRoot&);
|
| void distributeNodeChildrenTo(InsertionPoint*, ContainerNode*);
|
|
|
| + void collectSelectFeatureSetFrom(const ShadowRoot&);
|
| bool needsSelectFeatureSet() const { return m_needsSelectFeatureSet; }
|
| void setNeedsSelectFeatureSet() { m_needsSelectFeatureSet = true; }
|
|
|
| - Member<ShadowRoot> m_shadowRoot;
|
| - bool m_needsDistributionRecalc;
|
| -
|
| - // For only v0
|
| + Member<ElementShadow> m_elementShadow;
|
| using NodeToDestinationInsertionPoints = HeapHashMap<Member<const Node>, Member<DestinationInsertionPoints>>;
|
| NodeToDestinationInsertionPoints m_nodeToInsertionPoints;
|
| SelectRuleFeatureSet m_selectFeatures;
|
| bool m_needsSelectFeatureSet;
|
| };
|
|
|
| -inline Element& ElementShadow::host() const
|
| -{
|
| - DCHECK(m_shadowRoot);
|
| - return m_shadowRoot->host();
|
| -}
|
| -
|
| -inline ShadowRoot* Node::youngestShadowRoot() const
|
| -{
|
| - if (!isElementNode())
|
| - return 0;
|
| - return toElement(this)->youngestShadowRoot();
|
| -}
|
| -
|
| -inline ShadowRoot* Element::youngestShadowRoot() const
|
| -{
|
| - if (ElementShadow* shadow = this->shadow())
|
| - return &shadow->youngestShadowRoot();
|
| - return 0;
|
| -}
|
| -
|
| -inline ElementShadow* ElementShadow::containingShadow() const
|
| -{
|
| - if (ShadowRoot* parentRoot = host().containingShadowRoot())
|
| - return parentRoot->owner();
|
| - return 0;
|
| -}
|
| -
|
| -inline void ElementShadow::distributeIfNeeded()
|
| -{
|
| - if (m_needsDistributionRecalc)
|
| - distribute();
|
| - m_needsDistributionRecalc = false;
|
| -}
|
| -
|
| } // namespace blink
|
|
|
| #endif
|
|
|