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

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

Issue 54273007: Use more references in ContainerNode code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix crashes Created 7 years, 1 month 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
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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 return false; 910 return false;
911 911
912 for (; node; node = node->shadowHost()) { 912 for (; node; node = node->shadowHost()) {
913 if (treeScope() == node->treeScope()) 913 if (treeScope() == node->treeScope())
914 return contains(node); 914 return contains(node);
915 } 915 }
916 916
917 return false; 917 return false;
918 } 918 }
919 919
920 bool Node::containsIncludingHostElements(const Node* node) const 920 bool Node::containsIncludingHostElements(const Node& node) const
921 { 921 {
922 while (node) { 922 const Node* current = &node;
923 if (node == this) 923 do {
924 if (current == this)
924 return true; 925 return true;
925 if (node->isDocumentFragment() && toDocumentFragment(node)->isTemplateCo ntent()) 926 if (current->isDocumentFragment() && toDocumentFragment(current)->isTemp lateContent())
926 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho st(); 927 current = static_cast<const TemplateContentDocumentFragment*>(curren t)->host();
927 else 928 else
928 node = node->parentOrShadowHostNode(); 929 current = current->parentOrShadowHostNode();
929 } 930 } while (current);
930 return false; 931 return false;
931 } 932 }
932 933
933 void Node::reattach(const AttachContext& context) 934 void Node::reattach(const AttachContext& context)
934 { 935 {
935 AttachContext reattachContext(context); 936 AttachContext reattachContext(context);
936 reattachContext.performingReattach = true; 937 reattachContext.performingReattach = true;
937 938
938 // We only need to detach if the node has already been through attach(). 939 // We only need to detach if the node has already been through attach().
939 if (styleChangeType() < NeedsReattachStyleChange) 940 if (styleChangeType() < NeedsReattachStyleChange)
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 node->showTreeForThis(); 2624 node->showTreeForThis();
2624 } 2625 }
2625 2626
2626 void showNodePath(const WebCore::Node* node) 2627 void showNodePath(const WebCore::Node* node)
2627 { 2628 {
2628 if (node) 2629 if (node)
2629 node->showNodePathForThis(); 2630 node->showNodePathForThis();
2630 } 2631 }
2631 2632
2632 #endif 2633 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698