Chromium Code Reviews| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 } | 176 } |
| 177 | 177 |
| 178 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne ed | 178 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne ed |
| 179 // to promote the change to a Force for all our descendants so they get a | 179 // to promote the change to a Force for all our descendants so they get a |
| 180 // recalc and will attach. | 180 // recalc and will attach. |
| 181 if (styleChangeType() >= SubtreeStyleChange) | 181 if (styleChangeType() >= SubtreeStyleChange) |
| 182 change = Force; | 182 change = Force; |
| 183 | 183 |
| 184 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl e does. | 184 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl e does. |
| 185 bool forceReattachOfAnyWhitespaceSibling = false; | 185 bool forceReattachOfAnyWhitespaceSibling = false; |
| 186 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 186 for (Node* child = lastChild(); child; child = child->previousSibling()) { |
| 187 bool didReattach = false; | 187 bool didReattach = false; |
| 188 | 188 |
| 189 if (child->renderer()) | 189 if (child->isTextNode()) |
| 190 forceReattachOfAnyWhitespaceSibling = false; | 190 didReattach = toText(child)->recalcTextStyle(change); |
| 191 else if (child->isElementNode() && shouldRecalcStyle(change, child)) | |
| 192 didReattach = toElement(child)->recalcStyle(change); | |
| 191 | 193 |
| 192 if (child->isTextNode()) { | 194 if (didReattach) |
| 193 if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOn lyWhitespace()) | 195 child->reattachWhitespaceSiblings(); |
|
esprehn
2013/09/30 22:52:03
You're missing the nasty whitespace stuff in here.
| |
| 194 child->reattach(); | |
| 195 else | |
| 196 didReattach = toText(child)->recalcTextStyle(change); | |
| 197 } else if (child->isElementNode() && shouldRecalcStyle(change, child)) { | |
| 198 didReattach = toElement(child)->recalcStyle(change); | |
| 199 } | |
| 200 | |
| 201 forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyW hitespaceSibling; | |
| 202 } | 196 } |
| 203 | 197 |
| 204 styleResolver->popParentShadowRoot(*this); | 198 styleResolver->popParentShadowRoot(*this); |
| 205 clearNeedsStyleRecalc(); | 199 clearNeedsStyleRecalc(); |
| 206 clearChildNeedsStyleRecalc(); | 200 clearChildNeedsStyleRecalc(); |
| 207 } | 201 } |
| 208 | 202 |
| 209 bool ShadowRoot::isActive() const | 203 bool ShadowRoot::isActive() const |
| 210 { | 204 { |
| 211 for (ShadowRoot* shadowRoot = youngerShadowRoot(); shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot()) | 205 for (ShadowRoot* shadowRoot = youngerShadowRoot(); shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot()) |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 | 411 |
| 418 StyleSheetList* ShadowRoot::styleSheets() | 412 StyleSheetList* ShadowRoot::styleSheets() |
| 419 { | 413 { |
| 420 if (!ensureShadowRootRareData()->styleSheets()) | 414 if (!ensureShadowRootRareData()->styleSheets()) |
| 421 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 415 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
| 422 | 416 |
| 423 return m_shadowRootRareData->styleSheets(); | 417 return m_shadowRootRareData->styleSheets(); |
| 424 } | 418 } |
| 425 | 419 |
| 426 } | 420 } |
| OLD | NEW |