Chromium Code Reviews| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 #endif | 267 #endif |
| 268 | 268 |
| 269 if (hasRareData()) | 269 if (hasRareData()) |
| 270 clearRareData(); | 270 clearRareData(); |
| 271 | 271 |
| 272 RELEASE_ASSERT(!renderer()); | 272 RELEASE_ASSERT(!renderer()); |
| 273 | 273 |
| 274 #if !ENABLE(OILPAN) | 274 #if !ENABLE(OILPAN) |
| 275 if (!isContainerNode()) | 275 if (!isContainerNode()) |
| 276 willBeDeletedFromDocument(); | 276 willBeDeletedFromDocument(); |
| 277 #endif | |
| 278 | 277 |
| 279 if (m_previous) | 278 if (m_previous) |
| 280 m_previous->setNextSibling(0); | 279 m_previous->setNextSibling(0); |
| 281 if (m_next) | 280 if (m_next) |
| 282 m_next->setPreviousSibling(0); | 281 m_next->setPreviousSibling(0); |
| 283 | 282 |
| 284 #if !ENABLE(OILPAN) | |
| 285 if (m_treeScope) | 283 if (m_treeScope) |
| 286 m_treeScope->guardDeref(); | 284 m_treeScope->guardDeref(); |
| 287 #endif | 285 #endif |
| 288 | 286 |
| 289 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); | 287 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); |
| 290 | 288 |
| 291 if (getFlag(HasWeakReferencesFlag)) | 289 if (getFlag(HasWeakReferencesFlag)) |
| 292 WeakNodeMap::notifyNodeDestroyed(this); | 290 WeakNodeMap::notifyNodeDestroyed(this); |
| 293 } | 291 } |
| 294 | 292 |
| (...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2368 return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListen ers(EventTypeNames::mouseup) || hasEventListeners(EventTypeNames::mousedown) || hasEventListeners(EventTypeNames::click) || hasEventListeners(EventTypeNames::DO MActivate); | 2366 return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListen ers(EventTypeNames::mouseup) || hasEventListeners(EventTypeNames::mousedown) || hasEventListeners(EventTypeNames::click) || hasEventListeners(EventTypeNames::DO MActivate); |
| 2369 } | 2367 } |
| 2370 | 2368 |
| 2371 bool Node::willRespondToTouchEvents() | 2369 bool Node::willRespondToTouchEvents() |
| 2372 { | 2370 { |
| 2373 if (isDisabledFormControl(this)) | 2371 if (isDisabledFormControl(this)) |
| 2374 return false; | 2372 return false; |
| 2375 return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(Ev entTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || ha sEventListeners(EventTypeNames::touchend); | 2373 return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(Ev entTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || ha sEventListeners(EventTypeNames::touchend); |
| 2376 } | 2374 } |
| 2377 | 2375 |
| 2376 #if !ENABLE(OILPAN) | |
| 2378 // This is here for inlining | 2377 // This is here for inlining |
| 2379 #if ENABLE(OILPAN) | |
| 2380 inline void TreeScope::removedLastRefToScope() | |
| 2381 { | |
| 2382 dispose(); | |
|
haraken
2014/05/06 15:59:42
I agree that we're going toward a right direction,
Mads Ager (chromium)
2014/05/07 12:13:16
Yes, I completely agree and I did think about that
| |
| 2383 } | |
| 2384 #else | |
| 2385 inline void TreeScope::removedLastRefToScope() | 2378 inline void TreeScope::removedLastRefToScope() |
| 2386 { | 2379 { |
| 2387 ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun()); | 2380 ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun()); |
| 2388 if (m_guardRefCount) { | 2381 if (m_guardRefCount) { |
| 2389 // If removing a child removes the last self-only ref, we don't | 2382 // If removing a child removes the last self-only ref, we don't |
| 2390 // want the scope to be destructed until after | 2383 // want the scope to be destructed until after |
| 2391 // removeDetachedChildren returns, so we guard ourselves with an | 2384 // removeDetachedChildren returns, so we guard ourselves with an |
| 2392 // extra self-only ref. | 2385 // extra self-only ref. |
| 2393 guardRef(); | 2386 guardRef(); |
| 2394 dispose(); | 2387 dispose(); |
| 2395 #if !ASSERT_DISABLED | 2388 #if !ASSERT_DISABLED |
| 2396 // We need to do this right now since guardDeref() can delete this. | 2389 // We need to do this right now since guardDeref() can delete this. |
| 2397 rootNode().m_inRemovedLastRefFunction = false; | 2390 rootNode().m_inRemovedLastRefFunction = false; |
| 2398 #endif | 2391 #endif |
| 2399 guardDeref(); | 2392 guardDeref(); |
| 2400 } else { | 2393 } else { |
| 2401 #if !ASSERT_DISABLED | 2394 #if !ASSERT_DISABLED |
| 2402 rootNode().m_inRemovedLastRefFunction = false; | 2395 rootNode().m_inRemovedLastRefFunction = false; |
| 2403 #endif | 2396 #endif |
| 2404 #if SECURITY_ASSERT_ENABLED | 2397 #if SECURITY_ASSERT_ENABLED |
| 2405 beginDeletion(); | 2398 beginDeletion(); |
| 2406 #endif | 2399 #endif |
| 2407 delete this; | 2400 delete this; |
| 2408 } | 2401 } |
| 2409 } | 2402 } |
| 2410 #endif | |
| 2411 | 2403 |
| 2412 // It's important not to inline removedLastRef, because we don't want to inline the code to | 2404 // It's important not to inline removedLastRef, because we don't want to inline the code to |
| 2413 // delete a Node at each deref call site. | 2405 // delete a Node at each deref call site. |
| 2414 void Node::removedLastRef() | 2406 void Node::removedLastRef() |
| 2415 { | 2407 { |
| 2416 // An explicit check for Document here is better than a virtual function sin ce it is | 2408 // An explicit check for Document here is better than a virtual function sin ce it is |
| 2417 // faster for non-Document nodes, and because the call to removedLastRef tha t is inlined | 2409 // faster for non-Document nodes, and because the call to removedLastRef tha t is inlined |
| 2418 // at all deref call sites is smaller if it's a non-virtual function. | 2410 // at all deref call sites is smaller if it's a non-virtual function. |
| 2419 if (isTreeScope()) { | 2411 if (isTreeScope()) { |
| 2420 treeScope().removedLastRefToScope(); | 2412 treeScope().removedLastRefToScope(); |
| 2421 return; | 2413 return; |
| 2422 } | 2414 } |
| 2423 | 2415 |
| 2424 #if !ENABLE(OILPAN) | |
| 2425 #if SECURITY_ASSERT_ENABLED | 2416 #if SECURITY_ASSERT_ENABLED |
| 2426 m_deletionHasBegun = true; | 2417 m_deletionHasBegun = true; |
| 2427 #endif | 2418 #endif |
| 2428 delete this; | 2419 delete this; |
| 2420 } | |
| 2429 #endif | 2421 #endif |
| 2430 } | |
| 2431 | 2422 |
| 2432 unsigned Node::connectedSubframeCount() const | 2423 unsigned Node::connectedSubframeCount() const |
| 2433 { | 2424 { |
| 2434 return hasRareData() ? rareData()->connectedSubframeCount() : 0; | 2425 return hasRareData() ? rareData()->connectedSubframeCount() : 0; |
| 2435 } | 2426 } |
| 2436 | 2427 |
| 2437 void Node::incrementConnectedSubframeCount(unsigned amount) | 2428 void Node::incrementConnectedSubframeCount(unsigned amount) |
| 2438 { | 2429 { |
| 2439 ASSERT(isContainerNode()); | 2430 ASSERT(isContainerNode()); |
| 2440 ensureRareData().incrementConnectedSubframeCount(amount); | 2431 ensureRareData().incrementConnectedSubframeCount(amount); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2564 ASSERT(isHTMLElement() || isSVGElement()); | 2555 ASSERT(isHTMLElement() || isSVGElement()); |
| 2565 setFlag(CustomElementFlag); | 2556 setFlag(CustomElementFlag); |
| 2566 setFlag(newState == Upgraded, CustomElementUpgradedFlag); | 2557 setFlag(newState == Upgraded, CustomElementUpgradedFlag); |
| 2567 | 2558 |
| 2568 if (oldState == NotCustomElement || newState == Upgraded) | 2559 if (oldState == NotCustomElement || newState == Upgraded) |
| 2569 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed | 2560 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed |
| 2570 } | 2561 } |
| 2571 | 2562 |
| 2572 void Node::trace(Visitor* visitor) | 2563 void Node::trace(Visitor* visitor) |
| 2573 { | 2564 { |
| 2565 visitor->trace(m_parentOrShadowHostNode); | |
| 2566 visitor->trace(m_previous); | |
| 2567 visitor->trace(m_next); | |
| 2574 visitor->trace(m_treeScope); | 2568 visitor->trace(m_treeScope); |
| 2575 } | 2569 } |
| 2576 | 2570 |
| 2577 } // namespace WebCore | 2571 } // namespace WebCore |
| 2578 | 2572 |
| 2579 #ifndef NDEBUG | 2573 #ifndef NDEBUG |
| 2580 | 2574 |
| 2581 void showNode(const WebCore::Node* node) | 2575 void showNode(const WebCore::Node* node) |
| 2582 { | 2576 { |
| 2583 if (node) | 2577 if (node) |
| 2584 node->showNode(""); | 2578 node->showNode(""); |
| 2585 } | 2579 } |
| 2586 | 2580 |
| 2587 void showTree(const WebCore::Node* node) | 2581 void showTree(const WebCore::Node* node) |
| 2588 { | 2582 { |
| 2589 if (node) | 2583 if (node) |
| 2590 node->showTreeForThis(); | 2584 node->showTreeForThis(); |
| 2591 } | 2585 } |
| 2592 | 2586 |
| 2593 void showNodePath(const WebCore::Node* node) | 2587 void showNodePath(const WebCore::Node* node) |
| 2594 { | 2588 { |
| 2595 if (node) | 2589 if (node) |
| 2596 node->showNodePathForThis(); | 2590 node->showNodePathForThis(); |
| 2597 } | 2591 } |
| 2598 | 2592 |
| 2599 #endif | 2593 #endif |
| OLD | NEW |