| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope { | 43 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope { |
| 44 void* pointers[1]; | 44 void* pointers[1]; |
| 45 unsigned countersAndFlags[1]; | 45 unsigned countersAndFlags[1]; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh
ould_stay_small); | 48 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh
ould_stay_small); |
| 49 | 49 |
| 50 ShadowRoot::ShadowRoot(Document& document) | 50 ShadowRoot::ShadowRoot(Document& document) |
| 51 : DocumentFragment(0, CreateShadowRoot) | 51 : DocumentFragment(0, CreateShadowRoot) |
| 52 , TreeScope(*this, document) | 52 , TreeScope(*this, document) |
| 53 , m_numberOfStyles(0) | |
| 54 , m_registeredWithParentShadowRoot(false) | 53 , m_registeredWithParentShadowRoot(false) |
| 55 , m_descendantInsertionPointsIsValid(false) | 54 , m_descendantInsertionPointsIsValid(false) |
| 56 { | 55 { |
| 57 } | 56 } |
| 58 | 57 |
| 59 ShadowRoot::~ShadowRoot() | 58 ShadowRoot::~ShadowRoot() |
| 60 { | 59 { |
| 61 document().styleEngine()->didRemoveShadowRoot(this); | 60 document().styleEngine()->didRemoveShadowRoot(this); |
| 62 | 61 |
| 63 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() | 62 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (!root) | 138 if (!root) |
| 140 root = insertionPoint->containingShadowRoot(); | 139 root = insertionPoint->containingShadowRoot(); |
| 141 if (root) | 140 if (root) |
| 142 root->removeChildShadowRoot(); | 141 root->removeChildShadowRoot(); |
| 143 m_registeredWithParentShadowRoot = false; | 142 m_registeredWithParentShadowRoot = false; |
| 144 } | 143 } |
| 145 | 144 |
| 146 DocumentFragment::removedFrom(insertionPoint); | 145 DocumentFragment::removedFrom(insertionPoint); |
| 147 } | 146 } |
| 148 | 147 |
| 149 void ShadowRoot::registerScopedHTMLStyleChild() | |
| 150 { | |
| 151 ++m_numberOfStyles; | |
| 152 } | |
| 153 | |
| 154 void ShadowRoot::unregisterScopedHTMLStyleChild() | |
| 155 { | |
| 156 ASSERT(m_numberOfStyles > 0); | |
| 157 --m_numberOfStyles; | |
| 158 } | |
| 159 | |
| 160 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData() | 148 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData() |
| 161 { | 149 { |
| 162 if (m_shadowRootRareData) | 150 if (m_shadowRootRareData) |
| 163 return m_shadowRootRareData.get(); | 151 return m_shadowRootRareData.get(); |
| 164 | 152 |
| 165 m_shadowRootRareData = adoptPtr(new ShadowRootRareData); | 153 m_shadowRootRareData = adoptPtr(new ShadowRootRareData); |
| 166 return m_shadowRootRareData.get(); | 154 return m_shadowRootRareData.get(); |
| 167 } | 155 } |
| 168 | 156 |
| 169 bool ShadowRoot::containsContentElements() const | 157 bool ShadowRoot::containsContentElements() const |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 Vector<RefPtr<InsertionPoint> > insertionPoints; | 214 Vector<RefPtr<InsertionPoint> > insertionPoints; |
| 227 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) | 215 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) |
| 228 insertionPoints.append(insertionPoint); | 216 insertionPoints.append(insertionPoint); |
| 229 | 217 |
| 230 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); | 218 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); |
| 231 | 219 |
| 232 return m_shadowRootRareData->descendantInsertionPoints(); | 220 return m_shadowRootRareData->descendantInsertionPoints(); |
| 233 } | 221 } |
| 234 | 222 |
| 235 } | 223 } |
| OLD | NEW |