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

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

Issue 2398293003: Move Layout Tree Construction code into Element::rebuildLayoutTree() (Closed)
Patch Set: Final patch to land 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 | « no previous file | third_party/WebKit/Source/core/dom/Document.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, 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 for (Node* child = firstChild(); child; child = child->nextSibling()) { 760 for (Node* child = firstChild(); child; child = child->nextSibling()) {
761 #if DCHECK_IS_ON() 761 #if DCHECK_IS_ON()
762 DCHECK(child->needsAttach() || 762 DCHECK(child->needsAttach() ||
763 childAttachedAllowedWhenAttachingChildren(this)); 763 childAttachedAllowedWhenAttachingChildren(this));
764 #endif 764 #endif
765 if (child->needsAttach()) 765 if (child->needsAttach())
766 child->attachLayoutTree(childrenContext); 766 child->attachLayoutTree(childrenContext);
767 } 767 }
768 768
769 clearChildNeedsStyleRecalc(); 769 clearChildNeedsStyleRecalc();
770 clearChildNeedsReattachLayoutTree();
770 Node::attachLayoutTree(context); 771 Node::attachLayoutTree(context);
771 } 772 }
772 773
773 void ContainerNode::detachLayoutTree(const AttachContext& context) { 774 void ContainerNode::detachLayoutTree(const AttachContext& context) {
774 AttachContext childrenContext(context); 775 AttachContext childrenContext(context);
775 childrenContext.resolvedStyle = nullptr; 776 childrenContext.resolvedStyle = nullptr;
776 childrenContext.clearInvalidation = true; 777 childrenContext.clearInvalidation = true;
777 778
778 for (Node* child = firstChild(); child; child = child->nextSibling()) 779 for (Node* child = firstChild(); child; child = child->nextSibling())
779 child->detachLayoutTree(childrenContext); 780 child->detachLayoutTree(childrenContext);
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 // O(1) time. See crbug.com/288225 1280 // O(1) time. See crbug.com/288225
1280 StyleResolver& styleResolver = document().ensureStyleResolver(); 1281 StyleResolver& styleResolver = document().ensureStyleResolver();
1281 Text* lastTextNode = nullptr; 1282 Text* lastTextNode = nullptr;
1282 for (Node* child = lastChild(); child; child = child->previousSibling()) { 1283 for (Node* child = lastChild(); child; child = child->previousSibling()) {
1283 if (child->isTextNode()) { 1284 if (child->isTextNode()) {
1284 toText(child)->recalcTextStyle(change, lastTextNode); 1285 toText(child)->recalcTextStyle(change, lastTextNode);
1285 lastTextNode = toText(child); 1286 lastTextNode = toText(child);
1286 } else if (child->isElementNode()) { 1287 } else if (child->isElementNode()) {
1287 Element* element = toElement(child); 1288 Element* element = toElement(child);
1288 if (element->shouldCallRecalcStyle(change)) 1289 if (element->shouldCallRecalcStyle(change))
1289 element->recalcStyle(change, lastTextNode); 1290 element->recalcStyle(change);
1290 else if (element->supportsStyleSharing()) 1291 else if (element->supportsStyleSharing())
1291 styleResolver.addToStyleSharingList(*element); 1292 styleResolver.addToStyleSharingList(*element);
1292 if (element->layoutObject()) 1293 if (element->layoutObject())
1293 lastTextNode = nullptr; 1294 lastTextNode = nullptr;
1294 } 1295 }
1295 } 1296 }
1296 } 1297 }
1297 1298
1298 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, 1299 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType,
1299 Element* changedElement, 1300 Element* changedElement,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 return true; 1468 return true;
1468 1469
1469 if (node->isElementNode() && toElement(node)->shadow()) 1470 if (node->isElementNode() && toElement(node)->shadow())
1470 return true; 1471 return true;
1471 1472
1472 return false; 1473 return false;
1473 } 1474 }
1474 #endif 1475 #endif
1475 1476
1476 } // namespace blink 1477 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698