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

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

Issue 1310253005: Strip anonymous wrappers when a block flow no longer requires them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (afterChild && afterChild->isAnonymousBlock()) { 442 if (afterChild && afterChild->isAnonymousBlock()) {
443 afterChild->addChild(newChild); 443 afterChild->addChild(newChild);
444 return; 444 return;
445 } 445 }
446 446
447 if (newChild->isInline()) { 447 if (newChild->isInline()) {
448 // No suitable existing anonymous box - create a new one. 448 // No suitable existing anonymous box - create a new one.
449 LayoutBlock* newBox = createAnonymousBlock(); 449 LayoutBlock* newBox = createAnonymousBlock();
450 LayoutBox::addChild(newBox, beforeChild); 450 LayoutBox::addChild(newBox, beforeChild);
451 newBox->addChild(newChild); 451 newBox->addChild(newChild);
452 LayoutObject* nextChild = beforeChild;
453 // Reparent adjacent inline siblings to the new box.
mstensho (USE GERRIT) 2015/08/26 19:44:15 As szager has already pointed out, how could there
454 while (nextChild && (nextChild->isFloatingOrOutOfFlowPositioned() || nextChild->isInline() || nextChild->isAnonymousBlock())) {
szager1 2015/08/26 17:04:40 nextChild->isInline() should never be true here
455 LayoutObject* sibling = nextChild->nextSibling();
456 if (nextChild->isAnonymousBlock()) {
457 LayoutBlockFlow* nextBlock = toLayoutBlockFlow(nextChild);
458 nextBlock->moveAllChildrenIncludingFloatsTo(newBox, true);
459 // Delete the now-empty block's lines and nuke it.
460 nextBlock->deleteLineBoxTree();
szager1 2015/08/26 17:04:40 Redundant? nextBlock->moveAllChildrenIncludingFlo
461 nextBlock->destroy();
462 } else {
463 moveChildTo(newBox, nextChild, 0, true);
464 }
465 nextChild = sibling;
466 }
452 return; 467 return;
453 } 468 }
454 } 469 }
455 470
456 LayoutBox::addChild(newChild, beforeChild); 471 LayoutBox::addChild(newChild, beforeChild);
457 472
458 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) 473 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock())
459 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); 474 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
460 // this object may be dead here 475 // this object may be dead here
461 } 476 }
(...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2933 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2919 { 2934 {
2920 showLayoutObject(); 2935 showLayoutObject();
2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2936 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2937 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2923 } 2938 }
2924 2939
2925 #endif 2940 #endif
2926 2941
2927 } // namespace blink 2942 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698