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

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

Issue 311053003: Oilpan: update remaining Document uses of RefPtr<Node>s. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 return nullptr; 906 return nullptr;
907 } 907 }
908 return ProcessingInstruction::create(*this, target, data); 908 return ProcessingInstruction::create(*this, target, data);
909 } 909 }
910 910
911 PassRefPtrWillBeRawPtr<Text> Document::createEditingTextNode(const String& text) 911 PassRefPtrWillBeRawPtr<Text> Document::createEditingTextNode(const String& text)
912 { 912 {
913 return Text::createEditingText(*this, text); 913 return Text::createEditingText(*this, text);
914 } 914 }
915 915
916 bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, Pass RefPtr<ContainerNode> newContainerNode, ExceptionState& exceptionState) 916 bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, Pass RefPtrWillBeRawPtr<ContainerNode> newContainerNode, ExceptionState& exceptionSta te)
917 { 917 {
918 for (Node* oldChild = oldContainerNode->firstChild(); oldChild; oldChild = o ldChild->nextSibling()) { 918 for (Node* oldChild = oldContainerNode->firstChild(); oldChild; oldChild = o ldChild->nextSibling()) {
919 RefPtr<Node> newChild = importNode(oldChild, true, exceptionState); 919 RefPtrWillBeRawPtr<Node> newChild = importNode(oldChild, true, exception State);
920 if (exceptionState.hadException()) 920 if (exceptionState.hadException())
921 return false; 921 return false;
922 newContainerNode->appendChild(newChild.release(), exceptionState); 922 newContainerNode->appendChild(newChild.release(), exceptionState);
923 if (exceptionState.hadException()) 923 if (exceptionState.hadException())
924 return false; 924 return false;
925 } 925 }
926 926
927 return true; 927 return true;
928 } 928 }
929 929
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 return 0; 2427 return 0;
2428 2428
2429 for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*documentEleme nt()); child; child = Traversal<HTMLElement>::nextSibling(*child)) { 2429 for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*documentEleme nt()); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
2430 if (isHTMLFrameSetElement(*child) || isHTMLBodyElement(*child)) 2430 if (isHTMLFrameSetElement(*child) || isHTMLBodyElement(*child))
2431 return child; 2431 return child;
2432 } 2432 }
2433 2433
2434 return 0; 2434 return 0;
2435 } 2435 }
2436 2436
2437 void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& excep tionState) 2437 void Document::setBody(PassRefPtrWillBeRawPtr<HTMLElement> prpNewBody, Exception State& exceptionState)
2438 { 2438 {
2439 RefPtr<HTMLElement> newBody = prpNewBody; 2439 RefPtrWillBeRawPtr<HTMLElement> newBody = prpNewBody;
2440 2440
2441 if (!newBody) { 2441 if (!newBody) {
2442 exceptionState.throwDOMException(HierarchyRequestError, ExceptionMessage s::argumentNullOrIncorrectType(1, "HTMLElement")); 2442 exceptionState.throwDOMException(HierarchyRequestError, ExceptionMessage s::argumentNullOrIncorrectType(1, "HTMLElement"));
2443 return; 2443 return;
2444 } 2444 }
2445 if (!documentElement()) { 2445 if (!documentElement()) {
2446 exceptionState.throwDOMException(HierarchyRequestError, "No document ele ment exists."); 2446 exceptionState.throwDOMException(HierarchyRequestError, "No document ele ment exists.");
2447 return; 2447 return;
2448 } 2448 }
2449 2449
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
3456 3456
3457 m_evaluateMediaQueriesOnStyleRecalc = true; 3457 m_evaluateMediaQueriesOnStyleRecalc = true;
3458 setNeedsStyleRecalc(SubtreeStyleChange); 3458 setNeedsStyleRecalc(SubtreeStyleChange);
3459 } 3459 }
3460 3460
3461 void Document::styleResolverMayHaveChanged() 3461 void Document::styleResolverMayHaveChanged()
3462 { 3462 {
3463 styleResolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : Anal yzedStyleUpdate); 3463 styleResolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : Anal yzedStyleUpdate);
3464 } 3464 }
3465 3465
3466 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) 3466 void Document::setHoverNode(PassRefPtrWillBeRawPtr<Node> newHoverNode)
3467 { 3467 {
3468 m_hoverNode = newHoverNode; 3468 m_hoverNode = newHoverNode;
3469 } 3469 }
3470 3470
3471 void Document::setActiveHoverElement(PassRefPtrWillBeRawPtr<Element> newActiveEl ement) 3471 void Document::setActiveHoverElement(PassRefPtrWillBeRawPtr<Element> newActiveEl ement)
3472 { 3472 {
3473 if (!newActiveElement) { 3473 if (!newActiveElement) {
3474 m_activeHoverElement.clear(); 3474 m_activeHoverElement.clear();
3475 return; 3475 return;
3476 } 3476 }
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
5445 } 5445 }
5446 // If the mouse has just been pressed, set :active on the chain. Those (and only those) 5446 // If the mouse has just been pressed, set :active on the chain. Those (and only those)
5447 // nodes should remain :active until the mouse is released. 5447 // nodes should remain :active until the mouse is released.
5448 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); 5448 bool allowActiveChanges = !oldActiveElement && activeHoverElement();
5449 5449
5450 // If the mouse is down and if this is a mouse move event, we want to restri ct changes in 5450 // If the mouse is down and if this is a mouse move event, we want to restri ct changes in
5451 // :hover/:active to only apply to elements that are in the :active chain th at we froze 5451 // :hover/:active to only apply to elements that are in the :active chain th at we froze
5452 // at the time the mouse went down. 5452 // at the time the mouse went down.
5453 bool mustBeInActiveChain = request.active() && request.move(); 5453 bool mustBeInActiveChain = request.active() && request.move();
5454 5454
5455 RefPtr<Node> oldHoverNode = hoverNode(); 5455 RefPtrWillBeRawPtr<Node> oldHoverNode = hoverNode();
5456 5456
5457 // Check to see if the hovered node has changed. 5457 // Check to see if the hovered node has changed.
5458 // If it hasn't, we do not need to do anything. 5458 // If it hasn't, we do not need to do anything.
5459 Node* newHoverNode = innerElementInDocument; 5459 Node* newHoverNode = innerElementInDocument;
5460 while (newHoverNode && !newHoverNode->renderer()) 5460 while (newHoverNode && !newHoverNode->renderer())
5461 newHoverNode = newHoverNode->parentOrShadowHostNode(); 5461 newHoverNode = newHoverNode->parentOrShadowHostNode();
5462 5462
5463 // Update our current hover node. 5463 // Update our current hover node.
5464 setHoverNode(newHoverNode); 5464 setHoverNode(newHoverNode);
5465 5465
5466 // We have two different objects. Fetch their renderers. 5466 // We have two different objects. Fetch their renderers.
5467 RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; 5467 RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0;
5468 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; 5468 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0;
5469 5469
5470 // Locate the common ancestor render object for the two renderers. 5470 // Locate the common ancestor render object for the two renderers.
5471 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj ); 5471 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj );
5472 RefPtr<Node> ancestorNode(ancestor ? ancestor->node() : 0); 5472 RefPtrWillBeRawPtr<Node> ancestorNode(ancestor ? ancestor->node() : 0);
5473 5473
5474 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; 5474 WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToRemoveFromChain;
5475 Vector<RefPtr<Node>, 32> nodesToAddToChain; 5475 WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToAddToChain;
5476 5476
5477 if (oldHoverObj != newHoverObj) { 5477 if (oldHoverObj != newHoverObj) {
5478 // If the old hovered node is not nil but it's renderer is, it was proba bly detached as part of the :hover style 5478 // If the old hovered node is not nil but it's renderer is, it was proba bly detached as part of the :hover style
5479 // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element (and its ancestors) 5479 // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element (and its ancestors)
5480 // must be updated, to ensure it's normal style is re-applied. 5480 // must be updated, to ensure it's normal style is re-applied.
5481 if (oldHoverNode && !oldHoverObj) { 5481 if (oldHoverNode && !oldHoverObj) {
5482 for (Node* node = oldHoverNode.get(); node; node = node->parentNode( )) { 5482 for (Node* node = oldHoverNode.get(); node; node = node->parentNode( )) {
5483 if (!mustBeInActiveChain || (node->isElementNode() && toElement( node)->inActiveChain())) 5483 if (!mustBeInActiveChain || (node->isElementNode() && toElement( node)->inActiveChain()))
5484 nodesToRemoveFromChain.append(node); 5484 nodesToRemoveFromChain.append(node);
5485 } 5485 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
5811 visitor->trace(m_compositorPendingAnimations); 5811 visitor->trace(m_compositorPendingAnimations);
5812 visitor->trace(m_contextDocument); 5812 visitor->trace(m_contextDocument);
5813 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5813 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5814 DocumentSupplementable::trace(visitor); 5814 DocumentSupplementable::trace(visitor);
5815 TreeScope::trace(visitor); 5815 TreeScope::trace(visitor);
5816 ContainerNode::trace(visitor); 5816 ContainerNode::trace(visitor);
5817 ExecutionContext::trace(visitor); 5817 ExecutionContext::trace(visitor);
5818 } 5818 }
5819 5819
5820 } // namespace WebCore 5820 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698