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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 28 matching lines...) Expand all
39 #include "core/editing/serializers/Serialization.h" 39 #include "core/editing/serializers/Serialization.h"
40 #include "core/html/HTMLShadowElement.h" 40 #include "core/html/HTMLShadowElement.h"
41 #include "public/platform/Platform.h" 41 #include "public/platform/Platform.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> { 45 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> {
46 #if ENABLE(OILPAN) 46 #if ENABLE(OILPAN)
47 char emptyClassFieldsDueToGCMixinMarker[1]; 47 char emptyClassFieldsDueToGCMixinMarker[1];
48 #endif 48 #endif
49 RawPtrWillBeMember<void*> willbeMember[3]; 49 Member<void*> willbeMember[3];
50 unsigned countersAndFlags[1]; 50 unsigned countersAndFlags[1];
51 }; 51 };
52 52
53 static_assert(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), "ShadowRoot sh ould stay small"); 53 static_assert(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), "ShadowRoot sh ould stay small");
54 54
55 ShadowRoot::ShadowRoot(Document& document, ShadowRootType type) 55 ShadowRoot::ShadowRoot(Document& document, ShadowRootType type)
56 : DocumentFragment(0, CreateShadowRoot) 56 : DocumentFragment(0, CreateShadowRoot)
57 , TreeScope(*this, document) 57 , TreeScope(*this, document)
58 , m_prev(nullptr) 58 , m_prev(nullptr)
59 , m_next(nullptr) 59 , m_next(nullptr)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 ShadowRoot* ShadowRoot::olderShadowRootForBindings() const 105 ShadowRoot* ShadowRoot::olderShadowRootForBindings() const
106 { 106 {
107 ShadowRoot* older = olderShadowRoot(); 107 ShadowRoot* older = olderShadowRoot();
108 while (older && !older->isOpenOrV0()) 108 while (older && !older->isOpenOrV0())
109 older = older->olderShadowRoot(); 109 older = older->olderShadowRoot();
110 ASSERT(!older || older->isOpenOrV0()); 110 ASSERT(!older || older->isOpenOrV0());
111 return older; 111 return older;
112 } 112 }
113 113
114 PassRefPtrWillBeRawPtr<Node> ShadowRoot::cloneNode(bool, ExceptionState& excepti onState) 114 RawPtr<Node> ShadowRoot::cloneNode(bool, ExceptionState& exceptionState)
115 { 115 {
116 exceptionState.throwDOMException(NotSupportedError, "ShadowRoot nodes are no t clonable."); 116 exceptionState.throwDOMException(NotSupportedError, "ShadowRoot nodes are no t clonable.");
117 return nullptr; 117 return nullptr;
118 } 118 }
119 119
120 String ShadowRoot::innerHTML() const 120 String ShadowRoot::innerHTML() const
121 { 121 {
122 return createMarkup(this, ChildrenOnly); 122 return createMarkup(this, ChildrenOnly);
123 } 123 }
124 124
125 void ShadowRoot::setInnerHTML(const String& markup, ExceptionState& exceptionSta te) 125 void ShadowRoot::setInnerHTML(const String& markup, ExceptionState& exceptionSta te)
126 { 126 {
127 if (isOrphan()) { 127 if (isOrphan()) {
128 exceptionState.throwDOMException(InvalidAccessError, "The ShadowRoot doe s not have a host."); 128 exceptionState.throwDOMException(InvalidAccessError, "The ShadowRoot doe s not have a host.");
129 return; 129 return;
130 } 130 }
131 131
132 if (RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOu terHTML(markup, host(), AllowScriptingContent, "innerHTML", exceptionState)) 132 if (RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(mark up, host(), AllowScriptingContent, "innerHTML", exceptionState))
133 replaceChildrenWithFragment(this, fragment.release(), exceptionState); 133 replaceChildrenWithFragment(this, fragment.release(), exceptionState);
134 } 134 }
135 135
136 void ShadowRoot::recalcStyle(StyleRecalcChange change) 136 void ShadowRoot::recalcStyle(StyleRecalcChange change)
137 { 137 {
138 // ShadowRoot doesn't support custom callbacks. 138 // ShadowRoot doesn't support custom callbacks.
139 ASSERT(!hasCustomStyleCallbacks()); 139 ASSERT(!hasCustomStyleCallbacks());
140 140
141 StyleSharingDepthScope sharingScope(*this); 141 StyleSharingDepthScope sharingScope(*this);
142 142
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 unsigned ShadowRoot::descendantShadowElementCount() const 245 unsigned ShadowRoot::descendantShadowElementCount() const
246 { 246 {
247 return m_shadowRootRareData ? m_shadowRootRareData->descendantShadowElementC ount() : 0; 247 return m_shadowRootRareData ? m_shadowRootRareData->descendantShadowElementC ount() : 0;
248 } 248 }
249 249
250 HTMLShadowElement* ShadowRoot::shadowInsertionPointOfYoungerShadowRoot() const 250 HTMLShadowElement* ShadowRoot::shadowInsertionPointOfYoungerShadowRoot() const
251 { 251 {
252 return m_shadowRootRareData ? m_shadowRootRareData->shadowInsertionPointOfYo ungerShadowRoot() : 0; 252 return m_shadowRootRareData ? m_shadowRootRareData->shadowInsertionPointOfYo ungerShadowRoot() : 0;
253 } 253 }
254 254
255 void ShadowRoot::setShadowInsertionPointOfYoungerShadowRoot(PassRefPtrWillBeRawP tr<HTMLShadowElement> shadowInsertionPoint) 255 void ShadowRoot::setShadowInsertionPointOfYoungerShadowRoot(RawPtr<HTMLShadowEle ment> shadowInsertionPoint)
256 { 256 {
257 if (!m_shadowRootRareData && !shadowInsertionPoint) 257 if (!m_shadowRootRareData && !shadowInsertionPoint)
258 return; 258 return;
259 ensureShadowRootRareData()->setShadowInsertionPointOfYoungerShadowRoot(shado wInsertionPoint); 259 ensureShadowRootRareData()->setShadowInsertionPointOfYoungerShadowRoot(shado wInsertionPoint);
260 } 260 }
261 261
262 void ShadowRoot::didAddInsertionPoint(InsertionPoint* insertionPoint) 262 void ShadowRoot::didAddInsertionPoint(InsertionPoint* insertionPoint)
263 { 263 {
264 ensureShadowRootRareData()->didAddInsertionPoint(insertionPoint); 264 ensureShadowRootRareData()->didAddInsertionPoint(insertionPoint);
265 invalidateDescendantInsertionPoints(); 265 invalidateDescendantInsertionPoints();
(...skipping 22 matching lines...) Expand all
288 { 288 {
289 return m_shadowRootRareData ? m_shadowRootRareData->childShadowRootCount() : 0; 289 return m_shadowRootRareData ? m_shadowRootRareData->childShadowRootCount() : 0;
290 } 290 }
291 291
292 void ShadowRoot::invalidateDescendantInsertionPoints() 292 void ShadowRoot::invalidateDescendantInsertionPoints()
293 { 293 {
294 m_descendantInsertionPointsIsValid = false; 294 m_descendantInsertionPointsIsValid = false;
295 m_shadowRootRareData->clearDescendantInsertionPoints(); 295 m_shadowRootRareData->clearDescendantInsertionPoints();
296 } 296 }
297 297
298 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& ShadowRoot::descenda ntInsertionPoints() 298 const HeapVector<Member<InsertionPoint>>& ShadowRoot::descendantInsertionPoints( )
299 { 299 {
300 DEFINE_STATIC_LOCAL(WillBePersistentHeapVector<RefPtrWillBeMember<InsertionP oint>>, emptyList, ()); 300 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<InsertionPoint>>, emptyList, ());
301 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) 301 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid)
302 return m_shadowRootRareData->descendantInsertionPoints(); 302 return m_shadowRootRareData->descendantInsertionPoints();
303 303
304 m_descendantInsertionPointsIsValid = true; 304 m_descendantInsertionPointsIsValid = true;
305 305
306 if (!containsInsertionPoints()) 306 if (!containsInsertionPoints())
307 return emptyList; 307 return emptyList;
308 308
309 WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>> insertionPoints; 309 HeapVector<Member<InsertionPoint>> insertionPoints;
310 for (InsertionPoint& insertionPoint : Traversal<InsertionPoint>::descendants Of(*this)) 310 for (InsertionPoint& insertionPoint : Traversal<InsertionPoint>::descendants Of(*this))
311 insertionPoints.append(&insertionPoint); 311 insertionPoints.append(&insertionPoint);
312 312
313 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); 313 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints);
314 314
315 return m_shadowRootRareData->descendantInsertionPoints(); 315 return m_shadowRootRareData->descendantInsertionPoints();
316 } 316 }
317 317
318 StyleSheetList* ShadowRoot::styleSheets() 318 StyleSheetList* ShadowRoot::styleSheets()
319 { 319 {
(...skipping 20 matching lines...) Expand all
340 { 340 {
341 m_descendantSlotsIsValid = false; 341 m_descendantSlotsIsValid = false;
342 m_shadowRootRareData->clearDescendantSlots(); 342 m_shadowRootRareData->clearDescendantSlots();
343 } 343 }
344 344
345 unsigned ShadowRoot::descendantSlotCount() const 345 unsigned ShadowRoot::descendantSlotCount() const
346 { 346 {
347 return m_shadowRootRareData ? m_shadowRootRareData->descendantSlotCount() : 0; 347 return m_shadowRootRareData ? m_shadowRootRareData->descendantSlotCount() : 0;
348 } 348 }
349 349
350 const WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>>& ShadowRoot::descend antSlots() 350 const HeapVector<Member<HTMLSlotElement>>& ShadowRoot::descendantSlots()
351 { 351 {
352 DEFINE_STATIC_LOCAL(WillBePersistentHeapVector<RefPtrWillBeMember<HTMLSlotEl ement>>, emptyList, ()); 352 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<HTMLSlotElement>>, emptyList , ());
353 if (m_descendantSlotsIsValid) { 353 if (m_descendantSlotsIsValid) {
354 ASSERT(m_shadowRootRareData); 354 ASSERT(m_shadowRootRareData);
355 return m_shadowRootRareData->descendantSlots(); 355 return m_shadowRootRareData->descendantSlots();
356 } 356 }
357 if (descendantSlotCount() == 0) 357 if (descendantSlotCount() == 0)
358 return emptyList; 358 return emptyList;
359 359
360 ASSERT(m_shadowRootRareData); 360 ASSERT(m_shadowRootRareData);
361 WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>> slots; 361 HeapVector<Member<HTMLSlotElement>> slots;
362 slots.reserveCapacity(descendantSlotCount()); 362 slots.reserveCapacity(descendantSlotCount());
363 for (HTMLSlotElement& slot : Traversal<HTMLSlotElement>::descendantsOf(rootN ode())) 363 for (HTMLSlotElement& slot : Traversal<HTMLSlotElement>::descendantsOf(rootN ode()))
364 slots.append(&slot); 364 slots.append(&slot);
365 m_shadowRootRareData->setDescendantSlots(slots); 365 m_shadowRootRareData->setDescendantSlots(slots);
366 m_descendantSlotsIsValid = true; 366 m_descendantSlotsIsValid = true;
367 return m_shadowRootRareData->descendantSlots(); 367 return m_shadowRootRareData->descendantSlots();
368 } 368 }
369 369
370 DEFINE_TRACE(ShadowRoot) 370 DEFINE_TRACE(ShadowRoot)
371 { 371 {
372 visitor->trace(m_prev); 372 visitor->trace(m_prev);
373 visitor->trace(m_next); 373 visitor->trace(m_next);
374 visitor->trace(m_shadowRootRareData); 374 visitor->trace(m_shadowRootRareData);
375 TreeScope::trace(visitor); 375 TreeScope::trace(visitor);
376 DocumentFragment::trace(visitor); 376 DocumentFragment::trace(visitor);
377 } 377 }
378 378
379 } // namespace blink 379 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h ('k') | third_party/WebKit/Source/core/dom/shadow/ShadowRootRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698