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, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights 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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 node->clearAttached(); | 982 node->clearAttached(); |
983 node->clearChildNeedsStyleRecalc(); | 983 node->clearChildNeedsStyleRecalc(); |
984 | 984 |
985 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot
; shadowRoot = shadowRoot->olderShadowRoot()) | 985 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot
; shadowRoot = shadowRoot->olderShadowRoot()) |
986 detachNode(shadowRoot, context); | 986 detachNode(shadowRoot, context); |
987 | 987 |
988 node = NodeTraversal::next(node, root); | 988 node = NodeTraversal::next(node, root); |
989 continue; | 989 continue; |
990 } | 990 } |
991 // Handle normal reattaches from style recalc (ex. display type changes) | 991 // Handle normal reattaches from style recalc (ex. display type changes) |
992 // or descendants of lazy attached nodes that got actually attached, for
example, | |
993 // by innerHTML or editing. | |
994 // FIXME: innerHTML and editing should also lazyAttach. | |
995 if (node->attached()) | 992 if (node->attached()) |
996 node->detach(context); | 993 node->detach(context); |
997 node = NodeTraversal::nextSkippingChildren(node, root); | 994 node = NodeTraversal::nextSkippingChildren(node, root); |
998 } | 995 } |
999 } | 996 } |
1000 | 997 |
1001 void Node::reattach(const AttachContext& context) | 998 void Node::reattach(const AttachContext& context) |
1002 { | 999 { |
1003 ASSERT(document().inStyleRecalc()); | |
1004 AttachContext reattachContext(context); | 1000 AttachContext reattachContext(context); |
1005 reattachContext.performingReattach = true; | 1001 reattachContext.performingReattach = true; |
1006 | 1002 |
1007 detachNode(this, reattachContext); | 1003 detachNode(this, reattachContext); |
1008 attach(reattachContext); | 1004 attach(reattachContext); |
1009 } | 1005 } |
1010 | 1006 |
1011 void Node::attach(const AttachContext&) | 1007 void Node::attach(const AttachContext&) |
1012 { | 1008 { |
| 1009 ASSERT(document().inStyleRecalc()); |
1013 ASSERT(!attached()); | 1010 ASSERT(!attached()); |
1014 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); | 1011 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); |
1015 | 1012 |
1016 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the | |
1017 // result of Text::textRendererIsNeeded() for those nodes. | |
1018 // FIXME: This loop is no longer required once we lazy attach all the time. | |
1019 if (renderer() && !document().inStyleRecalc()) { | |
1020 for (Node* next = nextSibling(); next; next = next->nextSibling()) { | |
1021 if (next->renderer()) | |
1022 break; | |
1023 if (!next->attached()) | |
1024 break; // Assume this means none of the following siblings are a
ttached. | |
1025 if (!next->isTextNode()) | |
1026 continue; | |
1027 ASSERT(!next->renderer()); | |
1028 toText(next)->reattach(); | |
1029 // If we again decided not to create a renderer for next, we can bai
l out the loop, | |
1030 // because it won't affect the result of Text::textRendererIsNeeded(
) for the rest | |
1031 // of sibling nodes. | |
1032 if (!next->renderer()) | |
1033 break; | |
1034 } | |
1035 } | |
1036 | |
1037 setAttached(); | 1013 setAttached(); |
1038 clearNeedsStyleRecalc(); | 1014 clearNeedsStyleRecalc(); |
1039 | 1015 |
1040 if (Document* doc = documentInternal()) { | 1016 if (Document* doc = documentInternal()) { |
1041 if (AXObjectCache* cache = doc->axObjectCache()) | 1017 if (AXObjectCache* cache = doc->axObjectCache()) |
1042 cache->updateCacheAfterNodeIsAttached(this); | 1018 cache->updateCacheAfterNodeIsAttached(this); |
1043 } | 1019 } |
1044 } | 1020 } |
1045 | 1021 |
1046 #ifndef NDEBUG | 1022 #ifndef NDEBUG |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 node->showTreeForThis(); | 2681 node->showTreeForThis(); |
2706 } | 2682 } |
2707 | 2683 |
2708 void showNodePath(const WebCore::Node* node) | 2684 void showNodePath(const WebCore::Node* node) |
2709 { | 2685 { |
2710 if (node) | 2686 if (node) |
2711 node->showNodePathForThis(); | 2687 node->showNodePathForThis(); |
2712 } | 2688 } |
2713 | 2689 |
2714 #endif | 2690 #endif |
OLD | NEW |