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

Side by Side Diff: Source/core/rendering/RenderCounter.cpp

Issue 69003004: Have NodeTraversal::previous*() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/page/FocusController.cpp ('k') | Source/core/rendering/RenderListItem.cpp » ('j') | 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) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 { 51 {
52 DEFINE_STATIC_LOCAL(CounterMaps, staticCounterMaps, ()); 52 DEFINE_STATIC_LOCAL(CounterMaps, staticCounterMaps, ());
53 return staticCounterMaps; 53 return staticCounterMaps;
54 } 54 }
55 55
56 // This function processes the renderer tree in the order of the DOM tree 56 // This function processes the renderer tree in the order of the DOM tree
57 // including pseudo elements as defined in CSS 2.1. 57 // including pseudo elements as defined in CSS 2.1.
58 static RenderObject* previousInPreOrder(const RenderObject* object) 58 static RenderObject* previousInPreOrder(const RenderObject* object)
59 { 59 {
60 Element* self = toElement(object->node()); 60 Element* self = toElement(object->node());
61 Element* previous = ElementTraversal::previousIncludingPseudo(self); 61 ASSERT(self);
62 Element* previous = ElementTraversal::previousIncludingPseudo(*self);
62 while (previous && !previous->renderer()) 63 while (previous && !previous->renderer())
63 previous = ElementTraversal::previousIncludingPseudo(previous); 64 previous = ElementTraversal::previousIncludingPseudo(*previous);
64 return previous ? previous->renderer() : 0; 65 return previous ? previous->renderer() : 0;
65 } 66 }
66 67
67 // This function processes the renderer tree in the order of the DOM tree 68 // This function processes the renderer tree in the order of the DOM tree
68 // including pseudo elements as defined in CSS 2.1. 69 // including pseudo elements as defined in CSS 2.1.
69 static RenderObject* previousSiblingOrParent(const RenderObject* object) 70 static RenderObject* previousSiblingOrParent(const RenderObject* object)
70 { 71 {
71 Element* self = toElement(object->node()); 72 Element* self = toElement(object->node());
72 Element* previous = ElementTraversal::pseudoAwarePreviousSibling(self); 73 ASSERT(self);
74 Element* previous = ElementTraversal::pseudoAwarePreviousSibling(*self);
73 while (previous && !previous->renderer()) 75 while (previous && !previous->renderer())
74 previous = ElementTraversal::pseudoAwarePreviousSibling(previous); 76 previous = ElementTraversal::pseudoAwarePreviousSibling(*previous);
75 if (previous) 77 if (previous)
76 return previous->renderer(); 78 return previous->renderer();
77 previous = self->parentElement(); 79 previous = self->parentElement();
78 return previous ? previous->renderer() : 0; 80 return previous ? previous->renderer() : 0;
79 } 81 }
80 82
81 static inline Element* parentElement(RenderObject* object) 83 static inline Element* parentElement(RenderObject* object)
82 { 84 {
83 return toElement(object->node())->parentElement(); 85 return toElement(object->node())->parentElement();
84 } 86 }
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 fprintf(stderr, " "); 612 fprintf(stderr, " ");
611 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 613 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n",
612 current, current->node(), current->parent(), current->previousSiblin g(), 614 current, current->node(), current->parent(), current->previousSiblin g(),
613 current->nextSibling(), current->hasCounterNodeMap() ? 615 current->nextSibling(), current->hasCounterNodeMap() ?
614 counterName ? WebCore::counterMaps().get(current)->get(identifier) : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); 616 counterName ? WebCore::counterMaps().get(current)->get(identifier) : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0);
615 } 617 }
616 fflush(stderr); 618 fflush(stderr);
617 } 619 }
618 620
619 #endif // NDEBUG 621 #endif // NDEBUG
OLDNEW
« no previous file with comments | « Source/core/page/FocusController.cpp ('k') | Source/core/rendering/RenderListItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698