Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: Source/core/dom/Node.cpp

Issue 15159008: Node::lazyAttach shouldn't lie about being attached (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove commented out line in test Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 return; 858 return;
859 859
860 StyleChangeType existingChangeType = styleChangeType(); 860 StyleChangeType existingChangeType = styleChangeType();
861 if (changeType > existingChangeType) 861 if (changeType > existingChangeType)
862 setStyleChange(changeType); 862 setStyleChange(changeType);
863 863
864 if (existingChangeType == NoStyleChange) 864 if (existingChangeType == NoStyleChange)
865 markAncestorsWithChildNeedsStyleRecalc(); 865 markAncestorsWithChildNeedsStyleRecalc();
866 } 866 }
867 867
868 void Node::lazyAttach(ShouldSetAttached shouldSetAttached) 868 void Node::lazyAttach()
869 { 869 {
870 for (Node* n = this; n; n = NodeTraversal::next(n, this)) { 870 // It's safe to synchronously attach here because we're in the middle of sty le recalc
871 if (n->hasChildNodes()) 871 // while it's not safe to mark nodes as needing style recalc except in the l oop in
872 n->setChildNeedsStyleRecalc(); 872 // Element::recalcStyle because we may mark an ancestor as not needing recal c and
873 n->setStyleChange(FullStyleChange); 873 // then the node would never get updated.
874 if (shouldSetAttached == SetAttached) 874 if (document()->inStyleRecalc()) {
ojan 2013/05/18 00:28:36 When do we call lazyAttach while in styleRecalc?
875 n->setAttached(); 875 attach();
876 return;
876 } 877 }
878 setStyleChange(FullStyleChange);
877 markAncestorsWithChildNeedsStyleRecalc(); 879 markAncestorsWithChildNeedsStyleRecalc();
878 } 880 }
879 881
880 bool Node::supportsFocus() const 882 bool Node::supportsFocus() const
881 { 883 {
882 return false; 884 return false;
883 } 885 }
884 886
885 bool Node::isFocusable() const 887 bool Node::isFocusable() const
886 { 888 {
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 node->showTreeForThis(); 2775 node->showTreeForThis();
2774 } 2776 }
2775 2777
2776 void showNodePath(const WebCore::Node* node) 2778 void showNodePath(const WebCore::Node* node)
2777 { 2779 {
2778 if (node) 2780 if (node)
2779 node->showNodePathForThis(); 2781 node->showNodePathForThis();
2780 } 2782 }
2781 2783
2782 #endif 2784 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698