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