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

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

Issue 2398293003: Move Layout Tree Construction code into Element::rebuildLayoutTree() (Closed)
Patch Set: Run git cl format third_party/WebKit Created 4 years, 2 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
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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 689 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
690 } 690 }
691 691
692 void Node::markAncestorsWithChildNeedsStyleRecalc() { 692 void Node::markAncestorsWithChildNeedsStyleRecalc() {
693 for (ContainerNode* p = parentOrShadowHostNode(); 693 for (ContainerNode* p = parentOrShadowHostNode();
694 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode()) 694 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode())
695 p->setChildNeedsStyleRecalc(); 695 p->setChildNeedsStyleRecalc();
696 document().scheduleLayoutTreeUpdateIfNeeded(); 696 document().scheduleLayoutTreeUpdateIfNeeded();
697 } 697 }
698 698
699 void Node::markAncestorsWithChildNeedsReattachLayoutTree() {
700 for (ContainerNode* p = parentOrShadowHostNode();
701 p && !p->childNeedsReattachLayoutTree(); p = p->parentOrShadowHostNode())
702 p->setChildNeedsReattachLayoutTree();
703 }
704
705 void Node::setNeedsReattachLayoutTree() {
706 setFlag(NeedsReattachLayoutTree);
707 markAncestorsWithChildNeedsReattachLayoutTree();
708 }
709
699 void Node::setNeedsStyleRecalc(StyleChangeType changeType, 710 void Node::setNeedsStyleRecalc(StyleChangeType changeType,
700 const StyleChangeReasonForTracing& reason) { 711 const StyleChangeReasonForTracing& reason) {
701 DCHECK(changeType != NoStyleChange); 712 DCHECK(changeType != NoStyleChange);
702 if (!inActiveDocument()) 713 if (!inActiveDocument())
703 return; 714 return;
704 715
705 TRACE_EVENT_INSTANT1( 716 TRACE_EVENT_INSTANT1(
706 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), 717 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"),
707 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data", 718 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data",
708 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason)); 719 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 891
881 void Node::attachLayoutTree(const AttachContext&) { 892 void Node::attachLayoutTree(const AttachContext&) {
882 DCHECK(document().inStyleRecalc() || isDocumentNode()); 893 DCHECK(document().inStyleRecalc() || isDocumentNode());
883 DCHECK(!document().lifecycle().inDetach()); 894 DCHECK(!document().lifecycle().inDetach());
884 DCHECK(needsAttach()); 895 DCHECK(needsAttach());
885 DCHECK(!layoutObject() || 896 DCHECK(!layoutObject() ||
886 (layoutObject()->style() && 897 (layoutObject()->style() &&
887 (layoutObject()->parent() || layoutObject()->isLayoutView()))); 898 (layoutObject()->parent() || layoutObject()->isLayoutView())));
888 899
889 clearNeedsStyleRecalc(); 900 clearNeedsStyleRecalc();
901 clearNeedsReattachLayoutTree();
890 902
891 if (AXObjectCache* cache = document().axObjectCache()) 903 if (AXObjectCache* cache = document().axObjectCache())
892 cache->updateCacheAfterNodeIsAttached(this); 904 cache->updateCacheAfterNodeIsAttached(this);
893 } 905 }
894 906
895 void Node::detachLayoutTree(const AttachContext& context) { 907 void Node::detachLayoutTree(const AttachContext& context) {
896 DCHECK(document().lifecycle().stateAllowsDetach()); 908 DCHECK(document().lifecycle().stateAllowsDetach());
897 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); 909 DocumentLifecycle::DetachScope willDetach(document().lifecycle());
898 910
899 if (layoutObject()) 911 if (layoutObject())
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 if (node) { 2477 if (node) {
2466 std::stringstream stream; 2478 std::stringstream stream;
2467 node->printNodePathTo(stream); 2479 node->printNodePathTo(stream);
2468 LOG(INFO) << stream.str(); 2480 LOG(INFO) << stream.str();
2469 } else { 2481 } else {
2470 LOG(INFO) << "Cannot showNodePath for <null>"; 2482 LOG(INFO) << "Cannot showNodePath for <null>";
2471 } 2483 }
2472 } 2484 }
2473 2485
2474 #endif 2486 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698