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

Side by Side Diff: sky/engine/core/dom/shadow/ShadowRoot.cpp

Issue 704413007: Remove HTMLShadowElement. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 19 matching lines...) Expand all
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "core/css/StyleSheetList.h" 31 #include "core/css/StyleSheetList.h"
32 #include "core/css/resolver/StyleResolver.h" 32 #include "core/css/resolver/StyleResolver.h"
33 #include "core/dom/ElementTraversal.h" 33 #include "core/dom/ElementTraversal.h"
34 #include "core/dom/StyleEngine.h" 34 #include "core/dom/StyleEngine.h"
35 #include "core/dom/Text.h" 35 #include "core/dom/Text.h"
36 #include "core/dom/shadow/ElementShadow.h" 36 #include "core/dom/shadow/ElementShadow.h"
37 #include "core/dom/shadow/InsertionPoint.h" 37 #include "core/dom/shadow/InsertionPoint.h"
38 #include "core/dom/shadow/ShadowRootRareData.h" 38 #include "core/dom/shadow/ShadowRootRareData.h"
39 #include "core/editing/markup.h" 39 #include "core/editing/markup.h"
40 #include "core/html/HTMLShadowElement.h"
41 #include "public/platform/Platform.h" 40 #include "public/platform/Platform.h"
42 41
43 namespace blink { 42 namespace blink {
44 43
45 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> { 44 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> {
46 void* pointers[3]; 45 void* pointers[3];
47 unsigned countersAndFlags[1]; 46 unsigned countersAndFlags[1];
48 }; 47 };
49 48
50 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh ould_stay_small); 49 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh ould_stay_small);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (!root) 154 if (!root)
156 root = insertionPoint->containingShadowRoot(); 155 root = insertionPoint->containingShadowRoot();
157 if (root) 156 if (root)
158 root->removeChildShadowRoot(); 157 root->removeChildShadowRoot();
159 m_registeredWithParentShadowRoot = false; 158 m_registeredWithParentShadowRoot = false;
160 } 159 }
161 160
162 DocumentFragment::removedFrom(insertionPoint); 161 DocumentFragment::removedFrom(insertionPoint);
163 } 162 }
164 163
165 void ShadowRoot::childrenChanged(const ChildrenChange& change)
166 {
167 ContainerNode::childrenChanged(change);
168
169 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) {
170 if (ShadowRoot* root = point->containingShadowRoot())
171 root->owner()->setNeedsDistributionRecalc();
172 }
173 }
174
175 void ShadowRoot::registerScopedHTMLStyleChild() 164 void ShadowRoot::registerScopedHTMLStyleChild()
176 { 165 {
177 ++m_numberOfStyles; 166 ++m_numberOfStyles;
178 } 167 }
179 168
180 void ShadowRoot::unregisterScopedHTMLStyleChild() 169 void ShadowRoot::unregisterScopedHTMLStyleChild()
181 { 170 {
182 ASSERT(m_numberOfStyles > 0); 171 ASSERT(m_numberOfStyles > 0);
183 --m_numberOfStyles; 172 --m_numberOfStyles;
184 } 173 }
185 174
186 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData() 175 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData()
187 { 176 {
188 if (m_shadowRootRareData) 177 if (m_shadowRootRareData)
189 return m_shadowRootRareData.get(); 178 return m_shadowRootRareData.get();
190 179
191 m_shadowRootRareData = adoptPtr(new ShadowRootRareData); 180 m_shadowRootRareData = adoptPtr(new ShadowRootRareData);
192 return m_shadowRootRareData.get(); 181 return m_shadowRootRareData.get();
193 } 182 }
194 183
195 bool ShadowRoot::containsShadowElements() const
196 {
197 return m_shadowRootRareData ? m_shadowRootRareData->containsShadowElements() : 0;
198 }
199
200 bool ShadowRoot::containsContentElements() const 184 bool ShadowRoot::containsContentElements() const
201 { 185 {
202 return m_shadowRootRareData ? m_shadowRootRareData->containsContentElements( ) : 0; 186 return m_shadowRootRareData ? m_shadowRootRareData->containsContentElements( ) : 0;
203 } 187 }
204 188
205 bool ShadowRoot::containsShadowRoots() const 189 bool ShadowRoot::containsShadowRoots() const
206 { 190 {
207 return m_shadowRootRareData ? m_shadowRootRareData->containsShadowRoots() : 0; 191 return m_shadowRootRareData ? m_shadowRootRareData->containsShadowRoots() : 0;
208 } 192 }
209 193
210 unsigned ShadowRoot::descendantShadowElementCount() const
211 {
212 return m_shadowRootRareData ? m_shadowRootRareData->descendantShadowElementC ount() : 0;
213 }
214
215 HTMLShadowElement* ShadowRoot::shadowInsertionPointOfYoungerShadowRoot() const
216 {
217 return m_shadowRootRareData ? m_shadowRootRareData->shadowInsertionPointOfYo ungerShadowRoot() : 0;
218 }
219
220 void ShadowRoot::setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShado wElement> shadowInsertionPoint)
221 {
222 if (!m_shadowRootRareData && !shadowInsertionPoint)
223 return;
224 ensureShadowRootRareData()->setShadowInsertionPointOfYoungerShadowRoot(shado wInsertionPoint);
225 }
226
227 void ShadowRoot::didAddInsertionPoint(InsertionPoint* insertionPoint) 194 void ShadowRoot::didAddInsertionPoint(InsertionPoint* insertionPoint)
228 { 195 {
229 ensureShadowRootRareData()->didAddInsertionPoint(insertionPoint); 196 ensureShadowRootRareData()->didAddInsertionPoint(insertionPoint);
230 invalidateDescendantInsertionPoints(); 197 invalidateDescendantInsertionPoints();
231 } 198 }
232 199
233 void ShadowRoot::didRemoveInsertionPoint(InsertionPoint* insertionPoint) 200 void ShadowRoot::didRemoveInsertionPoint(InsertionPoint* insertionPoint)
234 { 201 {
235 m_shadowRootRareData->didRemoveInsertionPoint(insertionPoint); 202 m_shadowRootRareData->didRemoveInsertionPoint(insertionPoint);
236 invalidateDescendantInsertionPoints(); 203 invalidateDescendantInsertionPoints();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void ShadowRoot::trace(Visitor* visitor) 258 void ShadowRoot::trace(Visitor* visitor)
292 { 259 {
293 visitor->trace(m_prev); 260 visitor->trace(m_prev);
294 visitor->trace(m_next); 261 visitor->trace(m_next);
295 visitor->trace(m_shadowRootRareData); 262 visitor->trace(m_shadowRootRareData);
296 TreeScope::trace(visitor); 263 TreeScope::trace(visitor);
297 DocumentFragment::trace(visitor); 264 DocumentFragment::trace(visitor);
298 } 265 }
299 266
300 } 267 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/shadow/ShadowRoot.h ('k') | sky/engine/core/dom/shadow/ShadowRootRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698