| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 unsigned countersAndFlags[1]; | 50 unsigned countersAndFlags[1]; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 static_assert(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), | 53 static_assert(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), |
| 54 "ShadowRoot should stay small"); | 54 "ShadowRoot should stay small"); |
| 55 | 55 |
| 56 ShadowRoot::ShadowRoot(Document& document, ShadowRootType type) | 56 ShadowRoot::ShadowRoot(Document& document, ShadowRootType type) |
| 57 : DocumentFragment(0, CreateShadowRoot), | 57 : DocumentFragment(0, CreateShadowRoot), |
| 58 TreeScope(*this, document), | 58 TreeScope(*this, document), |
| 59 m_styleSheetList(nullptr), | 59 m_styleSheetList(nullptr), |
| 60 m_numberOfStyles(0), | |
| 61 m_childShadowRootCount(0), | 60 m_childShadowRootCount(0), |
| 62 m_type(static_cast<unsigned>(type)), | 61 m_type(static_cast<unsigned>(type)), |
| 63 m_registeredWithParentShadowRoot(false), | 62 m_registeredWithParentShadowRoot(false), |
| 64 m_descendantInsertionPointsIsValid(false), | 63 m_descendantInsertionPointsIsValid(false), |
| 65 m_delegatesFocus(false) {} | 64 m_delegatesFocus(false) {} |
| 66 | 65 |
| 67 ShadowRoot::~ShadowRoot() {} | 66 ShadowRoot::~ShadowRoot() {} |
| 68 | 67 |
| 69 ShadowRoot* ShadowRoot::youngerShadowRoot() const { | 68 ShadowRoot* ShadowRoot::youngerShadowRoot() const { |
| 70 if (type() == ShadowRootType::V0 && m_shadowRootRareDataV0) | 69 if (type() == ShadowRootType::V0 && m_shadowRootRareDataV0) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 : SiblingElementInserted, | 197 : SiblingElementInserted, |
| 199 toElement(change.siblingChanged), change.siblingBeforeChange, | 198 toElement(change.siblingChanged), change.siblingBeforeChange, |
| 200 change.siblingAfterChange); | 199 change.siblingAfterChange); |
| 201 | 200 |
| 202 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) { | 201 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) { |
| 203 if (ShadowRoot* root = point->containingShadowRoot()) | 202 if (ShadowRoot* root = point->containingShadowRoot()) |
| 204 root->owner()->setNeedsDistributionRecalc(); | 203 root->owner()->setNeedsDistributionRecalc(); |
| 205 } | 204 } |
| 206 } | 205 } |
| 207 | 206 |
| 208 void ShadowRoot::registerScopedHTMLStyleChild() { | |
| 209 ++m_numberOfStyles; | |
| 210 } | |
| 211 | |
| 212 void ShadowRoot::unregisterScopedHTMLStyleChild() { | |
| 213 DCHECK_GT(m_numberOfStyles, 0u); | |
| 214 --m_numberOfStyles; | |
| 215 } | |
| 216 | |
| 217 ShadowRootRareDataV0& ShadowRoot::ensureShadowRootRareDataV0() { | 207 ShadowRootRareDataV0& ShadowRoot::ensureShadowRootRareDataV0() { |
| 218 if (m_shadowRootRareDataV0) | 208 if (m_shadowRootRareDataV0) |
| 219 return *m_shadowRootRareDataV0; | 209 return *m_shadowRootRareDataV0; |
| 220 | 210 |
| 221 m_shadowRootRareDataV0 = new ShadowRootRareDataV0; | 211 m_shadowRootRareDataV0 = new ShadowRootRareDataV0; |
| 222 return *m_shadowRootRareDataV0; | 212 return *m_shadowRootRareDataV0; |
| 223 } | 213 } |
| 224 | 214 |
| 225 bool ShadowRoot::containsShadowElements() const { | 215 bool ShadowRoot::containsShadowElements() const { |
| 226 return m_shadowRootRareDataV0 | 216 return m_shadowRootRareDataV0 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 ostream << "ShadowRootType::Open"; | 316 ostream << "ShadowRootType::Open"; |
| 327 break; | 317 break; |
| 328 case ShadowRootType::Closed: | 318 case ShadowRootType::Closed: |
| 329 ostream << "ShadowRootType::Closed"; | 319 ostream << "ShadowRootType::Closed"; |
| 330 break; | 320 break; |
| 331 } | 321 } |
| 332 return ostream; | 322 return ostream; |
| 333 } | 323 } |
| 334 | 324 |
| 335 } // namespace blink | 325 } // namespace blink |
| OLD | NEW |