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

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

Issue 2375293002: Set NeedsReattachLayoutTree and ChildNeedsReattachLayoutTree flags on Node (Closed)
Patch Set: Add ability to clear dirty bits and relevant call sites 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } 685 }
686 686
687 inline void Node::setStyleChange(StyleChangeType changeType) { 687 inline void Node::setStyleChange(StyleChangeType changeType) {
688 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 688 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
689 } 689 }
690 690
691 void Node::markAncestorsWithChildNeedsStyleRecalc() { 691 void Node::markAncestorsWithChildNeedsStyleRecalc() {
692 for (ContainerNode* p = parentOrShadowHostNode(); 692 for (ContainerNode* p = parentOrShadowHostNode();
693 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode()) 693 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode())
694 p->setChildNeedsStyleRecalc(); 694 p->setChildNeedsStyleRecalc();
695 // TODO(nainar): Move this to Node::markAncestorsWithChildNeedsReattachLayoutT ree()
695 document().scheduleLayoutTreeUpdateIfNeeded(); 696 document().scheduleLayoutTreeUpdateIfNeeded();
696 } 697 }
697 698
699 void Node::markAncestorsWithChildNeedsReattachLayoutTree() {
700 for (ContainerNode* p = parentOrShadowHostNode();
701 p && !p->childNeedsReattachLayoutTree(); p = p->parentOrShadowHostNode())
702 p->setChildNeedsReattachLayoutTree();
703 }
704 void Node::setNeedsReattachLayoutTree() {
705 setFlag(NeedsReattachLayoutTree);
706 markAncestorsWithChildNeedsReattachLayoutTree();
707 }
708
698 void Node::setNeedsStyleRecalc(StyleChangeType changeType, 709 void Node::setNeedsStyleRecalc(StyleChangeType changeType,
699 const StyleChangeReasonForTracing& reason) { 710 const StyleChangeReasonForTracing& reason) {
700 DCHECK(changeType != NoStyleChange); 711 DCHECK(changeType != NoStyleChange);
701 if (!inActiveDocument()) 712 if (!inActiveDocument())
702 return; 713 return;
703 714
704 TRACE_EVENT_INSTANT1( 715 TRACE_EVENT_INSTANT1(
705 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), 716 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"),
706 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data", 717 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data",
707 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason)); 718 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 890
880 void Node::attachLayoutTree(const AttachContext&) { 891 void Node::attachLayoutTree(const AttachContext&) {
881 DCHECK(document().inStyleRecalc() || isDocumentNode()); 892 DCHECK(document().inStyleRecalc() || isDocumentNode());
882 DCHECK(!document().lifecycle().inDetach()); 893 DCHECK(!document().lifecycle().inDetach());
883 DCHECK(needsAttach()); 894 DCHECK(needsAttach());
884 DCHECK(!layoutObject() || 895 DCHECK(!layoutObject() ||
885 (layoutObject()->style() && 896 (layoutObject()->style() &&
886 (layoutObject()->parent() || layoutObject()->isLayoutView()))); 897 (layoutObject()->parent() || layoutObject()->isLayoutView())));
887 898
888 clearNeedsStyleRecalc(); 899 clearNeedsStyleRecalc();
900 clearNeedsReattachLayoutTree();
889 901
890 if (AXObjectCache* cache = document().axObjectCache()) 902 if (AXObjectCache* cache = document().axObjectCache())
891 cache->updateCacheAfterNodeIsAttached(this); 903 cache->updateCacheAfterNodeIsAttached(this);
892 } 904 }
893 905
894 void Node::detachLayoutTree(const AttachContext& context) { 906 void Node::detachLayoutTree(const AttachContext& context) {
895 DCHECK(document().lifecycle().stateAllowsDetach()); 907 DCHECK(document().lifecycle().stateAllowsDetach());
896 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); 908 DocumentLifecycle::DetachScope willDetach(document().lifecycle());
897 909
898 if (layoutObject()) 910 if (layoutObject())
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 if (node) { 2476 if (node) {
2465 std::stringstream stream; 2477 std::stringstream stream;
2466 node->printNodePathTo(stream); 2478 node->printNodePathTo(stream);
2467 LOG(INFO) << stream.str(); 2479 LOG(INFO) << stream.str();
2468 } else { 2480 } else {
2469 LOG(INFO) << "Cannot showNodePath for <null>"; 2481 LOG(INFO) << "Cannot showNodePath for <null>";
2470 } 2482 }
2471 } 2483 }
2472 2484
2473 #endif 2485 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698