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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Split up didRecalcStyle into didRecalcStyle and didRebuildLayoutTree Created 3 years, 10 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, 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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 if (element->shouldCallRecalcStyle(change)) 1291 if (element->shouldCallRecalcStyle(change))
1292 element->recalcStyle(change, lastTextNode); 1292 element->recalcStyle(change, lastTextNode);
1293 else if (element->supportsStyleSharing()) 1293 else if (element->supportsStyleSharing())
1294 styleResolver.addToStyleSharingList(*element); 1294 styleResolver.addToStyleSharingList(*element);
1295 if (element->layoutObject()) 1295 if (element->layoutObject())
1296 lastTextNode = nullptr; 1296 lastTextNode = nullptr;
1297 } 1297 }
1298 } 1298 }
1299 } 1299 }
1300 1300
1301 void ContainerNode::rebuildChildrenLayoutTrees() {
1302 DCHECK(!needsStyleRecalc());
1303 DCHECK(!needsReattachLayoutTree());
1304
1305 for (Node* child = lastChild(); child; child = child->previousSibling()) {
1306 if (child->needsReattachLayoutTree() ||
1307 child->childNeedsReattachLayoutTree()) {
1308 if (child->isTextNode())
1309 toText(child)->rebuildTextLayoutTree();
1310 else if (child->isElementNode())
1311 toElement(child)->rebuildLayoutTree();
1312 }
1313 }
1314 // This is done in ContainerNode::attachLayoutTree but will never be cleared
1315 // if we don't enter ContainerNode::attachLayoutTree so we do it here.
1316 clearChildNeedsStyleRecalc();
1317 clearChildNeedsReattachLayoutTree();
1318 }
1319
1301 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, 1320 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType,
1302 Element* changedElement, 1321 Element* changedElement,
1303 Node* nodeBeforeChange, 1322 Node* nodeBeforeChange,
1304 Node* nodeAfterChange) { 1323 Node* nodeAfterChange) {
1305 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || 1324 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() ||
1306 getStyleChangeType() >= SubtreeStyleChange) 1325 getStyleChangeType() >= SubtreeStyleChange)
1307 return; 1326 return;
1308 1327
1309 if (!hasRestyleFlag(ChildrenAffectedByStructuralRules)) 1328 if (!hasRestyleFlag(ChildrenAffectedByStructuralRules))
1310 return; 1329 return;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 return true; 1489 return true;
1471 1490
1472 if (node->isElementNode() && toElement(node)->shadow()) 1491 if (node->isElementNode() && toElement(node)->shadow())
1473 return true; 1492 return true;
1474 1493
1475 return false; 1494 return false;
1476 } 1495 }
1477 #endif 1496 #endif
1478 1497
1479 } // namespace blink 1498 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698