Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 unsigned ShadowRoot::descendantShadowElementCount() const | 256 unsigned ShadowRoot::descendantShadowElementCount() const |
| 257 { | 257 { |
| 258 return m_shadowRootRareData ? m_shadowRootRareData->descendantShadowElementC ount() : 0; | 258 return m_shadowRootRareData ? m_shadowRootRareData->descendantShadowElementC ount() : 0; |
| 259 } | 259 } |
| 260 | 260 |
| 261 HTMLShadowElement* ShadowRoot::shadowInsertionPointOfYoungerShadowRoot() const | 261 HTMLShadowElement* ShadowRoot::shadowInsertionPointOfYoungerShadowRoot() const |
| 262 { | 262 { |
| 263 return m_shadowRootRareData ? m_shadowRootRareData->shadowInsertionPointOfYo ungerShadowRoot() : 0; | 263 return m_shadowRootRareData ? m_shadowRootRareData->shadowInsertionPointOfYo ungerShadowRoot() : 0; |
| 264 } | 264 } |
| 265 | 265 |
| 266 void ShadowRoot::setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShado wElement> shadowInsertionPoint) | 266 void ShadowRoot::setShadowInsertionPointOfYoungerShadowRoot(PassRefPtrWillBeRawP tr<HTMLShadowElement> shadowInsertionPoint) |
| 267 { | 267 { |
| 268 if (!m_shadowRootRareData && !shadowInsertionPoint) | 268 if (!m_shadowRootRareData && !shadowInsertionPoint) |
| 269 return; | 269 return; |
| 270 ensureShadowRootRareData()->setShadowInsertionPointOfYoungerShadowRoot(shado wInsertionPoint); | 270 ensureShadowRootRareData()->setShadowInsertionPointOfYoungerShadowRoot(shado wInsertionPoint); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void ShadowRoot::didAddInsertionPoint(InsertionPoint* insertionPoint) | 273 void ShadowRoot::didAddInsertionPoint(InsertionPoint* insertionPoint) |
| 274 { | 274 { |
| 275 ensureShadowRootRareData()->didAddInsertionPoint(insertionPoint); | 275 ensureShadowRootRareData()->didAddInsertionPoint(insertionPoint); |
| 276 invalidateDescendantInsertionPoints(); | 276 invalidateDescendantInsertionPoints(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 299 { | 299 { |
| 300 return m_shadowRootRareData ? m_shadowRootRareData->childShadowRootCount() : 0; | 300 return m_shadowRootRareData ? m_shadowRootRareData->childShadowRootCount() : 0; |
| 301 } | 301 } |
| 302 | 302 |
| 303 void ShadowRoot::invalidateDescendantInsertionPoints() | 303 void ShadowRoot::invalidateDescendantInsertionPoints() |
| 304 { | 304 { |
| 305 m_descendantInsertionPointsIsValid = false; | 305 m_descendantInsertionPointsIsValid = false; |
| 306 m_shadowRootRareData->clearDescendantInsertionPoints(); | 306 m_shadowRootRareData->clearDescendantInsertionPoints(); |
| 307 } | 307 } |
| 308 | 308 |
| 309 const Vector<RefPtr<InsertionPoint> >& ShadowRoot::descendantInsertionPoints() | 309 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> >& ShadowRoot::descend antInsertionPoints() |
| 310 { | 310 { |
| 311 #if ENABLE(OILPAN) | |
| 312 DEFINE_STATIC_LOCAL(Persistent<const WillBeHeapVector<RefPtrWillBeMember<Ins ertionPoint> > >, emptyList, (new WillBeHeapVector<RefPtrWillBeMember<InsertionP oint> >())); | |
| 313 #else | |
| 311 DEFINE_STATIC_LOCAL(const Vector<RefPtr<InsertionPoint> >, emptyList, ()); | 314 DEFINE_STATIC_LOCAL(const Vector<RefPtr<InsertionPoint> >, emptyList, ()); |
|
haraken
2014/05/12 12:21:38
I'd prefer:
DEFINE_STATIC_LOCAL(WillBePersistentH
sof
2014/05/12 12:37:49
Oh, nice - that will work here. Switched.
| |
| 315 #endif | |
| 312 | 316 |
| 313 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) | 317 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) |
| 314 return m_shadowRootRareData->descendantInsertionPoints(); | 318 return m_shadowRootRareData->descendantInsertionPoints(); |
| 315 | 319 |
| 316 m_descendantInsertionPointsIsValid = true; | 320 m_descendantInsertionPointsIsValid = true; |
| 317 | 321 |
| 318 if (!containsInsertionPoints()) | 322 if (!containsInsertionPoints()) { |
| 323 #if ENABLE(OILPAN) | |
| 324 return *emptyList; | |
| 325 #else | |
| 319 return emptyList; | 326 return emptyList; |
| 327 #endif | |
| 328 } | |
| 320 | 329 |
| 321 Vector<RefPtr<InsertionPoint> > insertionPoints; | 330 WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> > insertionPoints; |
| 322 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme nt = ElementTraversal::next(*element, this)) { | 331 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme nt = ElementTraversal::next(*element, this)) { |
| 323 if (element->isInsertionPoint()) | 332 if (element->isInsertionPoint()) |
| 324 insertionPoints.append(toInsertionPoint(element)); | 333 insertionPoints.append(toInsertionPoint(element)); |
| 325 } | 334 } |
| 326 | 335 |
| 327 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); | 336 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); |
| 328 | 337 |
| 329 return m_shadowRootRareData->descendantInsertionPoints(); | 338 return m_shadowRootRareData->descendantInsertionPoints(); |
| 330 } | 339 } |
| 331 | 340 |
| 332 StyleSheetList* ShadowRoot::styleSheets() | 341 StyleSheetList* ShadowRoot::styleSheets() |
| 333 { | 342 { |
| 334 if (!ensureShadowRootRareData()->styleSheets()) | 343 if (!ensureShadowRootRareData()->styleSheets()) |
| 335 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 344 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
| 336 | 345 |
| 337 return m_shadowRootRareData->styleSheets(); | 346 return m_shadowRootRareData->styleSheets(); |
| 338 } | 347 } |
| 339 | 348 |
| 340 void ShadowRoot::trace(Visitor* visitor) | 349 void ShadowRoot::trace(Visitor* visitor) |
| 341 { | 350 { |
| 342 visitor->trace(m_prev); | 351 visitor->trace(m_prev); |
| 343 visitor->trace(m_next); | 352 visitor->trace(m_next); |
| 344 visitor->trace(m_shadowRootRareData); | 353 visitor->trace(m_shadowRootRareData); |
| 345 TreeScope::trace(visitor); | 354 TreeScope::trace(visitor); |
| 346 DocumentFragment::trace(visitor); | 355 DocumentFragment::trace(visitor); |
| 347 } | 356 } |
| 348 | 357 |
| 349 } | 358 } |
| OLD | NEW |