| 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 4356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) | 4375 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) |
| 4376 { | 4376 { |
| 4377 bool didSplitParentAnonymousBoxes = false; | 4377 LayoutBox* boxAtTopOfNewBranch = nullptr; |
| 4378 | 4378 |
| 4379 while (beforeChild->parent() != this) { | 4379 while (beforeChild->parent() != this) { |
| 4380 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); | 4380 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); |
| 4381 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { | 4381 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { |
| 4382 didSplitParentAnonymousBoxes = true; | |
| 4383 | 4382 |
| 4384 // We have to split the parent box into two boxes and move children | 4383 // We have to split the parent box into two boxes and move children |
| 4385 // from |beforeChild| to end into the new post box. | 4384 // from |beforeChild| to end into the new post box. |
| 4386 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); | 4385 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); |
| 4387 postBox->setChildrenInline(boxToSplit->childrenInline()); | 4386 postBox->setChildrenInline(boxToSplit->childrenInline()); |
| 4388 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 4387 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
| 4389 // We need to invalidate the |parentBox| before inserting the new no
de | 4388 // 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. | 4389 // so that the table paint invalidation logic knows the structure is
dirty. |
| 4391 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali
dation. | 4390 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali
dation. |
| 4392 markBoxForRelayoutAfterSplit(parentBox); | 4391 markBoxForRelayoutAfterSplit(parentBox); |
| 4393 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); | 4392 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); |
| 4394 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 4393 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
| 4395 | 4394 |
| 4396 markBoxForRelayoutAfterSplit(boxToSplit); | 4395 markBoxForRelayoutAfterSplit(boxToSplit); |
| 4397 markBoxForRelayoutAfterSplit(postBox); | 4396 markBoxForRelayoutAfterSplit(postBox); |
| 4397 boxAtTopOfNewBranch = postBox; |
| 4398 | 4398 |
| 4399 beforeChild = postBox; | 4399 beforeChild = postBox; |
| 4400 } else { | 4400 } else { |
| 4401 beforeChild = boxToSplit; | 4401 beforeChild = boxToSplit; |
| 4402 } | 4402 } |
| 4403 } | 4403 } |
| 4404 | 4404 |
| 4405 if (didSplitParentAnonymousBoxes) | 4405 // Splitting the box means the left side of the container chain will lose an
y percent height descendants |
| 4406 // below |boxAtTopOfNewBranch| on the right hand side. |
| 4407 if (boxAtTopOfNewBranch) { |
| 4408 boxAtTopOfNewBranch->clearPercentHeightDescendants(); |
| 4406 markBoxForRelayoutAfterSplit(this); | 4409 markBoxForRelayoutAfterSplit(this); |
| 4410 } |
| 4407 | 4411 |
| 4408 ASSERT(beforeChild->parent() == this); | 4412 ASSERT(beforeChild->parent() == this); |
| 4409 return beforeChild; | 4413 return beforeChild; |
| 4410 } | 4414 } |
| 4411 | 4415 |
| 4412 LayoutUnit LayoutBox::offsetFromLogicalTopOfFirstPage() const | 4416 LayoutUnit LayoutBox::offsetFromLogicalTopOfFirstPage() const |
| 4413 { | 4417 { |
| 4414 LayoutState* layoutState = view()->layoutState(); | 4418 LayoutState* layoutState = view()->layoutState(); |
| 4415 if (!layoutState || !layoutState->isPaginated()) | 4419 if (!layoutState || !layoutState->isPaginated()) |
| 4416 return LayoutUnit(); | 4420 return LayoutUnit(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4633 | 4637 |
| 4634 void LayoutBox::clearPercentHeightDescendants() | 4638 void LayoutBox::clearPercentHeightDescendants() |
| 4635 { | 4639 { |
| 4636 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4640 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
| 4637 if (curr->isBox()) | 4641 if (curr->isBox()) |
| 4638 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4642 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
| 4639 } | 4643 } |
| 4640 } | 4644 } |
| 4641 | 4645 |
| 4642 } // namespace blink | 4646 } // namespace blink |
| OLD | NEW |