| OLD | NEW |
| 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 781 |
| 782 void ContainerNode::detachLayoutTree(const AttachContext& context) { | 782 void ContainerNode::detachLayoutTree(const AttachContext& context) { |
| 783 AttachContext childrenContext(context); | 783 AttachContext childrenContext(context); |
| 784 childrenContext.resolvedStyle = nullptr; | 784 childrenContext.resolvedStyle = nullptr; |
| 785 childrenContext.clearInvalidation = true; | 785 childrenContext.clearInvalidation = true; |
| 786 | 786 |
| 787 for (Node* child = firstChild(); child; child = child->nextSibling()) | 787 for (Node* child = firstChild(); child; child = child->nextSibling()) |
| 788 child->detachLayoutTree(childrenContext); | 788 child->detachLayoutTree(childrenContext); |
| 789 | 789 |
| 790 setChildNeedsStyleRecalc(); | 790 setChildNeedsStyleRecalc(); |
| 791 setChildNeedsReattachLayoutTree(); | |
| 792 Node::detachLayoutTree(context); | 791 Node::detachLayoutTree(context); |
| 793 } | 792 } |
| 794 | 793 |
| 795 void ContainerNode::childrenChanged(const ChildrenChange& change) { | 794 void ContainerNode::childrenChanged(const ChildrenChange& change) { |
| 796 document().incDOMTreeVersion(); | 795 document().incDOMTreeVersion(); |
| 797 document().notifyChangeChildren(*this); | 796 document().notifyChangeChildren(*this); |
| 798 invalidateNodeListCachesInAncestors(); | 797 invalidateNodeListCachesInAncestors(); |
| 799 if (change.isChildInsertion()) { | 798 if (change.isChildInsertion() && !childNeedsStyleRecalc()) { |
| 800 if (!childNeedsStyleRecalc()) { | 799 setChildNeedsStyleRecalc(); |
| 801 setChildNeedsStyleRecalc(); | 800 markAncestorsWithChildNeedsStyleRecalc(); |
| 802 markAncestorsWithChildNeedsStyleRecalc(); | |
| 803 } | |
| 804 if (!childNeedsReattachLayoutTree()) { | |
| 805 setChildNeedsReattachLayoutTree(); | |
| 806 markAncestorsWithChildNeedsReattachLayoutTree(); | |
| 807 } | |
| 808 } | 801 } |
| 809 } | 802 } |
| 810 | 803 |
| 811 void ContainerNode::cloneChildNodes(ContainerNode* clone) { | 804 void ContainerNode::cloneChildNodes(ContainerNode* clone) { |
| 812 DummyExceptionStateForTesting exceptionState; | 805 DummyExceptionStateForTesting exceptionState; |
| 813 for (Node* n = firstChild(); n && !exceptionState.hadException(); | 806 for (Node* n = firstChild(); n && !exceptionState.hadException(); |
| 814 n = n->nextSibling()) | 807 n = n->nextSibling()) |
| 815 clone->appendChild(n->cloneNode(true), exceptionState); | 808 clone->appendChild(n->cloneNode(true), exceptionState); |
| 816 } | 809 } |
| 817 | 810 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 if (element->shouldCallRecalcStyle(change)) | 1298 if (element->shouldCallRecalcStyle(change)) |
| 1306 element->recalcStyle(change, lastTextNode); | 1299 element->recalcStyle(change, lastTextNode); |
| 1307 else if (element->supportsStyleSharing()) | 1300 else if (element->supportsStyleSharing()) |
| 1308 styleResolver.addToStyleSharingList(*element); | 1301 styleResolver.addToStyleSharingList(*element); |
| 1309 if (element->layoutObject()) | 1302 if (element->layoutObject()) |
| 1310 lastTextNode = nullptr; | 1303 lastTextNode = nullptr; |
| 1311 } | 1304 } |
| 1312 } | 1305 } |
| 1313 } | 1306 } |
| 1314 | 1307 |
| 1315 void ContainerNode::rebuildChildrenLayoutTrees() { | |
| 1316 DCHECK(!needsReattachLayoutTree()); | |
| 1317 | |
| 1318 for (Node* child = lastChild(); child; child = child->previousSibling()) { | |
| 1319 if (child->needsReattachLayoutTree() || | |
| 1320 child->childNeedsReattachLayoutTree()) { | |
| 1321 if (child->isTextNode()) | |
| 1322 toText(child)->rebuildTextLayoutTree(); | |
| 1323 else if (child->isElementNode()) | |
| 1324 toElement(child)->rebuildLayoutTree(); | |
| 1325 } | |
| 1326 } | |
| 1327 // This is done in ContainerNode::attachLayoutTree but will never be cleared | |
| 1328 // if we don't enter ContainerNode::attachLayoutTree so we do it here. | |
| 1329 clearChildNeedsStyleRecalc(); | |
| 1330 clearChildNeedsReattachLayoutTree(); | |
| 1331 } | |
| 1332 | |
| 1333 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, | 1308 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, |
| 1334 Element* changedElement, | 1309 Element* changedElement, |
| 1335 Node* nodeBeforeChange, | 1310 Node* nodeBeforeChange, |
| 1336 Node* nodeAfterChange) { | 1311 Node* nodeAfterChange) { |
| 1337 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || | 1312 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || |
| 1338 getStyleChangeType() >= SubtreeStyleChange) | 1313 getStyleChangeType() >= SubtreeStyleChange) |
| 1339 return; | 1314 return; |
| 1340 | 1315 |
| 1341 if (!hasRestyleFlag(ChildrenAffectedByStructuralRules)) | 1316 if (!hasRestyleFlag(ChildrenAffectedByStructuralRules)) |
| 1342 return; | 1317 return; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 return true; | 1477 return true; |
| 1503 | 1478 |
| 1504 if (node->isElementNode() && toElement(node)->shadow()) | 1479 if (node->isElementNode() && toElement(node)->shadow()) |
| 1505 return true; | 1480 return true; |
| 1506 | 1481 |
| 1507 return false; | 1482 return false; |
| 1508 } | 1483 } |
| 1509 #endif | 1484 #endif |
| 1510 | 1485 |
| 1511 } // namespace blink | 1486 } // namespace blink |
| OLD | NEW |