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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 4702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 pageRemainingLogicalHeightForOffset(logicalTop, AssociateWithLatterPage); | 4713 pageRemainingLogicalHeightForOffset(logicalTop, AssociateWithLatterPage); |
4714 if (spaceLeft < logicalHeight) | 4714 if (spaceLeft < logicalHeight) |
4715 child.setOffsetToNextPage(spaceLeft); | 4715 child.setOffsetToNextPage(spaceLeft); |
4716 } | 4716 } |
4717 | 4717 |
4718 bool LayoutBox::childNeedsRelayoutForPagination(const LayoutBox& child) const { | 4718 bool LayoutBox::childNeedsRelayoutForPagination(const LayoutBox& child) const { |
4719 // TODO(mstensho): Should try to get this to work for floats too, instead of | 4719 // TODO(mstensho): Should try to get this to work for floats too, instead of |
4720 // just marking and bailing here. | 4720 // just marking and bailing here. |
4721 if (child.isFloating()) | 4721 if (child.isFloating()) |
4722 return true; | 4722 return true; |
| 4723 const LayoutFlowThread* flowThread = child.flowThreadContainingBlock(); |
4723 LayoutUnit logicalTop = child.logicalTop(); | 4724 LayoutUnit logicalTop = child.logicalTop(); |
4724 // Figure out if we really need to force re-layout of the child. We only need | 4725 // Figure out if we really need to force re-layout of the child. We only need |
4725 // to do this if there's a chance that we need to recalculate pagination | 4726 // to do this if there's a chance that we need to recalculate pagination |
4726 // struts inside. | 4727 // struts inside. |
4727 if (LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalTop)) { | 4728 if (LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalTop)) { |
4728 LayoutUnit logicalHeight = child.logicalHeightWithVisibleOverflow(); | 4729 LayoutUnit logicalHeight = child.logicalHeightWithVisibleOverflow(); |
4729 LayoutUnit remainingSpace = pageRemainingLogicalHeightForOffset( | 4730 LayoutUnit remainingSpace = pageRemainingLogicalHeightForOffset( |
4730 logicalTop, AssociateWithLatterPage); | 4731 logicalTop, AssociateWithLatterPage); |
4731 if (child.offsetToNextPage()) { | 4732 if (child.offsetToNextPage()) { |
4732 // We need to relayout unless we're going to break at the exact same | 4733 // We need to relayout unless we're going to break at the exact same |
4733 // location as before. | 4734 // location as before. |
4734 if (child.offsetToNextPage() != remainingSpace) | 4735 if (child.offsetToNextPage() != remainingSpace) |
4735 return true; | 4736 return true; |
| 4737 // If column height isn't guaranteed to be uniform, we have no way of |
| 4738 // telling what has happened after the first break. |
| 4739 if (flowThread && flowThread->mayHaveNonUniformPageLogicalHeight()) |
| 4740 return true; |
4736 } else if (logicalHeight > remainingSpace) { | 4741 } else if (logicalHeight > remainingSpace) { |
4737 // Last time we laid out this child, we didn't need to break, but now we | 4742 // Last time we laid out this child, we didn't need to break, but now we |
4738 // have to. So we need to relayout. | 4743 // have to. So we need to relayout. |
4739 return true; | 4744 return true; |
4740 } | 4745 } |
4741 } else if (child.offsetToNextPage()) { | 4746 } else if (child.offsetToNextPage()) { |
4742 // This child did previously break, but it won't anymore, because we no | 4747 // This child did previously break, but it won't anymore, because we no |
4743 // longer have a known fragmentainer height. | 4748 // longer have a known fragmentainer height. |
4744 return true; | 4749 return true; |
4745 } | 4750 } |
4746 | 4751 |
4747 // It seems that we can skip layout of this child, but we need to ask the flow | 4752 // It seems that we can skip layout of this child, but we need to ask the flow |
4748 // thread for permission first. We currently cannot skip over objects | 4753 // thread for permission first. We currently cannot skip over objects |
4749 // containing column spanners. | 4754 // containing column spanners. |
4750 LayoutFlowThread* flowThread = child.flowThreadContainingBlock(); | |
4751 return flowThread && !flowThread->canSkipLayout(child); | 4755 return flowThread && !flowThread->canSkipLayout(child); |
4752 } | 4756 } |
4753 | 4757 |
4754 void LayoutBox::markChildForPaginationRelayoutIfNeeded( | 4758 void LayoutBox::markChildForPaginationRelayoutIfNeeded( |
4755 LayoutBox& child, | 4759 LayoutBox& child, |
4756 SubtreeLayoutScope& layoutScope) { | 4760 SubtreeLayoutScope& layoutScope) { |
4757 DCHECK(!child.needsLayout()); | 4761 DCHECK(!child.needsLayout()); |
4758 LayoutState* layoutState = view()->layoutState(); | 4762 LayoutState* layoutState = view()->layoutState(); |
4759 | 4763 |
4760 if (layoutState->paginationStateChanged() || | 4764 if (layoutState->paginationStateChanged() || |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5640 LayoutRect rect = frameRect(); | 5644 LayoutRect rect = frameRect(); |
5641 | 5645 |
5642 LayoutBlock* block = containingBlock(); | 5646 LayoutBlock* block = containingBlock(); |
5643 if (block) | 5647 if (block) |
5644 block->adjustChildDebugRect(rect); | 5648 block->adjustChildDebugRect(rect); |
5645 | 5649 |
5646 return rect; | 5650 return rect; |
5647 } | 5651 } |
5648 | 5652 |
5649 } // namespace blink | 5653 } // namespace blink |
OLD | NEW |