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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.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, 2013 Apple Inc. All rights 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 } 772 }
773 773
774 void ContainerNode::detachLayoutTree(const AttachContext& context) { 774 void ContainerNode::detachLayoutTree(const AttachContext& context) {
775 AttachContext childrenContext(context); 775 AttachContext childrenContext(context);
776 childrenContext.resolvedStyle = nullptr; 776 childrenContext.resolvedStyle = nullptr;
777 childrenContext.clearInvalidation = true; 777 childrenContext.clearInvalidation = true;
778 778
779 for (Node* child = firstChild(); child; child = child->nextSibling()) 779 for (Node* child = firstChild(); child; child = child->nextSibling())
780 child->detachLayoutTree(childrenContext); 780 child->detachLayoutTree(childrenContext);
781 781
782 setChildNeedsStyleRecalc();
783 Node::detachLayoutTree(context); 782 Node::detachLayoutTree(context);
784 } 783 }
785 784
786 void ContainerNode::childrenChanged(const ChildrenChange& change) { 785 void ContainerNode::childrenChanged(const ChildrenChange& change) {
787 document().incDOMTreeVersion(); 786 document().incDOMTreeVersion();
788 invalidateNodeListCachesInAncestors(); 787 invalidateNodeListCachesInAncestors();
789 if (change.isChildInsertion() && !childNeedsStyleRecalc()) { 788 if (change.isChildInsertion() && !childNeedsStyleRecalc()) {
790 setChildNeedsStyleRecalc(); 789 setChildNeedsStyleRecalc();
791 markAncestorsWithChildNeedsStyleRecalc(); 790 markAncestorsWithChildNeedsStyleRecalc();
792 } 791 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } else if (child->isElementNode()) { 1286 } else if (child->isElementNode()) {
1288 Element* element = toElement(child); 1287 Element* element = toElement(child);
1289 if (element->shouldCallRecalcStyle(change)) 1288 if (element->shouldCallRecalcStyle(change))
1290 element->recalcStyle(change); 1289 element->recalcStyle(change);
1291 else if (element->supportsStyleSharing()) 1290 else if (element->supportsStyleSharing())
1292 styleResolver.addToStyleSharingList(*element); 1291 styleResolver.addToStyleSharingList(*element);
1293 if (element->layoutObject()) 1292 if (element->layoutObject())
1294 lastTextNode = nullptr; 1293 lastTextNode = nullptr;
1295 } 1294 }
1296 } 1295 }
1296 clearChildNeedsStyleRecalc();
1297 }
1298
1299 void ContainerNode::rebuildDescendantLayoutTree() {
1300 DCHECK(!needsStyleRecalc());
1301 DCHECK(!childNeedsStyleRecalc());
1302 DCHECK(!needsReattachLayoutTree());
1303
1304 for (Node* child = firstChild(); child; child = child->nextSibling()) {
1305 if (child->needsReattachLayoutTree() ||
1306 child->childNeedsReattachLayoutTree()) {
1307 if (child->isTextNode())
1308 toText(child)->rebuildTextLayoutTree();
1309 else if (child->isElementNode())
1310 toElement(child)->rebuildLayoutTree();
1311 }
1312 }
1313 clearChildNeedsReattachLayoutTree();
1297 } 1314 }
1298 1315
1299 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, 1316 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType,
1300 Element* changedElement, 1317 Element* changedElement,
1301 Node* nodeBeforeChange, 1318 Node* nodeBeforeChange,
1302 Node* nodeAfterChange) { 1319 Node* nodeAfterChange) {
1303 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || 1320 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() ||
1304 getStyleChangeType() >= SubtreeStyleChange) 1321 getStyleChangeType() >= SubtreeStyleChange)
1305 return; 1322 return;
1306 1323
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 return true; 1485 return true;
1469 1486
1470 if (node->isElementNode() && toElement(node)->shadow()) 1487 if (node->isElementNode() && toElement(node)->shadow())
1471 return true; 1488 return true;
1472 1489
1473 return false; 1490 return false;
1474 } 1491 }
1475 #endif 1492 #endif
1476 1493
1477 } // namespace blink 1494 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698