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 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4365 // Because we may have added some sections with already computed column structures, we need to | 4365 // Because we may have added some sections with already computed column structures, we need to |
4366 // sync the table structure with them now. This avoids crashes when addi ng new cells to the table. | 4366 // sync the table structure with them now. This avoids crashes when addi ng new cells to the table. |
4367 toLayoutTable(box)->forceSectionsRecalc(); | 4367 toLayoutTable(box)->forceSectionsRecalc(); |
4368 } else if (box->isTableSection()) { | 4368 } else if (box->isTableSection()) { |
4369 toLayoutTableSection(box)->setNeedsCellRecalc(); | 4369 toLayoutTableSection(box)->setNeedsCellRecalc(); |
4370 } | 4370 } |
4371 | 4371 |
4372 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid ationReason::AnonymousBlockChange); | 4372 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid ationReason::AnonymousBlockChange); |
4373 } | 4373 } |
4374 | 4374 |
4375 static void collapseLoneAnonymousBlockChild(LayoutObject* child) | |
4376 { | |
4377 ASSERT(child); | |
4378 if (!child->isAnonymousBlock()) | |
4379 return; | |
4380 LayoutObject* parent = child->parent(); | |
4381 if (!parent->isLayoutBlock()) | |
4382 return; | |
4383 LayoutBlock::collapseAnonymousBlockChild(toLayoutBlock(parent), toLayoutBloc k(child)); | |
4384 } | |
4385 | |
4375 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil d) | 4386 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil d) |
4376 { | 4387 { |
4377 bool didSplitParentAnonymousBoxes = false; | 4388 bool didSplitParentAnonymousBoxes = false; |
4378 | 4389 |
4379 while (beforeChild->parent() != this) { | 4390 while (beforeChild->parent() != this) { |
4380 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); | 4391 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); |
4381 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo us()) { | 4392 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo us()) { |
4382 didSplitParentAnonymousBoxes = true; | 4393 didSplitParentAnonymousBoxes = true; |
4383 | 4394 |
4384 // We have to split the parent box into two boxes and move children | 4395 // We have to split the parent box into two boxes and move children |
4385 // from |beforeChild| to end into the new post box. | 4396 // from |beforeChild| to end into the new post box. |
4386 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th is); | 4397 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th is); |
4387 postBox->setChildrenInline(boxToSplit->childrenInline()); | 4398 postBox->setChildrenInline(boxToSplit->childrenInline()); |
4388 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 4399 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
4389 // We need to invalidate the |parentBox| before inserting the new no de | 4400 // We need to invalidate the |parentBox| before inserting the new no de |
4390 // so that the table paint invalidation logic knows the structure is dirty. | 4401 // so that the table paint invalidation logic knows the structure is dirty. |
4391 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali dation. | 4402 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali dation. |
4392 markBoxForRelayoutAfterSplit(parentBox); | 4403 markBoxForRelayoutAfterSplit(parentBox); |
4393 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo xToSplit->nextSibling()); | 4404 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo xToSplit->nextSibling()); |
4394 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 4405 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
4395 | 4406 |
4407 LayoutObject* child = postBox->slowFirstChild(); | |
4408 if (child && !child->nextSibling()) | |
4409 collapseLoneAnonymousBlockChild(child); | |
4410 child = boxToSplit->slowFirstChild(); | |
mstensho (USE GERRIT)
2016/02/01 12:25:36
Could ASSERT(child) here (and above) instead of "i
rhogan
2016/02/02 21:38:25
True. I think we should ASSERT and null check thou
| |
4411 if (child && !child->previousSibling()) | |
4412 collapseLoneAnonymousBlockChild(child); | |
4413 | |
4396 markBoxForRelayoutAfterSplit(boxToSplit); | 4414 markBoxForRelayoutAfterSplit(boxToSplit); |
4397 markBoxForRelayoutAfterSplit(postBox); | 4415 markBoxForRelayoutAfterSplit(postBox); |
4398 | 4416 |
4399 beforeChild = postBox; | 4417 beforeChild = postBox; |
4400 } else { | 4418 } else { |
4401 beforeChild = boxToSplit; | 4419 beforeChild = boxToSplit; |
4402 } | 4420 } |
4403 } | 4421 } |
4404 | 4422 |
4405 if (didSplitParentAnonymousBoxes) | 4423 if (didSplitParentAnonymousBoxes) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4633 | 4651 |
4634 void LayoutBox::clearPercentHeightDescendants() | 4652 void LayoutBox::clearPercentHeightDescendants() |
4635 { | 4653 { |
4636 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { | 4654 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { |
4637 if (curr->isBox()) | 4655 if (curr->isBox()) |
4638 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4656 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
4639 } | 4657 } |
4640 } | 4658 } |
4641 | 4659 |
4642 } // namespace blink | 4660 } // namespace blink |
OLD | NEW |