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

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

Issue 2323953003: Clarify a role of Shadow DOM related functions (Closed)
Patch Set: clarify 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 unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ShadowRoot* oldestShadowRoot() const { return m_shadowRoot; } 48 ShadowRoot* oldestShadowRoot() const { return m_shadowRoot; }
49 ElementShadow* containingShadow() const; 49 ElementShadow* containingShadow() const;
50 50
51 ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType); 51 ShadowRoot& addShadowRoot(Element& shadowHost, ShadowRootType);
52 52
53 bool hasSameStyles(const ElementShadow*) const; 53 bool hasSameStyles(const ElementShadow*) const;
54 54
55 void attach(const Node::AttachContext&); 55 void attach(const Node::AttachContext&);
56 void detach(const Node::AttachContext&); 56 void detach(const Node::AttachContext&);
57 57
58 void willAffectSelector();
59 const SelectRuleFeatureSet& ensureSelectFeatureSet();
60
61 void distributeIfNeeded(); 58 void distributeIfNeeded();
62 void setNeedsDistributionRecalc(); 59 void setNeedsDistributionRecalc();
63 bool needsDistributionRecalc() const { return m_needsDistributionRecalc; } 60 bool needsDistributionRecalc() const { return m_needsDistributionRecalc; }
64 61
62 bool isV1() const { return youngestShadowRoot().isV1(); };
63 bool isOpenOrV0() const { return youngestShadowRoot().isOpenOrV0(); };
64
65 // For only v0
66 void willAffectSelector();
67 const SelectRuleFeatureSet& ensureSelectFeatureSet();
68
65 const InsertionPoint* finalDestinationInsertionPointFor(const Node*) const; 69 const InsertionPoint* finalDestinationInsertionPointFor(const Node*) const;
66 const DestinationInsertionPoints* destinationInsertionPointsFor(const Node*) const; 70 const DestinationInsertionPoints* destinationInsertionPointsFor(const Node*) const;
67 71
68 void didDistributeNode(const Node*, InsertionPoint*); 72 void didDistributeNode(const Node*, InsertionPoint*);
69 73
kochi 2016/09/09 06:51:06 nit: Why not adding "V0" or "ForV0" for these func
hayato 2016/09/09 07:03:28 I won't it now. That can be considered at further
70 bool isV1() const { return youngestShadowRoot().isV1(); };
71 bool isOpenOrV0() const { return youngestShadowRoot().isOpenOrV0(); };
72
73 DECLARE_TRACE(); 74 DECLARE_TRACE();
74 DECLARE_TRACE_WRAPPERS(); 75 DECLARE_TRACE_WRAPPERS();
75 76
76 private: 77 private:
77 ElementShadow(); 78 ElementShadow();
78 79
79 void appendShadowRoot(ShadowRoot&); 80 void appendShadowRoot(ShadowRoot&);
80 81
81 void distribute(); 82 void distribute();
82 void clearDistribution(); 83 void clearDistributionV0();
83 84
84 void distributeV0(); 85 void distributeV0();
85 void distributeV1(); 86 void distributeV1();
86 87
87 void collectSelectFeatureSetFrom(ShadowRoot&); 88 void collectSelectFeatureSetFrom(ShadowRoot&);
88 void distributeNodeChildrenTo(InsertionPoint*, ContainerNode*); 89 void distributeNodeChildrenTo(InsertionPoint*, ContainerNode*);
89 90
90 bool needsSelectFeatureSet() const { return m_needsSelectFeatureSet; } 91 bool needsSelectFeatureSet() const { return m_needsSelectFeatureSet; }
91 void setNeedsSelectFeatureSet() { m_needsSelectFeatureSet = true; } 92 void setNeedsSelectFeatureSet() { m_needsSelectFeatureSet = true; }
92 93
94 Member<ShadowRoot> m_shadowRoot;
95 bool m_needsDistributionRecalc;
96
97 // For only v0
93 using NodeToDestinationInsertionPoints = HeapHashMap<Member<const Node>, Mem ber<DestinationInsertionPoints>>; 98 using NodeToDestinationInsertionPoints = HeapHashMap<Member<const Node>, Mem ber<DestinationInsertionPoints>>;
94 NodeToDestinationInsertionPoints m_nodeToInsertionPoints; 99 NodeToDestinationInsertionPoints m_nodeToInsertionPoints;
95
96 SelectRuleFeatureSet m_selectFeatures; 100 SelectRuleFeatureSet m_selectFeatures;
97 Member<ShadowRoot> m_shadowRoot;
98 bool m_needsDistributionRecalc;
99 bool m_needsSelectFeatureSet; 101 bool m_needsSelectFeatureSet;
100 }; 102 };
101 103
102 inline Element& ElementShadow::host() const 104 inline Element& ElementShadow::host() const
103 { 105 {
104 DCHECK(m_shadowRoot); 106 DCHECK(m_shadowRoot);
105 return m_shadowRoot->host(); 107 return m_shadowRoot->host();
106 } 108 }
107 109
108 inline ShadowRoot* Node::youngestShadowRoot() const 110 inline ShadowRoot* Node::youngestShadowRoot() const
(...skipping 20 matching lines...) Expand all
129 inline void ElementShadow::distributeIfNeeded() 131 inline void ElementShadow::distributeIfNeeded()
130 { 132 {
131 if (m_needsDistributionRecalc) 133 if (m_needsDistributionRecalc)
132 distribute(); 134 distribute();
133 m_needsDistributionRecalc = false; 135 m_needsDistributionRecalc = false;
134 } 136 }
135 137
136 } // namespace blink 138 } // namespace blink
137 139
138 #endif 140 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698