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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 detach(); | 430 detach(); |
431 | 431 |
432 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists
() && !isContainerNode()) | 432 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists
() && !isContainerNode()) |
433 doc->axObjectCache()->remove(this); | 433 doc->axObjectCache()->remove(this); |
434 | 434 |
435 if (m_previous) | 435 if (m_previous) |
436 m_previous->setNextSibling(0); | 436 m_previous->setNextSibling(0); |
437 if (m_next) | 437 if (m_next) |
438 m_next->setPreviousSibling(0); | 438 m_next->setPreviousSibling(0); |
439 | 439 |
440 if (doc) | 440 m_treeScope->guardDeref(); |
441 doc->guardDeref(); | |
442 | 441 |
443 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); | 442 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); |
444 } | 443 } |
445 | 444 |
446 NodeRareData* Node::rareData() const | 445 NodeRareData* Node::rareData() const |
447 { | 446 { |
448 ASSERT(hasRareData()); | 447 ASSERT(hasRareData()); |
449 return static_cast<NodeRareData*>(m_data.m_rareData); | 448 return static_cast<NodeRareData*>(m_data.m_rareData); |
450 } | 449 } |
451 | 450 |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 ASSERT(!document()->childNeedsStyleRecalc()); | 879 ASSERT(!document()->childNeedsStyleRecalc()); |
881 | 880 |
882 // FIXME: Even if we are not visible, we might have a child that is visible. | 881 // FIXME: Even if we are not visible, we might have a child that is visible. |
883 // Hyatt wants to fix that some day with a "has visible content" flag or the
like. | 882 // Hyatt wants to fix that some day with a "has visible content" flag or the
like. |
884 if (!renderer() || renderer()->style()->visibility() != VISIBLE) | 883 if (!renderer() || renderer()->style()->visibility() != VISIBLE) |
885 return false; | 884 return false; |
886 | 885 |
887 return true; | 886 return true; |
888 } | 887 } |
889 | 888 |
890 bool Node::isTreeScope() const | |
891 { | |
892 return treeScope()->rootNode() == this; | |
893 } | |
894 | |
895 bool Node::isKeyboardFocusable(KeyboardEvent*) const | 889 bool Node::isKeyboardFocusable(KeyboardEvent*) const |
896 { | 890 { |
897 return isFocusable() && tabIndex() >= 0; | 891 return isFocusable() && tabIndex() >= 0; |
898 } | 892 } |
899 | 893 |
900 bool Node::isMouseFocusable() const | 894 bool Node::isMouseFocusable() const |
901 { | 895 { |
902 return isFocusable(); | 896 return isFocusable(); |
903 } | 897 } |
904 | 898 |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 { | 2548 { |
2555 ensureRareData()->ensureMicroDataTokenLists()->itemType(this)->setValueInter
nal(value); | 2549 ensureRareData()->ensureMicroDataTokenLists()->itemType(this)->setValueInter
nal(value); |
2556 } | 2550 } |
2557 | 2551 |
2558 PassRefPtr<PropertyNodeList> Node::propertyNodeList(const String& name) | 2552 PassRefPtr<PropertyNodeList> Node::propertyNodeList(const String& name) |
2559 { | 2553 { |
2560 return ensureRareData()->ensureNodeLists()->addCacheWithName<PropertyNodeLis
t>(this, PropertyNodeListType, name); | 2554 return ensureRareData()->ensureNodeLists()->addCacheWithName<PropertyNodeLis
t>(this, PropertyNodeListType, name); |
2561 } | 2555 } |
2562 #endif | 2556 #endif |
2563 | 2557 |
| 2558 // This is here for inlining |
| 2559 inline void TreeScope::removedLastRefToScope() |
| 2560 { |
| 2561 ASSERT(!deletionHasBegun()); |
| 2562 if (m_guardRefCount) { |
| 2563 // If removing a child removes the last self-only ref, we don't |
| 2564 // want the scope to be destructed until after |
| 2565 // removeDetachedChildren returns, so we guard ourselves with an |
| 2566 // extra self-only ref. |
| 2567 guardRef(); |
| 2568 dispose(); |
| 2569 #ifndef NDEBUG |
| 2570 // We need to do this right now since guardDeref() can delete this. |
| 2571 rootNode()->m_inRemovedLastRefFunction = false; |
| 2572 #endif |
| 2573 guardDeref(); |
| 2574 } else { |
| 2575 #ifndef NDEBUG |
| 2576 rootNode()->m_inRemovedLastRefFunction = false; |
| 2577 beginDeletion(); |
| 2578 #endif |
| 2579 delete this; |
| 2580 } |
| 2581 } |
| 2582 |
2564 // It's important not to inline removedLastRef, because we don't want to inline
the code to | 2583 // It's important not to inline removedLastRef, because we don't want to inline
the code to |
2565 // delete a Node at each deref call site. | 2584 // delete a Node at each deref call site. |
2566 void Node::removedLastRef() | 2585 void Node::removedLastRef() |
2567 { | 2586 { |
2568 // An explicit check for Document here is better than a virtual function sin
ce it is | 2587 // An explicit check for Document here is better than a virtual function sin
ce it is |
2569 // faster for non-Document nodes, and because the call to removedLastRef tha
t is inlined | 2588 // faster for non-Document nodes, and because the call to removedLastRef tha
t is inlined |
2570 // at all deref call sites is smaller if it's a non-virtual function. | 2589 // at all deref call sites is smaller if it's a non-virtual function. |
2571 if (isDocumentNode()) { | 2590 if (isTreeScope()) { |
2572 static_cast<Document*>(this)->removedLastRef(); | 2591 treeScope()->removedLastRefToScope(); |
2573 return; | 2592 return; |
2574 } | 2593 } |
| 2594 |
2575 #ifndef NDEBUG | 2595 #ifndef NDEBUG |
2576 m_deletionHasBegun = true; | 2596 m_deletionHasBegun = true; |
2577 #endif | 2597 #endif |
2578 delete this; | 2598 delete this; |
2579 } | 2599 } |
2580 | 2600 |
2581 void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 2601 void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
2582 { | 2602 { |
2583 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 2603 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
2584 ScriptWrappable::reportMemoryUsage(memoryObjectInfo); | 2604 ScriptWrappable::reportMemoryUsage(memoryObjectInfo); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 node->showTreeForThis(); | 2734 node->showTreeForThis(); |
2715 } | 2735 } |
2716 | 2736 |
2717 void showNodePath(const WebCore::Node* node) | 2737 void showNodePath(const WebCore::Node* node) |
2718 { | 2738 { |
2719 if (node) | 2739 if (node) |
2720 node->showNodePathForThis(); | 2740 node->showNodePathForThis(); |
2721 } | 2741 } |
2722 | 2742 |
2723 #endif | 2743 #endif |
OLD | NEW |