| 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 4549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4560 // Because we may have added some sections with already computed column
structures, we need to | 4560 // Because we may have added some sections with already computed column
structures, we need to |
| 4561 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. | 4561 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. |
| 4562 toLayoutTable(box)->forceSectionsRecalc(); | 4562 toLayoutTable(box)->forceSectionsRecalc(); |
| 4563 } else if (box->isTableSection()) { | 4563 } else if (box->isTableSection()) { |
| 4564 toLayoutTableSection(box)->setNeedsCellRecalc(); | 4564 toLayoutTableSection(box)->setNeedsCellRecalc(); |
| 4565 } | 4565 } |
| 4566 | 4566 |
| 4567 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid
ationReason::AnonymousBlockChange); | 4567 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid
ationReason::AnonymousBlockChange); |
| 4568 } | 4568 } |
| 4569 | 4569 |
| 4570 static void collapseLoneAnonymousBlockChild(LayoutObject* child) | 4570 static void collapseLoneAnonymousBlockChild(LayoutBox* parent, LayoutObject* chi
ld) |
| 4571 { | 4571 { |
| 4572 ASSERT(child); | 4572 if (!child->isAnonymousBlock() || !child->isLayoutBlockFlow()) |
| 4573 if (!child->isAnonymousBlock()) | |
| 4574 return; | 4573 return; |
| 4575 LayoutObject* parent = child->parent(); | 4574 if (!parent->isLayoutBlockFlow()) |
| 4576 if (!parent->isLayoutBlock()) | |
| 4577 return; | 4575 return; |
| 4578 LayoutBlock::collapseAnonymousBlockChild(toLayoutBlock(parent), toLayoutBloc
k(child)); | 4576 toLayoutBlockFlow(parent)->collapseAnonymousBlockChild(toLayoutBlockFlow(chi
ld)); |
| 4579 } | 4577 } |
| 4580 | 4578 |
| 4581 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) | 4579 LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) |
| 4582 { | 4580 { |
| 4583 LayoutBox* boxAtTopOfNewBranch = nullptr; | 4581 LayoutBox* boxAtTopOfNewBranch = nullptr; |
| 4584 | 4582 |
| 4585 while (beforeChild->parent() != this) { | 4583 while (beforeChild->parent() != this) { |
| 4586 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); | 4584 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); |
| 4587 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { | 4585 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { |
| 4588 | 4586 |
| 4589 // We have to split the parent box into two boxes and move children | 4587 // We have to split the parent box into two boxes and move children |
| 4590 // from |beforeChild| to end into the new post box. | 4588 // from |beforeChild| to end into the new post box. |
| 4591 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); | 4589 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); |
| 4592 postBox->setChildrenInline(boxToSplit->childrenInline()); | 4590 postBox->setChildrenInline(boxToSplit->childrenInline()); |
| 4593 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 4591 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
| 4594 // We need to invalidate the |parentBox| before inserting the new no
de | 4592 // We need to invalidate the |parentBox| before inserting the new no
de |
| 4595 // so that the table paint invalidation logic knows the structure is
dirty. | 4593 // so that the table paint invalidation logic knows the structure is
dirty. |
| 4596 // See for example LayoutTableCell:localOverflowRectForPaintInvalida
tion. | 4594 // See for example LayoutTableCell:localOverflowRectForPaintInvalida
tion. |
| 4597 markBoxForRelayoutAfterSplit(parentBox); | 4595 markBoxForRelayoutAfterSplit(parentBox); |
| 4598 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); | 4596 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); |
| 4599 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 4597 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
| 4600 | 4598 |
| 4601 LayoutObject* child = postBox->slowFirstChild(); | 4599 LayoutObject* child = postBox->slowFirstChild(); |
| 4602 ASSERT(child); | 4600 ASSERT(child); |
| 4603 if (child && !child->nextSibling()) | 4601 if (child && !child->nextSibling()) |
| 4604 collapseLoneAnonymousBlockChild(child); | 4602 collapseLoneAnonymousBlockChild(postBox, child); |
| 4605 child = boxToSplit->slowFirstChild(); | 4603 child = boxToSplit->slowFirstChild(); |
| 4606 ASSERT(child); | 4604 ASSERT(child); |
| 4607 if (child && !child->nextSibling()) | 4605 if (child && !child->nextSibling()) |
| 4608 collapseLoneAnonymousBlockChild(child); | 4606 collapseLoneAnonymousBlockChild(boxToSplit, child); |
| 4609 | 4607 |
| 4610 markBoxForRelayoutAfterSplit(boxToSplit); | 4608 markBoxForRelayoutAfterSplit(boxToSplit); |
| 4611 markBoxForRelayoutAfterSplit(postBox); | 4609 markBoxForRelayoutAfterSplit(postBox); |
| 4612 boxAtTopOfNewBranch = postBox; | 4610 boxAtTopOfNewBranch = postBox; |
| 4613 | 4611 |
| 4614 beforeChild = postBox; | 4612 beforeChild = postBox; |
| 4615 } else { | 4613 } else { |
| 4616 beforeChild = boxToSplit; | 4614 beforeChild = boxToSplit; |
| 4617 } | 4615 } |
| 4618 } | 4616 } |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4953 m_rareData->m_snapAreas->remove(&snapArea); | 4951 m_rareData->m_snapAreas->remove(&snapArea); |
| 4954 } | 4952 } |
| 4955 } | 4953 } |
| 4956 | 4954 |
| 4957 SnapAreaSet* LayoutBox::snapAreas() const | 4955 SnapAreaSet* LayoutBox::snapAreas() const |
| 4958 { | 4956 { |
| 4959 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4957 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
| 4960 } | 4958 } |
| 4961 | 4959 |
| 4962 } // namespace blink | 4960 } // namespace blink |
| OLD | NEW |