Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: third_party/WebKit/Source/core/dom/shadow/ElementShadow.h

Issue 2322213002: Refactor ElementShadow by separating v0 related features as ElementShadowV0 (Closed)
Patch Set: addressed Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 3a4fbb1fd402a8c5b3f52b4ab99e2a53479e8e1d..c6f0506645d01bd9e2bbe8865a939d91d184a867 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h
+++ b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.h
@@ -28,48 +28,44 @@
#define ElementShadow_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 ElementShadowV0;
+
class CORE_EXPORT ElementShadow final : public GarbageCollectedFinalized<ElementShadow> {
WTF_MAKE_NONCOPYABLE(ElementShadow);
public:
static ElementShadow* create();
~ElementShadow();
- Element& host() const;
+ Element& host() const { DCHECK(m_shadowRoot); return m_shadowRoot->host(); }
+
+ // TODO(hayato): Remove youngestShadowRoot() and oldestShadowRoot() from ElementShadow
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;
+ 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(); };
+ 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 didDistributeNode(const Node*, InsertionPoint*);
+ ElementShadowV0& v0() const { DCHECK(m_elementShadowV0); return *m_elementShadowV0; }
DECLARE_TRACE();
DECLARE_TRACE_WRAPPERS();
@@ -78,39 +74,17 @@ private:
ElementShadow();
void appendShadowRoot(ShadowRoot&);
-
void distribute();
- void clearDistributionV0();
-
- void distributeV0();
- void distributeV1();
-
- void collectSelectFeatureSetFrom(ShadowRoot&);
- void distributeNodeChildrenTo(InsertionPoint*, ContainerNode*);
-
- bool needsSelectFeatureSet() const { return m_needsSelectFeatureSet; }
- void setNeedsSelectFeatureSet() { m_needsSelectFeatureSet = true; }
+ Member<ElementShadowV0> m_elementShadowV0;
Member<ShadowRoot> m_shadowRoot;
bool m_needsDistributionRecalc;
-
- // For only v0
- 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 nullptr;
return toElement(this)->youngestShadowRoot();
}
@@ -118,14 +92,14 @@ inline ShadowRoot* Element::youngestShadowRoot() const
{
if (ElementShadow* shadow = this->shadow())
return &shadow->youngestShadowRoot();
- return 0;
+ return nullptr;
}
inline ElementShadow* ElementShadow::containingShadow() const
{
if (ShadowRoot* parentRoot = host().containingShadowRoot())
return parentRoot->owner();
- return 0;
+ return nullptr;
}
inline void ElementShadow::distributeIfNeeded()
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698