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

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

Issue 8048004: Merge 95054 - Source/WebCore: Fixes several bugs when adding CounterNodes to a tree which can cau... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 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
« no previous file with comments | « Source/WebCore/rendering/CounterNode.cpp ('k') | no next file » | 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // We are also a reset counter and the previous rese t was on a sibling renderer 316 // We are also a reset counter and the previous rese t was on a sibling renderer
317 // hence we are the next sibling of that counter if that reset is not a root or 317 // hence we are the next sibling of that counter if that reset is not a root or
318 // we are a root node if that reset is a root. 318 // we are a root node if that reset is a root.
319 parent = currentCounter->parent(); 319 parent = currentCounter->parent();
320 previousSibling = parent ? currentCounter : 0; 320 previousSibling = parent ? currentCounter : 0;
321 return parent; 321 return parent;
322 } 322 }
323 // We are not a reset node or the previous reset must be on an ancestor of our owner renderer 323 // We are not a reset node or the previous reset must be on an ancestor of our owner renderer
324 // hence we must be a child of that reset counter. 324 // hence we must be a child of that reset counter.
325 parent = currentCounter; 325 parent = currentCounter;
326 ASSERT(previousSibling->parent() == currentCounter); 326 // In some cases renders can be reparented (ex. nodes in side a table but not in a column or row).
327 // In these cases the identified previousSibling will be invalid as its parent is different from
328 // our identified parent.
329 if (previousSibling->parent() != currentCounter)
330 previousSibling = 0;
327 return true; 331 return true;
328 } 332 }
329 // CurrentCounter, the counter at the EndSearchRenderer, is not reset. 333 // CurrentCounter, the counter at the EndSearchRenderer, is not reset.
330 if (!isReset || !areRenderersElementsSiblings(currentRendere r, counterOwner)) { 334 if (!isReset || !areRenderersElementsSiblings(currentRendere r, counterOwner)) {
331 // If the node we are placing is not reset or we have fo und a counter that is attached 335 // If the node we are placing is not reset or we have fo und a counter that is attached
332 // to an ancestor of the placed counter's owner renderer we know we are a sibling of that node. 336 // to an ancestor of the placed counter's owner renderer we know we are a sibling of that node.
333 ASSERT(currentCounter->parent() == previousSibling->pare nt()); 337 ASSERT(currentCounter->parent() == previousSibling->pare nt());
334 parent = currentCounter->parent(); 338 parent = currentCounter->parent();
335 return true; 339 return true;
336 } 340 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 Element* stayWithin = parentElement(object); 436 Element* stayWithin = parentElement(object);
433 bool skipDescendants; 437 bool skipDescendants;
434 for (RenderObject* currentRenderer = nextInPreOrder(object, stayWithin); cur rentRenderer; currentRenderer = nextInPreOrder(currentRenderer, stayWithin, skip Descendants)) { 438 for (RenderObject* currentRenderer = nextInPreOrder(object, stayWithin); cur rentRenderer; currentRenderer = nextInPreOrder(currentRenderer, stayWithin, skip Descendants)) {
435 skipDescendants = false; 439 skipDescendants = false;
436 if (!currentRenderer->m_hasCounterNodeMap) 440 if (!currentRenderer->m_hasCounterNodeMap)
437 continue; 441 continue;
438 CounterNode* currentCounter = maps.get(currentRenderer)->get(identifier. impl()).get(); 442 CounterNode* currentCounter = maps.get(currentRenderer)->get(identifier. impl()).get();
439 if (!currentCounter) 443 if (!currentCounter)
440 continue; 444 continue;
441 skipDescendants = true; 445 skipDescendants = true;
442 if (currentCounter->parent()) { 446 if (currentCounter->parent())
443 ASSERT(newNode->firstChild());
444 continue; 447 continue;
445 }
446 if (stayWithin == parentElement(currentRenderer) && currentCounter->hasR esetType()) 448 if (stayWithin == parentElement(currentRenderer) && currentCounter->hasR esetType())
447 break; 449 break;
448 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier); 450 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier);
449 } 451 }
450 return newNode.get(); 452 return newNode.get();
451 } 453 }
452 454
453 RenderCounter::RenderCounter(Document* node, const CounterContent& counter) 455 RenderCounter::RenderCounter(Document* node, const CounterContent& counter)
454 : RenderText(node, StringImpl::empty()) 456 : RenderText(node, StringImpl::empty())
455 , m_counter(counter) 457 , m_counter(counter)
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 fprintf(stderr, " "); 705 fprintf(stderr, " ");
704 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 706 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n",
705 current, current->node(), current->parent(), current->previousSiblin g(), 707 current, current->node(), current->parent(), current->previousSiblin g(),
706 current->nextSibling(), current->m_hasCounterNodeMap? 708 current->nextSibling(), current->m_hasCounterNodeMap?
707 counterName ? WebCore::counterMaps().get(current)->get(identifier.im pl()).get() : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); 709 counterName ? WebCore::counterMaps().get(current)->get(identifier.im pl()).get() : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0);
708 } 710 }
709 fflush(stderr); 711 fflush(stderr);
710 } 712 }
711 713
712 #endif // NDEBUG 714 #endif // NDEBUG
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/CounterNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698