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

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

Issue 2760233004: Make all setNeedsReattachLayoutTree happen from updateStyle. (Closed)
Patch Set: Corrected DCHECK condition Created 3 years, 9 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') | no next file » | 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 document().scheduleLayoutTreeUpdateIfNeeded(); 718 document().scheduleLayoutTreeUpdateIfNeeded();
719 } 719 }
720 720
721 void Node::markAncestorsWithChildNeedsReattachLayoutTree() { 721 void Node::markAncestorsWithChildNeedsReattachLayoutTree() {
722 for (ContainerNode* p = parentOrShadowHostNode(); 722 for (ContainerNode* p = parentOrShadowHostNode();
723 p && !p->childNeedsReattachLayoutTree(); p = p->parentOrShadowHostNode()) 723 p && !p->childNeedsReattachLayoutTree(); p = p->parentOrShadowHostNode())
724 p->setChildNeedsReattachLayoutTree(); 724 p->setChildNeedsReattachLayoutTree();
725 } 725 }
726 726
727 void Node::setNeedsReattachLayoutTree() { 727 void Node::setNeedsReattachLayoutTree() {
728 DCHECK(document().inStyleRecalc() &&
esprehn 2017/03/21 20:59:56 Can we use two DCHECKs so it's clear which side fa
rune 2017/03/21 22:25:15 Done.
729 !document().childNeedsDistributionRecalc());
728 setFlag(NeedsReattachLayoutTree); 730 setFlag(NeedsReattachLayoutTree);
729 markAncestorsWithChildNeedsReattachLayoutTree(); 731 markAncestorsWithChildNeedsReattachLayoutTree();
730 } 732 }
731 733
732 void Node::setNeedsStyleRecalc(StyleChangeType changeType, 734 void Node::setNeedsStyleRecalc(StyleChangeType changeType,
733 const StyleChangeReasonForTracing& reason) { 735 const StyleChangeReasonForTracing& reason) {
734 DCHECK(changeType != NoStyleChange); 736 DCHECK(changeType != NoStyleChange);
735 if (!inActiveDocument()) 737 if (!inActiveDocument())
736 return; 738 return;
737 739
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 } 927 }
926 928
927 void Node::detachLayoutTree(const AttachContext& context) { 929 void Node::detachLayoutTree(const AttachContext& context) {
928 DCHECK(document().lifecycle().stateAllowsDetach()); 930 DCHECK(document().lifecycle().stateAllowsDetach());
929 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); 931 DocumentLifecycle::DetachScope willDetach(document().lifecycle());
930 932
931 if (layoutObject()) 933 if (layoutObject())
932 layoutObject()->destroyAndCleanupAnonymousWrappers(); 934 layoutObject()->destroyAndCleanupAnonymousWrappers();
933 setLayoutObject(nullptr); 935 setLayoutObject(nullptr);
934 setStyleChange(NeedsReattachStyleChange); 936 setStyleChange(NeedsReattachStyleChange);
935 setFlag(NeedsReattachLayoutTree);
936 clearChildNeedsStyleInvalidation(); 937 clearChildNeedsStyleInvalidation();
937 } 938 }
938 939
939 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) { 940 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) {
940 ScriptForbiddenScope forbidScriptDuringRawIteration; 941 ScriptForbiddenScope forbidScriptDuringRawIteration;
941 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { 942 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) {
942 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { 943 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) {
943 bool hadLayoutObject = !!sibling->layoutObject(); 944 bool hadLayoutObject = !!sibling->layoutObject();
944 toText(sibling)->reattachLayoutTreeIfNeeded(); 945 toText(sibling)->reattachLayoutTreeIfNeeded();
945 // If sibling's layout object status didn't change we don't need to 946 // If sibling's layout object status didn't change we don't need to
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 if (node) { 2536 if (node) {
2536 std::stringstream stream; 2537 std::stringstream stream;
2537 node->printNodePathTo(stream); 2538 node->printNodePathTo(stream);
2538 LOG(INFO) << stream.str(); 2539 LOG(INFO) << stream.str();
2539 } else { 2540 } else {
2540 LOG(INFO) << "Cannot showNodePath for <null>"; 2541 LOG(INFO) << "Cannot showNodePath for <null>";
2541 } 2542 }
2542 } 2543 }
2543 2544
2544 #endif 2545 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698