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

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

Issue 554075: Merge 53525 - Bug 33266 WebCore::InlineFlowBox::determineSpacingForFlowBoxes... (Closed) Base URL: svn://chrome-svn/chrome/branches/WebKit/249s/
Patch Set: Created 10 years, 11 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
« no previous file with comments | « WebCore/rendering/RenderBlock.h ('k') | WebCore/rendering/RenderRubyBase.h » ('j') | 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 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 toChildList->appendChildNode(to, children()->removeChildNode(this, child, fa lse), false); 403 toChildList->appendChildNode(to, children()->removeChildNode(this, child, fa lse), false);
404 } 404 }
405 405
406 void RenderBlock::moveChildTo(RenderObject* to, RenderObjectChildList* toChildLi st, RenderObject* beforeChild, RenderObject* child) 406 void RenderBlock::moveChildTo(RenderObject* to, RenderObjectChildList* toChildLi st, RenderObject* beforeChild, RenderObject* child)
407 { 407 {
408 ASSERT(this == child->parent()); 408 ASSERT(this == child->parent());
409 ASSERT(!beforeChild || to == beforeChild->parent()); 409 ASSERT(!beforeChild || to == beforeChild->parent());
410 toChildList->insertChildNode(to, children()->removeChildNode(this, child, fa lse), beforeChild, false); 410 toChildList->insertChildNode(to, children()->removeChildNode(this, child, fa lse), beforeChild, false);
411 } 411 }
412 412
413 void RenderBlock::moveAllChildrenTo(RenderObject* to, RenderObjectChildList* toC hildList)
414 {
415 RenderObject* nextChild = children()->firstChild();
416 while (nextChild) {
417 RenderObject* child = nextChild;
418 nextChild = child->nextSibling();
419 toChildList->appendChildNode(to, children()->removeChildNode(this, child , false), false);
420 }
421 }
422
423 void RenderBlock::moveAllChildrenTo(RenderObject* to, RenderObjectChildList* toC hildList, RenderObject* beforeChild)
424 {
425 ASSERT(!beforeChild || to == beforeChild->parent());
426 if (!beforeChild) {
427 moveAllChildrenTo(to, toChildList);
428 return;
429 }
430 RenderObject* nextChild = children()->firstChild();
431 while (nextChild) {
432 RenderObject* child = nextChild;
433 nextChild = child->nextSibling();
434 toChildList->insertChildNode(to, children()->removeChildNode(this, child , false), beforeChild, false);
435 }
436 }
437
413 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) 438 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
414 { 439 {
415 // makeChildrenNonInline takes a block whose children are *all* inline and i t 440 // makeChildrenNonInline takes a block whose children are *all* inline and i t
416 // makes sure that inline children are coalesced under anonymous 441 // makes sure that inline children are coalesced under anonymous
417 // blocks. If |insertionPoint| is defined, then it represents the insertion point for 442 // blocks. If |insertionPoint| is defined, then it represents the insertion point for
418 // the new block child that is causing us to have to wrap all the inlines. This 443 // the new block child that is causing us to have to wrap all the inlines. This
419 // means that we cannot coalesce inlines before |insertionPoint| with inline s following 444 // means that we cannot coalesce inlines before |insertionPoint| with inline s following
420 // |insertionPoint|, because the new child is going to be inserted in betwee n the inlines, 445 // |insertionPoint|, because the new child is going to be inserted in betwee n the inlines,
421 // splitting them. 446 // splitting them.
422 ASSERT(isInlineBlockOrInlineTable() || !isInline()); 447 ASSERT(isInlineBlockOrInlineTable() || !isInline());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 RenderObject* prev = oldChild->previousSibling(); 534 RenderObject* prev = oldChild->previousSibling();
510 RenderObject* next = oldChild->nextSibling(); 535 RenderObject* next = oldChild->nextSibling();
511 bool canDeleteAnonymousBlocks = !documentBeingDestroyed() && !isInline() && !oldChild->isInline() && 536 bool canDeleteAnonymousBlocks = !documentBeingDestroyed() && !isInline() && !oldChild->isInline() &&
512 (!oldChild->isRenderBlock() || !toRenderBloc k(oldChild)->inlineContinuation()) && 537 (!oldChild->isRenderBlock() || !toRenderBloc k(oldChild)->inlineContinuation()) &&
513 (!prev || (prev->isAnonymousBlock() && prev- >childrenInline())) && 538 (!prev || (prev->isAnonymousBlock() && prev- >childrenInline())) &&
514 (!next || (next->isAnonymousBlock() && next- >childrenInline())); 539 (!next || (next->isAnonymousBlock() && next- >childrenInline()));
515 if (canDeleteAnonymousBlocks && prev && next) { 540 if (canDeleteAnonymousBlocks && prev && next) {
516 // Take all the children out of the |next| block and put them in 541 // Take all the children out of the |next| block and put them in
517 // the |prev| block. 542 // the |prev| block.
518 prev->setNeedsLayoutAndPrefWidthsRecalc(); 543 prev->setNeedsLayoutAndPrefWidthsRecalc();
519 RenderObject* o = next->firstChild();
520
521 RenderBlock* nextBlock = toRenderBlock(next); 544 RenderBlock* nextBlock = toRenderBlock(next);
522 RenderBlock* prevBlock = toRenderBlock(prev); 545 RenderBlock* prevBlock = toRenderBlock(prev);
523 while (o) { 546 nextBlock->moveAllChildrenTo(prevBlock, prevBlock->children());
524 RenderObject* no = o; 547 // Delete the now-empty block's lines and nuke it.
525 o = no->nextSibling();
526 nextBlock->moveChildTo(prevBlock, prevBlock->children(), no);
527 }
528
529 nextBlock->deleteLineBoxTree(); 548 nextBlock->deleteLineBoxTree();
530 549 nextBlock->destroy();
531 // Nuke the now-empty block.
532 next->destroy();
533 } 550 }
534 551
535 RenderBox::removeChild(oldChild); 552 RenderBox::removeChild(oldChild);
536 553
537 RenderObject* child = prev ? prev : next; 554 RenderObject* child = prev ? prev : next;
538 if (canDeleteAnonymousBlocks && child && !child->previousSibling() && !child ->nextSibling() && !isFlexibleBox()) { 555 if (canDeleteAnonymousBlocks && child && !child->previousSibling() && !child ->nextSibling() && !isFlexibleBox()) {
539 // The removal has knocked us down to containing only a single anonymous 556 // The removal has knocked us down to containing only a single anonymous
540 // box. We can go ahead and pull the content right back up into our 557 // box. We can go ahead and pull the content right back up into our
541 // box. 558 // box.
542 setNeedsLayoutAndPrefWidthsRecalc(); 559 setNeedsLayoutAndPrefWidthsRecalc();
543 RenderBlock* anonBlock = toRenderBlock(children()->removeChildNode(this, child, false)); 560 RenderBlock* anonBlock = toRenderBlock(children()->removeChildNode(this, child, false));
544 setChildrenInline(true); 561 setChildrenInline(true);
545 RenderObject* o = anonBlock->firstChild(); 562 anonBlock->moveAllChildrenTo(this, children());
546 while (o) {
547 RenderObject* no = o;
548 o = no->nextSibling();
549 anonBlock->moveChildTo(this, children(), no);
550 }
551
552 // Delete the now-empty block's lines and nuke it. 563 // Delete the now-empty block's lines and nuke it.
553 anonBlock->deleteLineBoxTree(); 564 anonBlock->deleteLineBoxTree();
554 anonBlock->destroy(); 565 anonBlock->destroy();
555 } 566 }
556 } 567 }
557 568
558 bool RenderBlock::isSelfCollapsingBlock() const 569 bool RenderBlock::isSelfCollapsingBlock() const
559 { 570 {
560 // We are not self-collapsing if we 571 // We are not self-collapsing if we
561 // (a) have a non-zero height according to layout (an optimization to avoid wasting time) 572 // (a) have a non-zero height according to layout (an optimization to avoid wasting time)
(...skipping 4482 matching lines...) Expand 10 before | Expand all | Expand 10 after
5044 else if (isAnonymous()) 5055 else if (isAnonymous())
5045 return "RenderBlock (generated)"; 5056 return "RenderBlock (generated)";
5046 if (isRelPositioned()) 5057 if (isRelPositioned())
5047 return "RenderBlock (relative positioned)"; 5058 return "RenderBlock (relative positioned)";
5048 if (isRunIn()) 5059 if (isRunIn())
5049 return "RenderBlock (run-in)"; 5060 return "RenderBlock (run-in)";
5050 return "RenderBlock"; 5061 return "RenderBlock";
5051 } 5062 }
5052 5063
5053 } // namespace WebCore 5064 } // namespace WebCore
OLDNEW
« no previous file with comments | « WebCore/rendering/RenderBlock.h ('k') | WebCore/rendering/RenderRubyBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698