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

Side by Side Diff: Source/core/dom/shadow/ComposedTreeWalker.cpp

Issue 192293002: Use new is*Element() helper functions in DOM code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add is*Element(PassRefPtr) helper Created 6 years, 9 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 /* 2 /*
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire ction) 67 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire ction)
68 { 68 {
69 ASSERT(node); 69 ASSERT(node);
70 if (!isActiveInsertionPoint(*node)) 70 if (!isActiveInsertionPoint(*node))
71 return const_cast<Node*>(node); 71 return const_cast<Node*>(node);
72 const InsertionPoint* insertionPoint = toInsertionPoint(node); 72 const InsertionPoint* insertionPoint = toInsertionPoint(node);
73 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct ion)) 73 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct ion))
74 return found; 74 return found;
75 ASSERT(node->hasTagName(HTMLNames::shadowTag) || (node->hasTagName(HTMLNames ::contentTag) && !node->hasChildren())); 75 ASSERT(isHTMLShadowElement(node) || (isHTMLContentElement(node) && !node->ha sChildren()));
76 return 0; 76 return 0;
77 } 77 }
78 78
79 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser tionPoint* insertionPoint, TraversalDirection direction) 79 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser tionPoint* insertionPoint, TraversalDirection direction)
80 { 80 {
81 for (const Node* next = node; next; next = (direction == TraversalDirectionF orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { 81 for (const Node* next = node; next; next = (direction == TraversalDirectionF orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) {
82 if (Node* found = traverseNode(next, direction)) 82 if (Node* found = traverseNode(next, direction))
83 return found; 83 return found;
84 } 84 }
85 return 0; 85 return 0;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 ShadowRoot* shadowRoot = toShadowRoot(parent); 156 ShadowRoot* shadowRoot = toShadowRoot(parent);
157 ASSERT(!shadowRoot->shadowInsertionPointOfYoungerShadowRoot()); 157 ASSERT(!shadowRoot->shadowInsertionPointOfYoungerShadowRoot());
158 if (!shadowRoot->isYoungest()) 158 if (!shadowRoot->isYoungest())
159 return 0; 159 return 0;
160 if (details) 160 if (details)
161 details->didTraverseShadowRoot(shadowRoot); 161 details->didTraverseShadowRoot(shadowRoot);
162 return shadowRoot->host(); 162 return shadowRoot->host();
163 } 163 }
164 164
165 } // namespace 165 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698