Chromium Code Reviews| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 return; | 635 return; |
| 636 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::ChildAnonymousBlockChanged); | 636 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::ChildAnonymousBlockChanged); |
| 637 | 637 |
| 638 child->moveAllChildrenTo(parent, child->nextSibling(), child->hasLayer()); | 638 child->moveAllChildrenTo(parent, child->nextSibling(), child->hasLayer()); |
| 639 parent->setChildrenInline(child->childrenInline()); | 639 parent->setChildrenInline(child->childrenInline()); |
| 640 | 640 |
| 641 parent->children()->removeChildNode(parent, child, child->hasLayer()); | 641 parent->children()->removeChildNode(parent, child, child->hasLayer()); |
| 642 child->destroy(); | 642 child->destroy(); |
| 643 } | 643 } |
| 644 | 644 |
| 645 static inline bool shouldMakeChildrenInline(const LayoutBlock* block) | 645 void LayoutBlock::makeChildrenInlineIfPossible() |
| 646 { | 646 { |
| 647 if (!block->isLayoutBlockFlow()) | 647 if (!isLayoutBlockFlow() || isRubyRun()) |
|
mstensho (USE GERRIT)
2015/10/22 19:19:57
Where does the ruby check come from? Do we have a
| |
| 648 return false; | 648 return; |
| 649 LayoutObject* child = block->firstChild(); | 649 Vector<LayoutBox*, 16> blocksToRemove; |
|
mstensho (USE GERRIT)
2015/10/22 19:19:58
How many anonymous blocks can we possibly find her
| |
| 650 LayoutObject* child = firstChild(); | |
| 650 while (child) { | 651 while (child) { |
| 651 // TODO(rhogan): If we encounter anonymous blocks with inline children w e should fold them in here. | 652 if (child->isAnonymousBlock() && child->childrenInline()) |
| 652 if (!child->isFloatingOrOutOfFlowPositioned()) | 653 blocksToRemove.append(toLayoutBox(child)); |
| 653 return false; | 654 else if (!child->isFloatingOrOutOfFlowPositioned()) |
| 655 return; | |
| 654 child = child->nextSibling(); | 656 child = child->nextSibling(); |
| 655 } | 657 } |
| 656 return true; | 658 for (size_t i = 0; i < blocksToRemove.size(); i++) |
| 659 collapseAnonymousBlockChild(this, toLayoutBlock(blocksToRemove[i])); | |
|
mstensho (USE GERRIT)
2015/10/22 19:19:58
Looks like blocksToRemove should hold LayoutBlock
| |
| 660 setChildrenInline(true); | |
| 657 } | 661 } |
| 658 | 662 |
| 659 void LayoutBlock::removeChild(LayoutObject* oldChild) | 663 void LayoutBlock::removeChild(LayoutObject* oldChild) |
| 660 { | 664 { |
| 661 // No need to waste time in merging or removing empty anonymous blocks. | 665 // No need to waste time in merging or removing empty anonymous blocks. |
| 662 // We can just bail out if our document is getting destroyed. | 666 // We can just bail out if our document is getting destroyed. |
| 663 if (documentBeingDestroyed()) { | 667 if (documentBeingDestroyed()) { |
| 664 LayoutBox::removeChild(oldChild); | 668 LayoutBox::removeChild(oldChild); |
| 665 return; | 669 return; |
| 666 } | 670 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 751 else if (curr->isLayoutBlock()) | 755 else if (curr->isLayoutBlock()) |
| 752 toLayoutBlock(curr)->setContinuation(nextContinuation); | 756 toLayoutBlock(curr)->setContinuation(nextContinuation); |
| 753 else | 757 else |
| 754 ASSERT_NOT_REACHED(); | 758 ASSERT_NOT_REACHED(); |
| 755 | 759 |
| 756 break; | 760 break; |
| 757 } | 761 } |
| 758 setContinuation(nullptr); | 762 setContinuation(nullptr); |
| 759 destroy(); | 763 destroy(); |
| 760 } | 764 } |
| 761 } else if (!beingDestroyed() && !oldChild->isFloatingOrOutOfFlowPositioned() && shouldMakeChildrenInline(this)) { | 765 } else if (!beingDestroyed() && !oldChild->isFloatingOrOutOfFlowPositioned() ) { |
| 762 // If the child we're removing means that we can now treat all children as inline without the need for anonymous blocks, then do that. | 766 // If the child we're removing means that we can now treat all children as inline without the need for anonymous blocks, then do that. |
| 763 setChildrenInline(true); | 767 makeChildrenInlineIfPossible(); |
| 764 } | 768 } |
| 765 } | 769 } |
| 766 | 770 |
| 767 bool LayoutBlock::isSelfCollapsingBlock() const | 771 bool LayoutBlock::isSelfCollapsingBlock() const |
| 768 { | 772 { |
| 769 // We are not self-collapsing if we | 773 // We are not self-collapsing if we |
| 770 // (a) have a non-zero height according to layout (an optimization to avoid wasting time) | 774 // (a) have a non-zero height according to layout (an optimization to avoid wasting time) |
| 771 // (b) are a table, | 775 // (b) are a table, |
| 772 // (c) have border/padding, | 776 // (c) have border/padding, |
| 773 // (d) have a min-height | 777 // (d) have a min-height |
| (...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2876 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const | 2880 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const |
| 2877 { | 2881 { |
| 2878 showLayoutObject(); | 2882 showLayoutObject(); |
| 2879 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 2883 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
| 2880 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 2884 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
| 2881 } | 2885 } |
| 2882 | 2886 |
| 2883 #endif | 2887 #endif |
| 2884 | 2888 |
| 2885 } // namespace blink | 2889 } // namespace blink |
| OLD | NEW |