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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutCounter.cpp

Issue 2063773002: Reland: WTF: Implement explicit RefPtr::operator bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // We have a suitable counter on the EndSearchLayoutObject. 220 // We have a suitable counter on the EndSearchLayoutObject.
221 if (previousSiblingProtector) { // But we already found another counter that we come after. 221 if (previousSiblingProtector) { // But we already found another counter that we come after.
222 if (currentCounter->actsAsReset()) { 222 if (currentCounter->actsAsReset()) {
223 // We found a reset counter that is on a layoutObject th at is a sibling of ours or a parent. 223 // We found a reset counter that is on a layoutObject th at is a sibling of ours or a parent.
224 if (isReset && areLayoutObjectsElementsSiblings(*current LayoutObject, counterOwner)) { 224 if (isReset && areLayoutObjectsElementsSiblings(*current LayoutObject, counterOwner)) {
225 // We are also a reset counter and the previous rese t was on a sibling layoutObject 225 // We are also a reset counter and the previous rese t was on a sibling layoutObject
226 // hence we are the next sibling of that counter if that reset is not a root or 226 // hence we are the next sibling of that counter if that reset is not a root or
227 // we are a root node if that reset is a root. 227 // we are a root node if that reset is a root.
228 parent = currentCounter->parent(); 228 parent = currentCounter->parent();
229 previousSibling = parent ? currentCounter : nullptr; 229 previousSibling = parent ? currentCounter : nullptr;
230 return parent; 230 return parent.get();
231 } 231 }
232 // We are not a reset node or the previous reset must be on an ancestor of our owner layoutObject 232 // We are not a reset node or the previous reset must be on an ancestor of our owner layoutObject
233 // hence we must be a child of that reset counter. 233 // hence we must be a child of that reset counter.
234 parent = currentCounter; 234 parent = currentCounter;
235 // In some cases layoutObjects can be reparented (ex. no des inside a table but not in a column or row). 235 // In some cases layoutObjects can be reparented (ex. no des inside a table but not in a column or row).
236 // In these cases the identified previousSibling will be invalid as its parent is different from 236 // In these cases the identified previousSibling will be invalid as its parent is different from
237 // our identified parent. 237 // our identified parent.
238 if (previousSiblingProtector->parent() != currentCounter ) 238 if (previousSiblingProtector->parent() != currentCounter )
239 previousSiblingProtector = nullptr; 239 previousSiblingProtector = nullptr;
240 240
(...skipping 13 matching lines...) Expand all
254 } 254 }
255 } else { 255 } else {
256 // We are at the potential end of the search, but we had no previous sibling candidate 256 // We are at the potential end of the search, but we had no previous sibling candidate
257 // In this case we follow pretty much the same logic as abov e but no ASSERTs about 257 // In this case we follow pretty much the same logic as abov e but no ASSERTs about
258 // previousSibling, and when we are a sibling of the end cou nter we must set previousSibling 258 // previousSibling, and when we are a sibling of the end cou nter we must set previousSibling
259 // to currentCounter. 259 // to currentCounter.
260 if (currentCounter->actsAsReset()) { 260 if (currentCounter->actsAsReset()) {
261 if (isReset && areLayoutObjectsElementsSiblings(*current LayoutObject, counterOwner)) { 261 if (isReset && areLayoutObjectsElementsSiblings(*current LayoutObject, counterOwner)) {
262 parent = currentCounter->parent(); 262 parent = currentCounter->parent();
263 previousSibling = currentCounter; 263 previousSibling = currentCounter;
264 return parent; 264 return parent.get();
265 } 265 }
266 parent = currentCounter; 266 parent = currentCounter;
267 previousSibling = previousSiblingProtector.get(); 267 previousSibling = previousSiblingProtector.get();
268 return true; 268 return true;
269 } 269 }
270 if (!isReset || !areLayoutObjectsElementsSiblings(*currentLa youtObject, counterOwner)) { 270 if (!isReset || !areLayoutObjectsElementsSiblings(*currentLa youtObject, counterOwner)) {
271 parent = currentCounter->parent(); 271 parent = currentCounter->parent();
272 previousSibling = currentCounter; 272 previousSibling = currentCounter;
273 return true; 273 return true;
274 } 274 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 fprintf(stderr, " "); 625 fprintf(stderr, " ");
626 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 626 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n",
627 current, current->node(), current->parent(), current->previousSiblin g(), 627 current, current->node(), current->parent(), current->previousSiblin g(),
628 current->nextSibling(), current->hasCounterNodeMap() ? 628 current->nextSibling(), current->hasCounterNodeMap() ?
629 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0); 629 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0);
630 } 630 }
631 fflush(stderr); 631 fflush(stderr);
632 } 632 }
633 633
634 #endif // NDEBUG 634 #endif // NDEBUG
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/NetworkResourcesData.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698