Chromium Code Reviews| Index: Source/core/dom/Node.cpp |
| diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
| index 3223aa73bd00b2596a25fb0b9d7f1404b47f02f1..99cef4b842492847e0417f9644702ca8855baffd 100644 |
| --- a/Source/core/dom/Node.cpp |
| +++ b/Source/core/dom/Node.cpp |
| @@ -865,15 +865,17 @@ void Node::setNeedsStyleRecalc(StyleChangeType changeType) |
| markAncestorsWithChildNeedsStyleRecalc(); |
| } |
| -void Node::lazyAttach(ShouldSetAttached shouldSetAttached) |
| -{ |
| - for (Node* n = this; n; n = NodeTraversal::next(n, this)) { |
| - if (n->hasChildNodes()) |
| - n->setChildNeedsStyleRecalc(); |
| - n->setStyleChange(FullStyleChange); |
| - if (shouldSetAttached == SetAttached) |
| - n->setAttached(); |
| +void Node::lazyAttach() |
| +{ |
| + // It's safe to synchronously attach here because we're in the middle of style recalc |
| + // while it's not safe to mark nodes as needing style recalc except in the loop in |
| + // Element::recalcStyle because we may mark an ancestor as not needing recalc and |
| + // then the node would never get updated. |
| + if (document()->inStyleRecalc()) { |
|
ojan
2013/05/18 00:28:36
When do we call lazyAttach while in styleRecalc?
|
| + attach(); |
| + return; |
| } |
| + setStyleChange(FullStyleChange); |
| markAncestorsWithChildNeedsStyleRecalc(); |
| } |