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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Created 4 years, 1 month 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
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 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 if (thisIterator == otherIterator) 885 if (thisIterator == otherIterator)
886 return const_cast<Node*>(thisIterator); 886 return const_cast<Node*>(thisIterator);
887 thisIterator = parent(*thisIterator); 887 thisIterator = parent(*thisIterator);
888 otherIterator = parent(*otherIterator); 888 otherIterator = parent(*otherIterator);
889 } 889 }
890 DCHECK(!otherIterator); 890 DCHECK(!otherIterator);
891 return nullptr; 891 return nullptr;
892 } 892 }
893 893
894 void Node::reattachLayoutTree(const AttachContext& context) { 894 void Node::reattachLayoutTree(const AttachContext& context) {
895 DCHECK(!needsStyleRecalc());
896 DCHECK(!childNeedsStyleRecalc());
895 AttachContext reattachContext(context); 897 AttachContext reattachContext(context);
896 reattachContext.performingReattach = true; 898 reattachContext.performingReattach = true;
897 899
898 // We only need to detach if the node has already been through 900 // We only need to detach if the node has already been through
899 // attachLayoutTree(). 901 // attachLayoutTree().
900 if (getStyleChangeType() < NeedsReattachStyleChange) 902 if (getStyleChangeType() < NeedsReattachStyleChange)
901 detachLayoutTree(reattachContext); 903 detachLayoutTree(reattachContext);
902 attachLayoutTree(reattachContext); 904 attachLayoutTree(reattachContext);
903 } 905 }
904 906
905 void Node::attachLayoutTree(const AttachContext&) { 907 void Node::attachLayoutTree(const AttachContext&) {
906 DCHECK(document().inStyleRecalc() || isDocumentNode()); 908 DCHECK(document().inStyleRecalc() || isDocumentNode());
907 DCHECK(!document().lifecycle().inDetach()); 909 DCHECK(!document().lifecycle().inDetach());
908 DCHECK(needsAttach()); 910 DCHECK(needsAttach());
909 DCHECK(!layoutObject() || 911 DCHECK(!layoutObject() ||
910 (layoutObject()->style() && 912 (layoutObject()->style() &&
911 (layoutObject()->parent() || layoutObject()->isLayoutView()))); 913 (layoutObject()->parent() || layoutObject()->isLayoutView())));
912 914
915 // Only doing this to cater to the comment in
916 // Document::updateStyleAndLayoutTree() right above the call to
917 // Document::updateStyle().
913 clearNeedsStyleRecalc(); 918 clearNeedsStyleRecalc();
914 clearNeedsReattachLayoutTree(); 919 clearNeedsReattachLayoutTree();
915 920
916 if (AXObjectCache* cache = document().axObjectCache()) 921 if (AXObjectCache* cache = document().axObjectCache())
917 cache->updateCacheAfterNodeIsAttached(this); 922 cache->updateCacheAfterNodeIsAttached(this);
918 } 923 }
919 924
920 void Node::detachLayoutTree(const AttachContext& context) { 925 void Node::detachLayoutTree(const AttachContext& context) {
921 DCHECK(document().lifecycle().stateAllowsDetach()); 926 DCHECK(document().lifecycle().stateAllowsDetach());
922 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); 927 DocumentLifecycle::DetachScope willDetach(document().lifecycle());
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 if (node) { 2492 if (node) {
2488 std::stringstream stream; 2493 std::stringstream stream;
2489 node->printNodePathTo(stream); 2494 node->printNodePathTo(stream);
2490 LOG(INFO) << stream.str(); 2495 LOG(INFO) << stream.str();
2491 } else { 2496 } else {
2492 LOG(INFO) << "Cannot showNodePath for <null>"; 2497 LOG(INFO) << "Cannot showNodePath for <null>";
2493 } 2498 }
2494 } 2499 }
2495 2500
2496 #endif 2501 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698