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

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

Issue 2488633002: Remove ShadowRoot::numberOfStyles(). (Closed)
Patch Set: Created 4 years, 1 month 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Member<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), 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_numberOfStyles(0),
60 m_childShadowRootCount(0), 59 m_childShadowRootCount(0),
61 m_type(static_cast<unsigned>(type)), 60 m_type(static_cast<unsigned>(type)),
62 m_registeredWithParentShadowRoot(false), 61 m_registeredWithParentShadowRoot(false),
63 m_descendantInsertionPointsIsValid(false), 62 m_descendantInsertionPointsIsValid(false),
64 m_delegatesFocus(false) {} 63 m_delegatesFocus(false) {}
65 64
66 ShadowRoot::~ShadowRoot() {} 65 ShadowRoot::~ShadowRoot() {}
67 66
68 ShadowRoot* ShadowRoot::youngerShadowRoot() const { 67 ShadowRoot* ShadowRoot::youngerShadowRoot() const {
69 if (type() == ShadowRootType::V0 && m_shadowRootRareDataV0) 68 if (type() == ShadowRootType::V0 && m_shadowRootRareDataV0)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 : SiblingElementInserted, 194 : SiblingElementInserted,
196 toElement(change.siblingChanged), change.siblingBeforeChange, 195 toElement(change.siblingChanged), change.siblingBeforeChange,
197 change.siblingAfterChange); 196 change.siblingAfterChange);
198 197
199 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) { 198 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) {
200 if (ShadowRoot* root = point->containingShadowRoot()) 199 if (ShadowRoot* root = point->containingShadowRoot())
201 root->owner()->setNeedsDistributionRecalc(); 200 root->owner()->setNeedsDistributionRecalc();
202 } 201 }
203 } 202 }
204 203
205 void ShadowRoot::registerScopedHTMLStyleChild() {
206 ++m_numberOfStyles;
207 }
208
209 void ShadowRoot::unregisterScopedHTMLStyleChild() {
210 DCHECK_GT(m_numberOfStyles, 0u);
211 --m_numberOfStyles;
212 }
213
214 ShadowRootRareDataV0& ShadowRoot::ensureShadowRootRareDataV0() { 204 ShadowRootRareDataV0& ShadowRoot::ensureShadowRootRareDataV0() {
215 if (m_shadowRootRareDataV0) 205 if (m_shadowRootRareDataV0)
216 return *m_shadowRootRareDataV0; 206 return *m_shadowRootRareDataV0;
217 207
218 m_shadowRootRareDataV0 = new ShadowRootRareDataV0; 208 m_shadowRootRareDataV0 = new ShadowRootRareDataV0;
219 return *m_shadowRootRareDataV0; 209 return *m_shadowRootRareDataV0;
220 } 210 }
221 211
222 bool ShadowRoot::containsShadowElements() const { 212 bool ShadowRoot::containsShadowElements() const {
223 return m_shadowRootRareDataV0 213 return m_shadowRootRareDataV0
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ostream << "ShadowRootType::Open"; 313 ostream << "ShadowRootType::Open";
324 break; 314 break;
325 case ShadowRootType::Closed: 315 case ShadowRootType::Closed:
326 ostream << "ShadowRootType::Closed"; 316 ostream << "ShadowRootType::Closed";
327 break; 317 break;
328 } 318 }
329 return ostream; 319 return ostream;
330 } 320 }
331 321
332 } // namespace blink 322 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h ('k') | third_party/WebKit/Source/core/html/HTMLStyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698