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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return true; | 131 return true; |
132 default: | 132 default: |
133 return false; | 133 return false; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 void ShadowRoot::recalcStyle(StyleChange change) | 137 void ShadowRoot::recalcStyle(StyleChange change) |
138 { | 138 { |
139 // ShadowRoot doesn't support custom callbacks. | 139 // ShadowRoot doesn't support custom callbacks. |
140 ASSERT(!hasCustomStyleCallbacks()); | 140 ASSERT(!hasCustomStyleCallbacks()); |
| 141 if (!attached()) { |
| 142 attach(); |
| 143 // attach recalculates the style for all children. No need to do it twic
e. |
| 144 clearNeedsStyleRecalc(); |
| 145 clearChildNeedsStyleRecalc(); |
| 146 return; |
| 147 } |
141 | 148 |
142 StyleResolver* styleResolver = document()->styleResolver(); | 149 StyleResolver* styleResolver = document()->styleResolver(); |
143 styleResolver->pushParentShadowRoot(this); | 150 styleResolver->pushParentShadowRoot(this); |
144 | 151 |
145 // When we're set to lazyAttach we'll have a FullStyleChange and we'll need | 152 // When we're set to lazyAttach we'll have a FullStyleChange and we'll need |
146 // to promote the change to a Force for all our descendants so they get a | 153 // to promote the change to a Force for all our descendants so they get a |
147 // recalc and will attach. | 154 // recalc and will attach. |
148 if (styleChangeType() == FullStyleChange) | 155 if (styleChangeType() == FullStyleChange) |
149 change = Force; | 156 change = Force; |
150 | 157 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 { | 284 { |
278 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 285 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
279 DocumentFragment::reportMemoryUsage(memoryObjectInfo); | 286 DocumentFragment::reportMemoryUsage(memoryObjectInfo); |
280 TreeScope::reportMemoryUsage(memoryObjectInfo); | 287 TreeScope::reportMemoryUsage(memoryObjectInfo); |
281 info.addMember(m_prev, "prev"); | 288 info.addMember(m_prev, "prev"); |
282 info.addMember(m_next, "next"); | 289 info.addMember(m_next, "next"); |
283 info.addMember(m_scopeDistribution, "scopeDistribution"); | 290 info.addMember(m_scopeDistribution, "scopeDistribution"); |
284 } | 291 } |
285 | 292 |
286 } | 293 } |
OLD | NEW |