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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 { | 138 { |
139 // ShadowRoot doesn't support custom callbacks. | 139 // ShadowRoot doesn't support custom callbacks. |
140 ASSERT(!hasCustomStyleCallbacks()); | 140 ASSERT(!hasCustomStyleCallbacks()); |
141 | 141 |
142 // When we're set to lazyAttach we'll have a FullStyleChange and we'll need | 142 // When we're set to lazyAttach we'll have a FullStyleChange and we'll need |
143 // to promote the change to a Force for all our descendants so they get a | 143 // to promote the change to a Force for all our descendants so they get a |
144 // recalc and will attach. | 144 // recalc and will attach. |
145 if (styleChangeType() == FullStyleChange) | 145 if (styleChangeType() == FullStyleChange) |
146 change = Force; | 146 change = Force; |
147 | 147 |
| 148 if (!attached()) { |
| 149 attach(); |
| 150 // attach recalculates the style for all children. No need to do it twic
e. |
| 151 clearNeedsStyleRecalc(); |
| 152 clearChildNeedsStyleRecalc(); |
| 153 return; |
| 154 } |
| 155 |
148 StyleResolver* styleResolver = document()->styleResolver(); | 156 StyleResolver* styleResolver = document()->styleResolver(); |
149 styleResolver->pushParentShadowRoot(this); | 157 styleResolver->pushParentShadowRoot(this); |
150 | 158 |
151 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 159 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
152 if (child->isElementNode()) | 160 if (child->isElementNode()) |
153 toElement(child)->recalcStyle(change); | 161 toElement(child)->recalcStyle(change); |
154 else if (child->isTextNode()) | 162 else if (child->isTextNode()) |
155 toText(child)->recalcTextStyle(change); | 163 toText(child)->recalcTextStyle(change); |
156 } | 164 } |
157 | 165 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 { | 285 { |
278 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 286 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
279 DocumentFragment::reportMemoryUsage(memoryObjectInfo); | 287 DocumentFragment::reportMemoryUsage(memoryObjectInfo); |
280 TreeScope::reportMemoryUsage(memoryObjectInfo); | 288 TreeScope::reportMemoryUsage(memoryObjectInfo); |
281 info.addMember(m_prev, "prev"); | 289 info.addMember(m_prev, "prev"); |
282 info.addMember(m_next, "next"); | 290 info.addMember(m_next, "next"); |
283 info.addMember(m_scopeDistribution, "scopeDistribution"); | 291 info.addMember(m_scopeDistribution, "scopeDistribution"); |
284 } | 292 } |
285 | 293 |
286 } | 294 } |
OLD | NEW |