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

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: Clear nextTextSibling pointer where there is a LayoutObject between the element and text node 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 690 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
691 } 691 }
692 692
693 void Node::markAncestorsWithChildNeedsStyleRecalc() { 693 void Node::markAncestorsWithChildNeedsStyleRecalc() {
694 for (ContainerNode* p = parentOrShadowHostNode(); 694 for (ContainerNode* p = parentOrShadowHostNode();
695 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode()) 695 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode())
696 p->setChildNeedsStyleRecalc(); 696 p->setChildNeedsStyleRecalc();
697 document().scheduleLayoutTreeUpdateIfNeeded(); 697 document().scheduleLayoutTreeUpdateIfNeeded();
698 } 698 }
699 699
700 void Node::markAncestorsWithChildNeedsReattachLayoutTree() {
701 for (ContainerNode* p = parentOrShadowHostNode();
702 p && !p->childNeedsReattachLayoutTree(); p = p->parentOrShadowHostNode())
703 p->setChildNeedsReattachLayoutTree();
704 }
705
706 void Node::setNeedsReattachLayoutTree() {
707 setFlag(NeedsReattachLayoutTree);
708 markAncestorsWithChildNeedsReattachLayoutTree();
709 }
710
700 void Node::setNeedsStyleRecalc(StyleChangeType changeType, 711 void Node::setNeedsStyleRecalc(StyleChangeType changeType,
701 const StyleChangeReasonForTracing& reason) { 712 const StyleChangeReasonForTracing& reason) {
702 DCHECK(changeType != NoStyleChange); 713 DCHECK(changeType != NoStyleChange);
703 if (!inActiveDocument()) 714 if (!inActiveDocument())
704 return; 715 return;
705 716
706 TRACE_EVENT_INSTANT1( 717 TRACE_EVENT_INSTANT1(
707 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), 718 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"),
708 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data", 719 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data",
709 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason)); 720 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 892
882 void Node::attachLayoutTree(const AttachContext&) { 893 void Node::attachLayoutTree(const AttachContext&) {
883 DCHECK(document().inStyleRecalc() || isDocumentNode()); 894 DCHECK(document().inStyleRecalc() || isDocumentNode());
884 DCHECK(!document().lifecycle().inDetach()); 895 DCHECK(!document().lifecycle().inDetach());
885 DCHECK(needsAttach()); 896 DCHECK(needsAttach());
886 DCHECK(!layoutObject() || 897 DCHECK(!layoutObject() ||
887 (layoutObject()->style() && 898 (layoutObject()->style() &&
888 (layoutObject()->parent() || layoutObject()->isLayoutView()))); 899 (layoutObject()->parent() || layoutObject()->isLayoutView())));
889 900
890 clearNeedsStyleRecalc(); 901 clearNeedsStyleRecalc();
902 clearNeedsReattachLayoutTree();
891 903
892 if (AXObjectCache* cache = document().axObjectCache()) 904 if (AXObjectCache* cache = document().axObjectCache())
893 cache->updateCacheAfterNodeIsAttached(this); 905 cache->updateCacheAfterNodeIsAttached(this);
894 } 906 }
895 907
896 void Node::detachLayoutTree(const AttachContext& context) { 908 void Node::detachLayoutTree(const AttachContext& context) {
897 DCHECK(document().lifecycle().stateAllowsDetach()); 909 DCHECK(document().lifecycle().stateAllowsDetach());
898 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); 910 DocumentLifecycle::DetachScope willDetach(document().lifecycle());
899 911
900 if (layoutObject()) 912 if (layoutObject())
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 if (node) { 2479 if (node) {
2468 std::stringstream stream; 2480 std::stringstream stream;
2469 node->printNodePathTo(stream); 2481 node->printNodePathTo(stream);
2470 LOG(INFO) << stream.str(); 2482 LOG(INFO) << stream.str();
2471 } else { 2483 } else {
2472 LOG(INFO) << "Cannot showNodePath for <null>"; 2484 LOG(INFO) << "Cannot showNodePath for <null>";
2473 } 2485 }
2474 } 2486 }
2475 2487
2476 #endif 2488 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698