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

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

Issue 10261009: Merge 113581 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 7 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 | « Source/WebCore/rendering/RenderBox.h ('k') | Source/WebCore/rendering/RenderObject.cpp » ('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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
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 4043 matching lines...) Expand 10 before | Expand all | Expand 10 after
4054 || style()->minHeight().isPercent() || style()->minWidth().isPercent (); 4054 || style()->minHeight().isPercent() || style()->minWidth().isPercent ();
4055 } 4055 }
4056 4056
4057 bool RenderBox::hasRelativeLogicalHeight() const 4057 bool RenderBox::hasRelativeLogicalHeight() const
4058 { 4058 {
4059 return style()->logicalHeight().isPercent() 4059 return style()->logicalHeight().isPercent()
4060 || style()->logicalMinHeight().isPercent() 4060 || style()->logicalMinHeight().isPercent()
4061 || style()->logicalMaxHeight().isPercent(); 4061 || style()->logicalMaxHeight().isPercent();
4062 } 4062 }
4063 4063
4064 void RenderBox::moveChildTo(RenderBox* toBox, RenderObject* child, RenderObject* beforeChild, bool fullRemoveInsert)
4065 {
4066 ASSERT(this == child->parent());
4067 ASSERT(!beforeChild || toBox == beforeChild->parent());
4068 if (fullRemoveInsert && toBox->isRenderBlock()) {
4069 // Takes care of adding the new child correctly if toBlock and fromBlock
4070 // have different kind of children (block vs inline).
4071 toBox->addChild(virtualChildren()->removeChildNode(this, child), beforeC hild);
4072 } else
4073 toBox->virtualChildren()->insertChildNode(toBox, virtualChildren()->remo veChildNode(this, child, fullRemoveInsert), beforeChild, fullRemoveInsert);
4074 }
4075
4076 void RenderBox::moveChildrenTo(RenderBox* toBox, RenderObject* startChild, Rende rObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert)
4077 {
4078 ASSERT(!beforeChild || toBox == beforeChild->parent());
4079 for (RenderObject* child = startChild; child && child != endChild; ) {
4080 // Save our next sibling as moveChildTo will clear it.
4081 RenderObject* nextSibling = child->nextSibling();
4082 moveChildTo(toBox, child, beforeChild, fullRemoveInsert);
4083 child = nextSibling;
4084 }
4085 }
4086
4087 static void markBoxForRelayoutAfterSplit(RenderBox* box)
4088 {
4089 // FIXME: The table code should handle that automatically. If not,
4090 // we should fix it and remove the table part checks.
4091 if (box->isTable())
4092 toRenderTable(box)->setNeedsSectionRecalc();
4093 else if (box->isTableSection())
4094 toRenderTableSection(box)->setNeedsCellRecalc();
4095
4096 box->setNeedsLayoutAndPrefWidthsRecalc();
4097 }
4098
4099 RenderObject* RenderBox::splitAnonymousBoxesAroundChild(RenderObject* beforeChil d)
4100 {
4101 bool didSplitParentAnonymousBoxes = false;
4102
4103 while (beforeChild->parent() != this) {
4104 RenderBox* boxToSplit = toRenderBox(beforeChild->parent());
4105 if (boxToSplit->firstChild() != beforeChild && boxToSplit->isAnonymous() ) {
4106 didSplitParentAnonymousBoxes = true;
4107
4108 // We have to split the parent box into two boxes and move children
4109 // from |beforeChild| to end into the new post box.
4110 RenderBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th is);
4111 postBox->setChildrenInline(boxToSplit->childrenInline());
4112 RenderBox* parentBox = toRenderBox(boxToSplit->parent());
4113 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo xToSplit->nextSibling());
4114 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, boxToSplit->hasL ayer());
4115
4116 markBoxForRelayoutAfterSplit(boxToSplit);
4117 markBoxForRelayoutAfterSplit(postBox);
4118
4119 beforeChild = postBox;
4120 } else
4121 beforeChild = boxToSplit;
4122 }
4123
4124 if (didSplitParentAnonymousBoxes)
4125 markBoxForRelayoutAfterSplit(this);
4126
4127 ASSERT(beforeChild->parent() == this);
4128 return beforeChild;
4129 }
4130
4064 } // namespace WebCore 4131 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBox.h ('k') | Source/WebCore/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698