| OLD | NEW |
| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 if (child->parent()->isLayoutGrid()) | 483 if (child->parent()->isLayoutGrid()) |
| 484 toLayoutGrid(child->parent())->dirtyGrid(); | 484 toLayoutGrid(child->parent())->dirtyGrid(); |
| 485 | 485 |
| 486 // Now remove the leftover anonymous block from the tree, and destroy it. We
'll rip it out | 486 // Now remove the leftover anonymous block from the tree, and destroy it. We
'll rip it out |
| 487 // manually from the tree before destroying it, because we don't want to tri
gger any tree | 487 // manually from the tree before destroying it, because we don't want to tri
gger any tree |
| 488 // adjustments with regards to anonymous blocks (or any other kind of undesi
red chain-reaction). | 488 // adjustments with regards to anonymous blocks (or any other kind of undesi
red chain-reaction). |
| 489 children()->removeChildNode(this, child, false); | 489 children()->removeChildNode(this, child, false); |
| 490 child->destroy(); | 490 child->destroy(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void LayoutBlock::makeChildrenInlineIfPossible() | |
| 494 { | |
| 495 ASSERT(isLayoutBlockFlow()); | |
| 496 // Collapsing away anonymous wrappers isn't relevant for the children of ano
nymous blocks, unless they are ruby bases. | |
| 497 if (isAnonymousBlock() && !isRubyBase()) | |
| 498 return; | |
| 499 | |
| 500 Vector<LayoutBlock*, 3> blocksToRemove; | |
| 501 for (LayoutObject* child = firstChild(); child; child = child->nextSibling()
) { | |
| 502 if (child->isFloating()) | |
| 503 continue; | |
| 504 if (child->isOutOfFlowPositioned()) | |
| 505 continue; | |
| 506 | |
| 507 // There are still block children in the container, so any anonymous wra
ppers are still needed. | |
| 508 if (!child->isAnonymousBlock()) | |
| 509 return; | |
| 510 // If one of the children is being destroyed then it is unsafe to clean
up anonymous wrappers as the | |
| 511 // entire branch may be being destroyed. | |
| 512 if (toLayoutBlock(child)->beingDestroyed()) | |
| 513 return; | |
| 514 // We can't remove anonymous wrappers if they contain continuations as t
his means there are block children present. | |
| 515 if (toLayoutBlock(child)->continuation()) | |
| 516 return; | |
| 517 // We are only interested in removing anonymous wrappers if there are in
line siblings underneath them. | |
| 518 if (!child->childrenInline()) | |
| 519 return; | |
| 520 // Ruby elements use anonymous wrappers for ruby runs and ruby bases by
design, so we don't remove them. | |
| 521 if (child->isRubyRun() || child->isRubyBase()) | |
| 522 return; | |
| 523 | |
| 524 blocksToRemove.append(toLayoutBlock(child)); | |
| 525 } | |
| 526 | |
| 527 // If we make an object's children inline we are going to frustrate any futu
re attempts to remove | |
| 528 // floats from its children's float-lists before the next layout happens so
clear down all the floatlists | |
| 529 // now - they will be rebuilt at layout. | |
| 530 toLayoutBlockFlow(this)->removeFloatingObjectsFromDescendants(); | |
| 531 | |
| 532 for (size_t i = 0; i < blocksToRemove.size(); i++) | |
| 533 collapseAnonymousBlockChild(this, blocksToRemove[i]); | |
| 534 setChildrenInline(true); | |
| 535 } | |
| 536 | |
| 537 void LayoutBlock::collapseAnonymousBlockChild(LayoutBlock* parent, LayoutBlock*
child) | 493 void LayoutBlock::collapseAnonymousBlockChild(LayoutBlock* parent, LayoutBlock*
child) |
| 538 { | 494 { |
| 539 if (!parent->canCollapseAnonymousBlockChild()) | 495 if (!parent->canCollapseAnonymousBlockChild()) |
| 540 return; | 496 return; |
| 541 // It's possible that this block's destruction may have been triggered by th
e | 497 // It's possible that this block's destruction may have been triggered by th
e |
| 542 // child's removal. Just bail if the anonymous child block is already being | 498 // child's removal. Just bail if the anonymous child block is already being |
| 543 // destroyed. See crbug.com/282088 | 499 // destroyed. See crbug.com/282088 |
| 544 if (child->beingDestroyed()) | 500 if (child->beingDestroyed()) |
| 545 return; | 501 return; |
| 546 if (child->continuation()) | 502 if (child->continuation()) |
| (...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 2079 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
| 2124 LayoutBox* currBox = *it; | 2080 LayoutBox* currBox = *it; |
| 2125 ASSERT(!currBox->needsLayout()); | 2081 ASSERT(!currBox->needsLayout()); |
| 2126 } | 2082 } |
| 2127 } | 2083 } |
| 2128 } | 2084 } |
| 2129 | 2085 |
| 2130 #endif | 2086 #endif |
| 2131 | 2087 |
| 2132 } // namespace blink | 2088 } // namespace blink |
| OLD | NEW |