| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 setFlag(NotifyRendererWithIdenticalStyles); | 738 setFlag(NotifyRendererWithIdenticalStyles); |
| 739 | 739 |
| 740 StyleChangeType existingChangeType = styleChangeType(); | 740 StyleChangeType existingChangeType = styleChangeType(); |
| 741 if (changeType > existingChangeType) | 741 if (changeType > existingChangeType) |
| 742 setStyleChange(changeType); | 742 setStyleChange(changeType); |
| 743 | 743 |
| 744 if (existingChangeType == NoStyleChange) | 744 if (existingChangeType == NoStyleChange) |
| 745 markAncestorsWithChildNeedsStyleRecalc(); | 745 markAncestorsWithChildNeedsStyleRecalc(); |
| 746 } | 746 } |
| 747 | 747 |
| 748 void Node::lazyAttach() | 748 void Node::scheduleRenderTreeCreation() |
| 749 { | 749 { |
| 750 markAncestorsWithChildNeedsStyleRecalc(); | 750 markAncestorsWithChildNeedsStyleRecalc(); |
| 751 for (Node* node = this; node; node = NodeTraversal::next(node, this)) { | 751 for (Node* node = this; node; node = NodeTraversal::next(node, this)) { |
| 752 node->setAttached(); | 752 node->setAttached(); |
| 753 node->setStyleChange(LazyAttachStyleChange); | 753 node->setStyleChange(DeferredRenderTreeCreationStyleChange); |
| 754 if (node->isContainerNode()) | 754 if (node->isContainerNode()) |
| 755 node->setChildNeedsStyleRecalc(); | 755 node->setChildNeedsStyleRecalc(); |
| 756 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o
lderShadowRoot()) | 756 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o
lderShadowRoot()) |
| 757 root->lazyAttach(); | 757 root->scheduleRenderTreeCreation(); |
| 758 } | 758 } |
| 759 } | 759 } |
| 760 | 760 |
| 761 Node* Node::focusDelegate() | 761 Node* Node::focusDelegate() |
| 762 { | 762 { |
| 763 return this; | 763 return this; |
| 764 } | 764 } |
| 765 | 765 |
| 766 bool Node::shouldHaveFocusAppearance() const | 766 bool Node::shouldHaveFocusAppearance() const |
| 767 { | 767 { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 if (node == this) | 936 if (node == this) |
| 937 return true; | 937 return true; |
| 938 if (node->isDocumentFragment() && toDocumentFragment(node)->isTemplateCo
ntent()) | 938 if (node->isDocumentFragment() && toDocumentFragment(node)->isTemplateCo
ntent()) |
| 939 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho
st(); | 939 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho
st(); |
| 940 else | 940 else |
| 941 node = node->parentOrShadowHostNode(); | 941 node = node->parentOrShadowHostNode(); |
| 942 } | 942 } |
| 943 return false; | 943 return false; |
| 944 } | 944 } |
| 945 | 945 |
| 946 inline void Node::detachNode(Node* root, const AttachContext& context) | 946 inline void Node::destroyRenderTreeForNode(Node* root, const AttachContext& cont
ext) |
| 947 { | 947 { |
| 948 Node* node = root; | 948 Node* node = root; |
| 949 while (node) { | 949 while (node) { |
| 950 if (node->styleChangeType() == LazyAttachStyleChange) { | 950 if (node->styleChangeType() == DeferredRenderTreeCreationStyleChange) { |
| 951 // FIXME: This is needed because Node::lazyAttach marks nodes as bei
ng attached even | 951 // FIXME: This is needed because Node::scheduleRenderTreeCreation ma
rks nodes as being attached even |
| 952 // though they've never been through attach(). This allows us to avo
id doing all the | 952 // though they've never been through attach(). This allows us to avo
id doing all the |
| 953 // virtual calls to detach() and other associated work. | 953 // virtual calls to detach() and other associated work. |
| 954 node->clearAttached(); | 954 node->clearAttached(); |
| 955 node->clearChildNeedsStyleRecalc(); | 955 node->clearChildNeedsStyleRecalc(); |
| 956 | 956 |
| 957 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot
; shadowRoot = shadowRoot->olderShadowRoot()) | 957 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot
; shadowRoot = shadowRoot->olderShadowRoot()) |
| 958 detachNode(shadowRoot, context); | 958 destroyRenderTreeForNode(shadowRoot, context); |
| 959 | 959 |
| 960 node = NodeTraversal::next(node, root); | 960 node = NodeTraversal::next(node, root); |
| 961 continue; | 961 continue; |
| 962 } | 962 } |
| 963 // Handle normal reattaches from style recalc (ex. display type changes) | 963 // Handle normal reattaches from style recalc (ex. display type changes) |
| 964 if (node->attached()) | 964 if (node->attached()) |
| 965 node->detach(context); | 965 node->destroyRenderTree(context); |
| 966 node = NodeTraversal::nextSkippingChildren(node, root); | 966 node = NodeTraversal::nextSkippingChildren(node, root); |
| 967 } | 967 } |
| 968 } | 968 } |
| 969 | 969 |
| 970 void Node::reattach(const AttachContext& context) | 970 void Node::recreateRenderTree(const AttachContext& context) |
| 971 { | 971 { |
| 972 AttachContext reattachContext(context); | 972 AttachContext reattachContext(context); |
| 973 reattachContext.performingReattach = true; | 973 reattachContext.reconstructingRenderTree = true; |
| 974 | 974 |
| 975 detachNode(this, reattachContext); | 975 destroyRenderTreeForNode(this, reattachContext); |
| 976 attach(reattachContext); | 976 createRenderTree(reattachContext); |
| 977 } | 977 } |
| 978 | 978 |
| 979 void Node::attach(const AttachContext&) | 979 void Node::createRenderTree(const AttachContext&) |
| 980 { | 980 { |
| 981 ASSERT(document().inStyleRecalc() || isDocumentNode()); | 981 ASSERT(document().inStyleRecalc() || isDocumentNode()); |
| 982 ASSERT(!attached()); | 982 ASSERT(!attached()); |
| 983 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); | 983 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); |
| 984 | 984 |
| 985 setAttached(); | 985 setAttached(); |
| 986 clearNeedsStyleRecalc(); | 986 clearNeedsStyleRecalc(); |
| 987 | 987 |
| 988 if (Document* doc = documentInternal()) { | 988 if (Document* doc = documentInternal()) { |
| 989 if (AXObjectCache* cache = doc->axObjectCache()) | 989 if (AXObjectCache* cache = doc->axObjectCache()) |
| 990 cache->updateCacheAfterNodeIsAttached(this); | 990 cache->updateCacheAfterNodeIsAttached(this); |
| 991 } | 991 } |
| 992 } | 992 } |
| 993 | 993 |
| 994 #ifndef NDEBUG | 994 #ifndef NDEBUG |
| 995 static Node* detachingNode; | 995 static Node* detachingNode; |
| 996 | 996 |
| 997 bool Node::inDetach() const | 997 bool Node::inDetach() const |
| 998 { | 998 { |
| 999 return detachingNode == this; | 999 return detachingNode == this; |
| 1000 } | 1000 } |
| 1001 #endif | 1001 #endif |
| 1002 | 1002 |
| 1003 void Node::detach(const AttachContext& context) | 1003 void Node::destroyRenderTree(const AttachContext& context) |
| 1004 { | 1004 { |
| 1005 #ifndef NDEBUG | 1005 #ifndef NDEBUG |
| 1006 ASSERT(!detachingNode); | 1006 ASSERT(!detachingNode); |
| 1007 detachingNode = this; | 1007 detachingNode = this; |
| 1008 #endif | 1008 #endif |
| 1009 | 1009 |
| 1010 if (renderer()) | 1010 if (renderer()) |
| 1011 renderer()->destroyAndCleanupAnonymousWrappers(); | 1011 renderer()->destroyAndCleanupAnonymousWrappers(); |
| 1012 setRenderer(0); | 1012 setRenderer(0); |
| 1013 | 1013 |
| 1014 // Do not remove the element's hovered and active status | 1014 // Do not remove the element's hovered and active status |
| 1015 // if performing a reattach. | 1015 // if performing a reattach. |
| 1016 if (!context.performingReattach) { | 1016 if (!context.reconstructingRenderTree) { |
| 1017 Document& doc = document(); | 1017 Document& doc = document(); |
| 1018 if (isUserActionElement()) { | 1018 if (isUserActionElement()) { |
| 1019 if (hovered()) | 1019 if (hovered()) |
| 1020 doc.hoveredNodeDetached(this); | 1020 doc.hoveredNodeDetached(this); |
| 1021 if (inActiveChain()) | 1021 if (inActiveChain()) |
| 1022 doc.activeChainNodeDetached(this); | 1022 doc.activeChainNodeDetached(this); |
| 1023 doc.userActionElements().didDetach(this); | 1023 doc.userActionElements().didDetach(this); |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| 1026 | 1026 |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2655 node->showTreeForThis(); | 2655 node->showTreeForThis(); |
| 2656 } | 2656 } |
| 2657 | 2657 |
| 2658 void showNodePath(const WebCore::Node* node) | 2658 void showNodePath(const WebCore::Node* node) |
| 2659 { | 2659 { |
| 2660 if (node) | 2660 if (node) |
| 2661 node->showNodePathForThis(); | 2661 node->showNodePathForThis(); |
| 2662 } | 2662 } |
| 2663 | 2663 |
| 2664 #endif | 2664 #endif |
| OLD | NEW |