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, 2010 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 | 751 |
752 return false; | 752 return false; |
753 } | 753 } |
754 | 754 |
755 void Node::setDocumentRecursively(Document* document) | 755 void Node::setDocumentRecursively(Document* document) |
756 { | 756 { |
757 // FIXME: To match Gecko, we should do this for nodes that are already in th
e document as well. | 757 // FIXME: To match Gecko, we should do this for nodes that are already in th
e document as well. |
758 if (this->document() == document || this->inDocument()) | 758 if (this->document() == document || this->inDocument()) |
759 return; | 759 return; |
760 | 760 |
| 761 // If an element is moved from a document and then eventually back again the
collection cache for |
| 762 // that element may contain stale data as changes made to it will have updat
ed the DOMTreeVersion |
| 763 // of the document it was moved to. By increasing the DOMTreeVersion of the
donating document here |
| 764 // we ensure that the collection cache will be invalidated as needed when th
e element is moved back. |
| 765 if (this->document()) |
| 766 this->document()->incDOMTreeVersion(); |
| 767 |
761 for (Node* node = this; node; node = node->traverseNextNode(this)) { | 768 for (Node* node = this; node; node = node->traverseNextNode(this)) { |
762 node->setDocument(document); | 769 node->setDocument(document); |
763 if (!node->isElementNode()) | 770 if (!node->isElementNode()) |
764 continue; | 771 continue; |
765 if (Node* shadow = toElement(node)->shadowRoot()) | 772 if (Node* shadow = toElement(node)->shadowRoot()) |
766 shadow->setDocumentRecursively(document); | 773 shadow->setDocumentRecursively(document); |
767 } | 774 } |
768 } | 775 } |
769 | 776 |
770 inline void Node::setStyleChange(StyleChangeType changeType) | 777 inline void Node::setStyleChange(StyleChangeType changeType) |
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 | 3054 |
3048 #ifndef NDEBUG | 3055 #ifndef NDEBUG |
3049 | 3056 |
3050 void showTree(const WebCore::Node* node) | 3057 void showTree(const WebCore::Node* node) |
3051 { | 3058 { |
3052 if (node) | 3059 if (node) |
3053 node->showTreeForThis(); | 3060 node->showTreeForThis(); |
3054 } | 3061 } |
3055 | 3062 |
3056 #endif | 3063 #endif |
OLD | NEW |