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

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

Issue 10546039: Merge 119409 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 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
« no previous file with comments | « LayoutTests/fast/multicol/span/positioned-objects-not-removed-crash-expected.txt ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // Hook |clone| up as the continuation of the middle block. 594 // Hook |clone| up as the continuation of the middle block.
595 if (!cloneBlock->isAnonymousBlock()) 595 if (!cloneBlock->isAnonymousBlock())
596 middleBlock->setContinuation(cloneBlock); 596 middleBlock->setContinuation(cloneBlock);
597 597
598 // We have been reparented and are now under the fromBlock. We need 598 // We have been reparented and are now under the fromBlock. We need
599 // to walk up our block parent chain until we hit the containing anonymous c olumns block. 599 // to walk up our block parent chain until we hit the containing anonymous c olumns block.
600 // Once we hit the anonymous columns block we're done. 600 // Once we hit the anonymous columns block we're done.
601 RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); 601 RenderBoxModelObject* curr = toRenderBoxModelObject(parent());
602 RenderBoxModelObject* currChild = this; 602 RenderBoxModelObject* currChild = this;
603 RenderObject* currChildNextSibling = currChild->nextSibling(); 603 RenderObject* currChildNextSibling = currChild->nextSibling();
604 604 bool documentUsesBeforeAfterRules = document()->usesBeforeAfterRules();
605
606 // Note: |this| can be destroyed inside this loop if it is an empty anonymou s
607 // block and we try to call updateBeforeAfterContent inside which removes th e
608 // generated content and additionally cleans up |this| empty anonymous block .
609 // See RenderBlock::removeChild(). DO NOT reference any local variables to | this|
610 // after this point.
605 while (curr && curr != fromBlock) { 611 while (curr && curr != fromBlock) {
606 ASSERT(curr->isRenderBlock()); 612 ASSERT(curr->isRenderBlock());
607 613
608 RenderBlock* blockCurr = toRenderBlock(curr); 614 RenderBlock* blockCurr = toRenderBlock(curr);
609 615
610 // Create a new clone. 616 // Create a new clone.
611 RenderBlock* cloneChild = cloneBlock; 617 RenderBlock* cloneChild = cloneBlock;
612 cloneBlock = blockCurr->clone(); 618 cloneBlock = blockCurr->clone();
613 619
614 // Insert our child clone as the first child. 620 // Insert our child clone as the first child.
615 cloneBlock->addChildIgnoringContinuation(cloneChild, 0); 621 cloneBlock->addChildIgnoringContinuation(cloneChild, 0);
616 622
617 // Hook the clone up as a continuation of |curr|. Note we do encounter 623 // Hook the clone up as a continuation of |curr|. Note we do encounter
618 // anonymous blocks possibly as we walk up the block chain. When we spl it an 624 // anonymous blocks possibly as we walk up the block chain. When we spl it an
619 // anonymous block, there's no need to do any continuation hookup, since we haven't 625 // anonymous block, there's no need to do any continuation hookup, since we haven't
620 // actually split a real element. 626 // actually split a real element.
621 if (!blockCurr->isAnonymousBlock()) { 627 if (!blockCurr->isAnonymousBlock()) {
622 oldCont = blockCurr->continuation(); 628 oldCont = blockCurr->continuation();
623 blockCurr->setContinuation(cloneBlock); 629 blockCurr->setContinuation(cloneBlock);
624 cloneBlock->setContinuation(oldCont); 630 cloneBlock->setContinuation(oldCont);
625 } 631 }
626 632
627 // Someone may have indirectly caused a <q> to split. When this happens , the :after content 633 // Someone may have indirectly caused a <q> to split. When this happens , the :after content
628 // has to move into the inline continuation. Call updateBeforeAfterCont ent to ensure that the inline's :after 634 // has to move into the inline continuation. Call updateBeforeAfterCont ent to ensure that the inline's :after
629 // content gets properly destroyed. 635 // content gets properly destroyed.
630 bool isLastChild = (currChildNextSibling == blockCurr->lastChild()); 636 bool isLastChild = (currChildNextSibling == blockCurr->lastChild());
631 if (document()->usesBeforeAfterRules()) 637 if (documentUsesBeforeAfterRules)
632 blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER); 638 blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER);
633 if (isLastChild && currChildNextSibling != blockCurr->lastChild()) 639 if (isLastChild && currChildNextSibling != blockCurr->lastChild())
634 currChildNextSibling = 0; // We destroyed the last child, so now we need to update 640 currChildNextSibling = 0; // We destroyed the last child, so now we need to update
635 // the value of currChildNextSibling. 641 // the value of currChildNextSibling.
636 642
637 // It is possible that positioned objects under blockCurr are going to b e moved to cloneBlock. 643 // It is possible that positioned objects under blockCurr are going to b e moved to cloneBlock.
638 // Since we are doing layout anyway, it is easier to blow away the entir e list, than 644 // Since we are doing layout anyway, it is easier to blow away the entir e list, than
639 // traversing down the subtree looking for positioned children and then remove them 645 // traversing down the subtree looking for positioned children and then remove them
640 // from our positioned objects list. 646 // from our positioned objects list.
641 if (currChildNextSibling) 647 blockCurr->removePositionedObjects(0);
642 blockCurr->removePositionedObjects(0);
643 648
644 // Now we need to take all of the children starting from the first child 649 // Now we need to take all of the children starting from the first child
645 // *after* currChild and append them all to the clone. 650 // *after* currChild and append them all to the clone.
646 blockCurr->moveChildrenTo(cloneBlock, currChildNextSibling, 0, true); 651 blockCurr->moveChildrenTo(cloneBlock, currChildNextSibling, 0, true);
647 652
648 // Keep walking up the chain. 653 // Keep walking up the chain.
649 currChild = curr; 654 currChild = curr;
650 currChildNextSibling = currChild->nextSibling(); 655 currChildNextSibling = currChild->nextSibling();
651 curr = toRenderBoxModelObject(curr->parent()); 656 curr = toRenderBoxModelObject(curr->parent());
652 } 657 }
(...skipping 6739 matching lines...) Expand 10 before | Expand all | Expand 10 after
7392 } 7397 }
7393 7398
7394 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 7399 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
7395 { 7400 {
7396 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pi xelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX (), floatingObject->pixelSnappedMaxY()); 7401 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pi xelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX (), floatingObject->pixelSnappedMaxY());
7397 } 7402 }
7398 7403
7399 #endif 7404 #endif
7400 7405
7401 } // namespace WebCore 7406 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/multicol/span/positioned-objects-not-removed-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698