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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 return; | 158 return; |
159 } | 159 } |
160 | 160 |
161 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne
ed | 161 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne
ed |
162 // to promote the change to a Force for all our descendants so they get a | 162 // to promote the change to a Force for all our descendants so they get a |
163 // recalc and will attach. | 163 // recalc and will attach. |
164 if (styleChangeType() == SubtreeStyleChange) | 164 if (styleChangeType() == SubtreeStyleChange) |
165 change = Force; | 165 change = Force; |
166 | 166 |
167 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl
e does. | 167 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl
e does. |
168 bool forceReattachOfAnyWhitespaceSibling = false; | 168 for (Node* child = lastChild(); child; child = child->previousSibling()) { |
169 for (Node* child = firstChild(); child; child = child->nextSibling()) { | |
170 bool didReattach = false; | 169 bool didReattach = false; |
171 | 170 |
172 if (child->renderer()) | 171 if (child->isTextNode()) |
173 forceReattachOfAnyWhitespaceSibling = false; | 172 didReattach = toText(child)->recalcTextStyle(change); |
| 173 else if (child->isElementNode() && shouldRecalcStyle(change, child)) |
| 174 didReattach = toElement(child)->recalcStyle(change); |
174 | 175 |
175 if (child->isTextNode()) { | 176 if (didReattach) |
176 if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOn
lyWhitespace()) | 177 child->reattachWhitespaceSiblings(); |
177 child->reattach(); | |
178 else | |
179 didReattach = toText(child)->recalcTextStyle(change); | |
180 } else if (child->isElementNode() && shouldRecalcStyle(change, child)) { | |
181 didReattach = toElement(child)->recalcStyle(change); | |
182 } | |
183 | |
184 forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyW
hitespaceSibling; | |
185 } | 178 } |
186 | 179 |
187 styleResolver->popParentShadowRoot(this); | 180 styleResolver->popParentShadowRoot(this); |
188 clearNeedsStyleRecalc(); | 181 clearNeedsStyleRecalc(); |
189 clearChildNeedsStyleRecalc(); | 182 clearChildNeedsStyleRecalc(); |
190 } | 183 } |
191 | 184 |
192 bool ShadowRoot::isActive() const | 185 bool ShadowRoot::isActive() const |
193 { | 186 { |
194 for (ShadowRoot* shadowRoot = youngerShadowRoot(); shadowRoot; shadowRoot =
shadowRoot->youngerShadowRoot()) | 187 for (ShadowRoot* shadowRoot = youngerShadowRoot(); shadowRoot; shadowRoot =
shadowRoot->youngerShadowRoot()) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 { | 299 { |
307 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 300 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
308 DocumentFragment::reportMemoryUsage(memoryObjectInfo); | 301 DocumentFragment::reportMemoryUsage(memoryObjectInfo); |
309 TreeScope::reportMemoryUsage(memoryObjectInfo); | 302 TreeScope::reportMemoryUsage(memoryObjectInfo); |
310 info.addMember(m_prev, "prev"); | 303 info.addMember(m_prev, "prev"); |
311 info.addMember(m_next, "next"); | 304 info.addMember(m_next, "next"); |
312 info.addMember(m_scopeDistribution, "scopeDistribution"); | 305 info.addMember(m_scopeDistribution, "scopeDistribution"); |
313 } | 306 } |
314 | 307 |
315 } | 308 } |
OLD | NEW |