| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 Node::~Node() | 259 Node::~Node() |
| 260 { | 260 { |
| 261 #ifndef NDEBUG | 261 #ifndef NDEBUG |
| 262 nodeCounter.decrement(); | 262 nodeCounter.decrement(); |
| 263 #endif | 263 #endif |
| 264 | 264 |
| 265 #if DUMP_NODE_STATISTICS | 265 #if DUMP_NODE_STATISTICS |
| 266 liveNodeSet.remove(this); | 266 liveNodeSet.remove(this); |
| 267 #endif | 267 #endif |
| 268 | 268 |
| 269 #if !ENABLE(OILPAN) |
| 269 if (hasRareData()) | 270 if (hasRareData()) |
| 270 clearRareData(); | 271 clearRareData(); |
| 271 | 272 |
| 272 RELEASE_ASSERT(!renderer()); | 273 RELEASE_ASSERT(!renderer()); |
| 273 | 274 |
| 274 #if !ENABLE(OILPAN) | |
| 275 if (!isContainerNode()) | 275 if (!isContainerNode()) |
| 276 willBeDeletedFromDocument(); | 276 willBeDeletedFromDocument(); |
| 277 #else |
| 278 // With Oilpan, the rare data finalizer also asserts for |
| 279 // this condition (we cannot directly access it here.) |
| 280 RELEASE_ASSERT(hasRareData() || !renderer()); |
| 277 #endif | 281 #endif |
| 278 | 282 |
| 279 if (m_previous) | 283 if (m_previous) |
| 280 m_previous->setNextSibling(0); | 284 m_previous->setNextSibling(0); |
| 281 if (m_next) | 285 if (m_next) |
| 282 m_next->setPreviousSibling(0); | 286 m_next->setPreviousSibling(0); |
| 283 | 287 |
| 284 #if !ENABLE(OILPAN) | 288 #if !ENABLE(OILPAN) |
| 285 if (m_treeScope) | 289 if (m_treeScope) |
| 286 m_treeScope->guardDeref(); | 290 m_treeScope->guardDeref(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 { | 323 { |
| 320 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData()); | 324 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData()); |
| 321 return static_cast<NodeRareData*>(m_data.m_rareData); | 325 return static_cast<NodeRareData*>(m_data.m_rareData); |
| 322 } | 326 } |
| 323 | 327 |
| 324 NodeRareData& Node::ensureRareData() | 328 NodeRareData& Node::ensureRareData() |
| 325 { | 329 { |
| 326 if (hasRareData()) | 330 if (hasRareData()) |
| 327 return *rareData(); | 331 return *rareData(); |
| 328 | 332 |
| 329 NodeRareData* data; | |
| 330 if (isElementNode()) | 333 if (isElementNode()) |
| 331 data = ElementRareData::create(m_data.m_renderer).leakPtr(); | 334 m_data.m_rareData = ElementRareData::create(m_data.m_renderer); |
| 332 else | 335 else |
| 333 data = NodeRareData::create(m_data.m_renderer).leakPtr(); | 336 m_data.m_rareData = NodeRareData::create(m_data.m_renderer); |
| 334 ASSERT(data); | |
| 335 | 337 |
| 336 m_data.m_rareData = data; | 338 ASSERT(m_data.m_rareData); |
| 339 |
| 337 setFlag(HasRareDataFlag); | 340 setFlag(HasRareDataFlag); |
| 338 return *data; | 341 return *rareData(); |
| 339 } | 342 } |
| 340 | 343 |
| 344 #if !ENABLE(OILPAN) |
| 341 void Node::clearRareData() | 345 void Node::clearRareData() |
| 342 { | 346 { |
| 343 ASSERT(hasRareData()); | 347 ASSERT(hasRareData()); |
| 344 ASSERT(!transientMutationObserverRegistry() || transientMutationObserverRegi
stry()->isEmpty()); | 348 ASSERT(!transientMutationObserverRegistry() || transientMutationObserverRegi
stry()->isEmpty()); |
| 345 | 349 |
| 346 RenderObject* renderer = m_data.m_rareData->renderer(); | 350 RenderObject* renderer = m_data.m_rareData->renderer(); |
| 347 if (isElementNode()) { | 351 if (isElementNode()) |
| 348 ElementRareData* rareData = static_cast<ElementRareData*>(m_data.m_rareD
ata); | 352 delete static_cast<ElementRareData*>(m_data.m_rareData); |
| 349 rareData->dispose(); | 353 else |
| 350 delete rareData; | 354 delete static_cast<NodeRareData*>(m_data.m_rareData); |
| 351 } else { | |
| 352 NodeRareData* rareData = static_cast<NodeRareData*>(m_data.m_rareData); | |
| 353 rareData->dispose(); | |
| 354 delete rareData; | |
| 355 } | |
| 356 m_data.m_renderer = renderer; | 355 m_data.m_renderer = renderer; |
| 357 clearFlag(HasRareDataFlag); | 356 clearFlag(HasRareDataFlag); |
| 358 } | 357 } |
| 358 #endif |
| 359 | 359 |
| 360 Node* Node::toNode() | 360 Node* Node::toNode() |
| 361 { | 361 { |
| 362 return this; | 362 return this; |
| 363 } | 363 } |
| 364 | 364 |
| 365 short Node::tabIndex() const | 365 short Node::tabIndex() const |
| 366 { | 366 { |
| 367 return 0; | 367 return 0; |
| 368 } | 368 } |
| (...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 ASSERT(isHTMLElement() || isSVGElement()); | 2564 ASSERT(isHTMLElement() || isSVGElement()); |
| 2565 setFlag(CustomElementFlag); | 2565 setFlag(CustomElementFlag); |
| 2566 setFlag(newState == Upgraded, CustomElementUpgradedFlag); | 2566 setFlag(newState == Upgraded, CustomElementUpgradedFlag); |
| 2567 | 2567 |
| 2568 if (oldState == NotCustomElement || newState == Upgraded) | 2568 if (oldState == NotCustomElement || newState == Upgraded) |
| 2569 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed | 2569 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed |
| 2570 } | 2570 } |
| 2571 | 2571 |
| 2572 void Node::trace(Visitor* visitor) | 2572 void Node::trace(Visitor* visitor) |
| 2573 { | 2573 { |
| 2574 if (hasRareData()) |
| 2575 visitor->trace(rareData()); |
| 2576 |
| 2574 visitor->trace(m_treeScope); | 2577 visitor->trace(m_treeScope); |
| 2575 } | 2578 } |
| 2576 | 2579 |
| 2577 } // namespace WebCore | 2580 } // namespace WebCore |
| 2578 | 2581 |
| 2579 #ifndef NDEBUG | 2582 #ifndef NDEBUG |
| 2580 | 2583 |
| 2581 void showNode(const WebCore::Node* node) | 2584 void showNode(const WebCore::Node* node) |
| 2582 { | 2585 { |
| 2583 if (node) | 2586 if (node) |
| 2584 node->showNode(""); | 2587 node->showNode(""); |
| 2585 } | 2588 } |
| 2586 | 2589 |
| 2587 void showTree(const WebCore::Node* node) | 2590 void showTree(const WebCore::Node* node) |
| 2588 { | 2591 { |
| 2589 if (node) | 2592 if (node) |
| 2590 node->showTreeForThis(); | 2593 node->showTreeForThis(); |
| 2591 } | 2594 } |
| 2592 | 2595 |
| 2593 void showNodePath(const WebCore::Node* node) | 2596 void showNodePath(const WebCore::Node* node) |
| 2594 { | 2597 { |
| 2595 if (node) | 2598 if (node) |
| 2596 node->showNodePathForThis(); | 2599 node->showNodePathForThis(); |
| 2597 } | 2600 } |
| 2598 | 2601 |
| 2599 #endif | 2602 #endif |
| OLD | NEW |