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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp

Issue 1413583002: Make ElementShadow::youngestShadowRoot() return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more tail -> head Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 23 matching lines...) Expand all
34 namespace blink { 34 namespace blink {
35 35
36 static inline ElementShadow* shadowFor(const Node& node) 36 static inline ElementShadow* shadowFor(const Node& node)
37 { 37 {
38 return node.isElementNode() ? toElement(node).shadow() : 0; 38 return node.isElementNode() ? toElement(node).shadow() : 0;
39 } 39 }
40 40
41 Node* ComposedTreeTraversal::traverseChild(const Node& node, TraversalDirection direction) 41 Node* ComposedTreeTraversal::traverseChild(const Node& node, TraversalDirection direction)
42 { 42 {
43 ElementShadow* shadow = shadowFor(node); 43 ElementShadow* shadow = shadowFor(node);
44 return shadow ? traverseLightChildren(*shadow->youngestShadowRoot(), directi on) 44 return shadow ? traverseLightChildren(shadow->youngestShadowRoot(), directio n)
45 : traverseLightChildren(node, direction); 45 : traverseLightChildren(node, direction);
46 } 46 }
47 47
48 Node* ComposedTreeTraversal::traverseLightChildren(const Node& node, TraversalDi rection direction) 48 Node* ComposedTreeTraversal::traverseLightChildren(const Node& node, TraversalDi rection direction)
49 { 49 {
50 return traverseSiblings(direction == TraversalDirectionForward ? node.firstC hild() : node.lastChild(), direction); 50 return traverseSiblings(direction == TraversalDirectionForward ? node.firstC hild() : node.lastChild(), direction);
51 } 51 }
52 52
53 Node* ComposedTreeTraversal::traverseSiblings(const Node* node, TraversalDirecti on direction) 53 Node* ComposedTreeTraversal::traverseSiblings(const Node* node, TraversalDirecti on direction)
54 { 54 {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 Node& ComposedTreeTraversal::lastWithinOrSelf(const Node& node) 300 Node& ComposedTreeTraversal::lastWithinOrSelf(const Node& node)
301 { 301 {
302 assertPrecondition(node); 302 assertPrecondition(node);
303 Node* lastDescendant = lastWithin(node); 303 Node* lastDescendant = lastWithin(node);
304 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); 304 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node);
305 assertPostcondition(&result); 305 assertPostcondition(&result);
306 return result; 306 return result;
307 } 307 }
308 308
309 } // namespace 309 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/shadow/ElementShadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698