Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: Source/core/dom/Node.cpp

Issue 313813002: Oilpan: Replace RefPtrs to Node and its subclasses in core/dom/ with Oilpan transtion types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 return last; 458 return last;
459 last = currentElement->lastChild(); 459 last = currentElement->lastChild();
460 if (!last) 460 if (!last)
461 last = currentElement->pseudoElement(BEFORE); 461 last = currentElement->pseudoElement(BEFORE);
462 return last; 462 return last;
463 } 463 }
464 464
465 return lastChild(); 465 return lastChild();
466 } 466 }
467 467
468 void Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionStat e& exceptionState) 468 void Node::insertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node* refChild, E xceptionState& exceptionState)
469 { 469 {
470 if (isContainerNode()) 470 if (isContainerNode())
471 toContainerNode(this)->insertBefore(newChild, refChild, exceptionState); 471 toContainerNode(this)->insertBefore(newChild, refChild, exceptionState);
472 else 472 else
473 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method."); 473 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method.");
474 } 474 }
475 475
476 void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionStat e& exceptionState) 476 void Node::replaceChild(PassRefPtrWillBeRawPtr<Node> newChild, Node* oldChild, E xceptionState& exceptionState)
477 { 477 {
478 if (isContainerNode()) 478 if (isContainerNode())
479 toContainerNode(this)->replaceChild(newChild, oldChild, exceptionState); 479 toContainerNode(this)->replaceChild(newChild, oldChild, exceptionState);
480 else 480 else
481 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method."); 481 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method.");
482 } 482 }
483 483
484 void Node::removeChild(Node* oldChild, ExceptionState& exceptionState) 484 void Node::removeChild(Node* oldChild, ExceptionState& exceptionState)
485 { 485 {
486 if (isContainerNode()) 486 if (isContainerNode())
487 toContainerNode(this)->removeChild(oldChild, exceptionState); 487 toContainerNode(this)->removeChild(oldChild, exceptionState);
488 else 488 else
489 exceptionState.throwDOMException(NotFoundError, "This node type does not support this method."); 489 exceptionState.throwDOMException(NotFoundError, "This node type does not support this method.");
490 } 490 }
491 491
492 void Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& exceptionState ) 492 void Node::appendChild(PassRefPtrWillBeRawPtr<Node> newChild, ExceptionState& ex ceptionState)
493 { 493 {
494 if (isContainerNode()) 494 if (isContainerNode())
495 toContainerNode(this)->appendChild(newChild, exceptionState); 495 toContainerNode(this)->appendChild(newChild, exceptionState);
496 else 496 else
497 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method."); 497 exceptionState.throwDOMException(HierarchyRequestError, "This node type does not support this method.");
498 } 498 }
499 499
500 void Node::remove(ExceptionState& exceptionState) 500 void Node::remove(ExceptionState& exceptionState)
501 { 501 {
502 if (ContainerNode* parent = parentNode()) 502 if (ContainerNode* parent = parentNode())
503 parent->removeChild(this, exceptionState); 503 parent->removeChild(this, exceptionState);
504 } 504 }
505 505
506 void Node::normalize() 506 void Node::normalize()
507 { 507 {
508 // Go through the subtree beneath us, normalizing all nodes. This means that 508 // Go through the subtree beneath us, normalizing all nodes. This means that
509 // any two adjacent text nodes are merged and any empty text nodes are remov ed. 509 // any two adjacent text nodes are merged and any empty text nodes are remov ed.
510 510
511 RefPtr<Node> node = this; 511 RefPtrWillBeRawPtr<Node> node = this;
512 while (Node* firstChild = node->firstChild()) 512 while (Node* firstChild = node->firstChild())
513 node = firstChild; 513 node = firstChild;
514 while (node) { 514 while (node) {
515 if (node->isElementNode()) 515 if (node->isElementNode())
516 toElement(node)->normalizeAttributes(); 516 toElement(node)->normalizeAttributes();
517 517
518 if (node == this) 518 if (node == this)
519 break; 519 break;
520 520
521 if (node->nodeType() == TEXT_NODE) 521 if (node->nodeType() == TEXT_NODE)
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 case TEXT_NODE: 1512 case TEXT_NODE:
1513 case CDATA_SECTION_NODE: 1513 case CDATA_SECTION_NODE:
1514 case COMMENT_NODE: 1514 case COMMENT_NODE:
1515 case PROCESSING_INSTRUCTION_NODE: 1515 case PROCESSING_INSTRUCTION_NODE:
1516 setNodeValue(text); 1516 setNodeValue(text);
1517 return; 1517 return;
1518 case ELEMENT_NODE: 1518 case ELEMENT_NODE:
1519 case ATTRIBUTE_NODE: 1519 case ATTRIBUTE_NODE:
1520 case DOCUMENT_FRAGMENT_NODE: { 1520 case DOCUMENT_FRAGMENT_NODE: {
1521 // FIXME: Merge this logic into replaceChildrenWithText. 1521 // FIXME: Merge this logic into replaceChildrenWithText.
1522 RefPtr<ContainerNode> container = toContainerNode(this); 1522 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this);
1523 // No need to do anything if the text is identical. 1523 // No need to do anything if the text is identical.
1524 if (container->hasOneTextChild() && toText(container->firstChild())- >data() == text) 1524 if (container->hasOneTextChild() && toText(container->firstChild())- >data() == text)
1525 return; 1525 return;
1526 ChildListMutationScope mutation(*this); 1526 ChildListMutationScope mutation(*this);
1527 container->removeChildren(); 1527 container->removeChildren();
1528 // Note: This API will not insert empty text nodes: 1528 // Note: This API will not insert empty text nodes:
1529 // http://dom.spec.whatwg.org/#dom-node-textcontent 1529 // http://dom.spec.whatwg.org/#dom-node-textcontent
1530 if (!text.isEmpty()) 1530 if (!text.isEmpty())
1531 container->appendChild(document().createTextNode(text), ASSERT_N O_EXCEPTION); 1531 container->appendChild(document().createTextNode(text), ASSERT_N O_EXCEPTION);
1532 return; 1532 return;
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 return; 2158 return;
2159 2159
2160 size_t index = registry->find(registration); 2160 size_t index = registry->find(registration);
2161 ASSERT(index != kNotFound); 2161 ASSERT(index != kNotFound);
2162 if (index == kNotFound) 2162 if (index == kNotFound)
2163 return; 2163 return;
2164 2164
2165 // Deleting the registration may cause this node to be derefed, so we must m ake sure the Vector operation completes 2165 // Deleting the registration may cause this node to be derefed, so we must m ake sure the Vector operation completes
2166 // before that, in case |this| is destroyed (see MutationObserverRegistratio n::m_registrationNodeKeepAlive). 2166 // before that, in case |this| is destroyed (see MutationObserverRegistratio n::m_registrationNodeKeepAlive).
2167 // FIXME: Simplify the registration/transient registration logic to make thi s understandable by humans. 2167 // FIXME: Simplify the registration/transient registration logic to make thi s understandable by humans.
2168 RefPtr<Node> protect(this); 2168 RefPtrWillBeRawPtr<Node> protect(this);
2169 #if ENABLE(OILPAN) 2169 #if ENABLE(OILPAN)
2170 // The explicit dispose() is needed to have the registration 2170 // The explicit dispose() is needed to have the registration
2171 // object unregister itself promptly. 2171 // object unregister itself promptly.
2172 registration->dispose(); 2172 registration->dispose();
2173 #endif 2173 #endif
2174 registry->remove(index); 2174 registry->remove(index);
2175 } 2175 }
2176 2176
2177 void Node::registerTransientMutationObserver(MutationObserverRegistration* regis tration) 2177 void Node::registerTransientMutationObserver(MutationObserverRegistration* regis tration)
2178 { 2178 {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 node->showTreeForThis(); 2596 node->showTreeForThis();
2597 } 2597 }
2598 2598
2599 void showNodePath(const WebCore::Node* node) 2599 void showNodePath(const WebCore::Node* node)
2600 { 2600 {
2601 if (node) 2601 if (node)
2602 node->showNodePathForThis(); 2602 node->showNodePathForThis();
2603 } 2603 }
2604 2604
2605 #endif 2605 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698