| 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 DEFINE_STATIC_LOCAL(const Vector<RefPtr<InsertionPoint> >, emptyList, ()); | 311 DEFINE_STATIC_LOCAL(WillBePersistentHeapVector<RefPtrWillBeMember<InsertionP
oint> >, emptyList, ()); |
| 312 | |
| 313 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) | 312 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) |
| 314 return m_shadowRootRareData->descendantInsertionPoints(); | 313 return m_shadowRootRareData->descendantInsertionPoints(); |
| 315 | 314 |
| 316 m_descendantInsertionPointsIsValid = true; | 315 m_descendantInsertionPointsIsValid = true; |
| 317 | 316 |
| 318 if (!containsInsertionPoints()) | 317 if (!containsInsertionPoints()) |
| 319 return emptyList; | 318 return emptyList; |
| 320 | 319 |
| 321 Vector<RefPtr<InsertionPoint> > insertionPoints; | 320 WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> > insertionPoints; |
| 322 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme
nt = ElementTraversal::next(*element, this)) { | 321 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme
nt = ElementTraversal::next(*element, this)) { |
| 323 if (element->isInsertionPoint()) | 322 if (element->isInsertionPoint()) |
| 324 insertionPoints.append(toInsertionPoint(element)); | 323 insertionPoints.append(toInsertionPoint(element)); |
| 325 } | 324 } |
| 326 | 325 |
| 327 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); | 326 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); |
| 328 | 327 |
| 329 return m_shadowRootRareData->descendantInsertionPoints(); | 328 return m_shadowRootRareData->descendantInsertionPoints(); |
| 330 } | 329 } |
| 331 | 330 |
| 332 StyleSheetList* ShadowRoot::styleSheets() | 331 StyleSheetList* ShadowRoot::styleSheets() |
| 333 { | 332 { |
| 334 if (!ensureShadowRootRareData()->styleSheets()) | 333 if (!ensureShadowRootRareData()->styleSheets()) |
| 335 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 334 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
| 336 | 335 |
| 337 return m_shadowRootRareData->styleSheets(); | 336 return m_shadowRootRareData->styleSheets(); |
| 338 } | 337 } |
| 339 | 338 |
| 340 void ShadowRoot::trace(Visitor* visitor) | 339 void ShadowRoot::trace(Visitor* visitor) |
| 341 { | 340 { |
| 342 visitor->trace(m_prev); | 341 visitor->trace(m_prev); |
| 343 visitor->trace(m_next); | 342 visitor->trace(m_next); |
| 344 visitor->trace(m_shadowRootRareData); | 343 visitor->trace(m_shadowRootRareData); |
| 345 TreeScope::trace(visitor); | 344 TreeScope::trace(visitor); |
| 346 DocumentFragment::trace(visitor); | 345 DocumentFragment::trace(visitor); |
| 347 } | 346 } |
| 348 | 347 |
| 349 } | 348 } |
| OLD | NEW |