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) 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 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 4357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4368 // Because we may have added some sections with already computed column
structures, we need to | 4368 // Because we may have added some sections with already computed column
structures, we need to |
4369 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. | 4369 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. |
4370 toLayoutTable(box)->forceSectionsRecalc(); | 4370 toLayoutTable(box)->forceSectionsRecalc(); |
4371 } else if (box->isTableSection()) { | 4371 } else if (box->isTableSection()) { |
4372 toLayoutTableSection(box)->setNeedsCellRecalc(); | 4372 toLayoutTableSection(box)->setNeedsCellRecalc(); |
4373 } | 4373 } |
4374 | 4374 |
4375 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid
ationReason::AnonymousBlockChange); | 4375 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid
ationReason::AnonymousBlockChange); |
4376 } | 4376 } |
4377 | 4377 |
| 4378 static void collapseLoneAnonymousBlockChild(LayoutObject* child) |
| 4379 { |
| 4380 ASSERT(child); |
| 4381 if (!child->isAnonymousBlock()) |
| 4382 return; |
| 4383 LayoutObject* parent = child->parent(); |
| 4384 if (!parent->isLayoutBlock()) |
| 4385 return; |
| 4386 LayoutBlock::collapseAnonymousBlockChild(toLayoutBlock(parent), toLayoutBloc
k(child)); |
| 4387 } |
| 4388 |
4378 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) | 4389 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) |
4379 { | 4390 { |
4380 LayoutBox* boxAtTopOfNewBranch = nullptr; | 4391 LayoutBox* boxAtTopOfNewBranch = nullptr; |
4381 | 4392 |
4382 while (beforeChild->parent() != this) { | 4393 while (beforeChild->parent() != this) { |
4383 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); | 4394 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); |
4384 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { | 4395 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { |
4385 | 4396 |
4386 // We have to split the parent box into two boxes and move children | 4397 // We have to split the parent box into two boxes and move children |
4387 // from |beforeChild| to end into the new post box. | 4398 // from |beforeChild| to end into the new post box. |
4388 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); | 4399 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); |
4389 postBox->setChildrenInline(boxToSplit->childrenInline()); | 4400 postBox->setChildrenInline(boxToSplit->childrenInline()); |
4390 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 4401 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
4391 // We need to invalidate the |parentBox| before inserting the new no
de | 4402 // We need to invalidate the |parentBox| before inserting the new no
de |
4392 // so that the table paint invalidation logic knows the structure is
dirty. | 4403 // so that the table paint invalidation logic knows the structure is
dirty. |
4393 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali
dation. | 4404 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali
dation. |
4394 markBoxForRelayoutAfterSplit(parentBox); | 4405 markBoxForRelayoutAfterSplit(parentBox); |
4395 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); | 4406 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); |
4396 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 4407 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
4397 | 4408 |
| 4409 LayoutObject* child = postBox->slowFirstChild(); |
| 4410 ASSERT(child); |
| 4411 if (child && !child->nextSibling()) |
| 4412 collapseLoneAnonymousBlockChild(child); |
| 4413 child = boxToSplit->slowFirstChild(); |
| 4414 ASSERT(child); |
| 4415 if (child && !child->previousSibling()) |
| 4416 collapseLoneAnonymousBlockChild(child); |
| 4417 |
4398 markBoxForRelayoutAfterSplit(boxToSplit); | 4418 markBoxForRelayoutAfterSplit(boxToSplit); |
4399 markBoxForRelayoutAfterSplit(postBox); | 4419 markBoxForRelayoutAfterSplit(postBox); |
4400 boxAtTopOfNewBranch = postBox; | 4420 boxAtTopOfNewBranch = postBox; |
4401 | 4421 |
4402 beforeChild = postBox; | 4422 beforeChild = postBox; |
4403 } else { | 4423 } else { |
4404 beforeChild = boxToSplit; | 4424 beforeChild = boxToSplit; |
4405 } | 4425 } |
4406 } | 4426 } |
4407 | 4427 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4640 | 4660 |
4641 void LayoutBox::clearPercentHeightDescendants() | 4661 void LayoutBox::clearPercentHeightDescendants() |
4642 { | 4662 { |
4643 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4663 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
4644 if (curr->isBox()) | 4664 if (curr->isBox()) |
4645 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4665 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
4646 } | 4666 } |
4647 } | 4667 } |
4648 | 4668 |
4649 } // namespace blink | 4669 } // namespace blink |
OLD | NEW |