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

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

Issue 1143323011: Notify the counter code about layout object removals BEFORE removing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutCounter.h ('k') | Source/core/layout/LayoutObjectChildList.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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // directives must occur, in which case, LayoutCounter::destroyCounterNodes( ) 461 // directives must occur, in which case, LayoutCounter::destroyCounterNodes( )
462 // must be called. 462 // must be called.
463 // The destruction of the LayoutObject (possibly caused by the removal of it s 463 // The destruction of the LayoutObject (possibly caused by the removal of it s
464 // associated DOM node) is the other case that leads to the permanent 464 // associated DOM node) is the other case that leads to the permanent
465 // destruction of all counters attached to a LayoutObject. In this case 465 // destruction of all counters attached to a LayoutObject. In this case
466 // LayoutCounter::destroyCounterNodes() must be and is now called, too. 466 // LayoutCounter::destroyCounterNodes() must be and is now called, too.
467 // LayoutCounter::destroyCounterNodes() handles destruction of the counter 467 // LayoutCounter::destroyCounterNodes() handles destruction of the counter
468 // map associated with a layoutObject, so there is no risk in leaking the ma p. 468 // map associated with a layoutObject, so there is no risk in leaking the ma p.
469 } 469 }
470 470
471 void LayoutCounter::layoutObjectRemovedFromTree(LayoutObject* layoutObject) 471 void LayoutCounter::layoutObjectSubtreeWillBeDetached(LayoutObject* layoutObject )
472 { 472 {
473 ASSERT(layoutObject->view()); 473 ASSERT(layoutObject->view());
474 if (!layoutObject->view()->hasLayoutCounters()) 474 if (!layoutObject->view()->hasLayoutCounters())
475 return; 475 return;
476 LayoutObject* currentLayoutObject = layoutObject->lastLeafChild(); 476 LayoutObject* currentLayoutObject = layoutObject->lastLeafChild();
477 if (!currentLayoutObject) 477 if (!currentLayoutObject)
478 currentLayoutObject = layoutObject; 478 currentLayoutObject = layoutObject;
479 while (true) { 479 while (true) {
480 destroyCounterNodes(*currentLayoutObject); 480 destroyCounterNodes(*currentLayoutObject);
481 if (currentLayoutObject == layoutObject) 481 if (currentLayoutObject == layoutObject)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 fprintf(stderr, " "); 598 fprintf(stderr, " ");
599 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 599 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n",
600 current, current->node(), current->parent(), current->previousSiblin g(), 600 current, current->node(), current->parent(), current->previousSiblin g(),
601 current->nextSibling(), current->hasCounterNodeMap() ? 601 current->nextSibling(), current->hasCounterNodeMap() ?
602 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0); 602 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0);
603 } 603 }
604 fflush(stderr); 604 fflush(stderr);
605 } 605 }
606 606
607 #endif // NDEBUG 607 #endif // NDEBUG
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutCounter.h ('k') | Source/core/layout/LayoutObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698