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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 4594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4605 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 4605 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
4606 updateMinimumPageHeight(logicalOffset, childLogicalHeight); | 4606 updateMinimumPageHeight(logicalOffset, childLogicalHeight); |
4607 if (!pageLogicalHeight || childLogicalHeight > pageLogicalHeight) | 4607 if (!pageLogicalHeight || childLogicalHeight > pageLogicalHeight) |
4608 return logicalOffset; | 4608 return logicalOffset; |
4609 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset, ExcludePageBoundary); | 4609 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset, ExcludePageBoundary); |
4610 if (remainingLogicalHeight < childLogicalHeight) | 4610 if (remainingLogicalHeight < childLogicalHeight) |
4611 return logicalOffset + remainingLogicalHeight; | 4611 return logicalOffset + remainingLogicalHeight; |
4612 return logicalOffset; | 4612 return logicalOffset; |
4613 } | 4613 } |
4614 | 4614 |
4615 bool RenderBlock::pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment,
LayoutUnit logicalOffset, LayoutUnit minimumLogicalHeight) const | |
4616 { | |
4617 // FIXME: multicol will need to do some work here, when we implement support
for multiple rows. | |
4618 return false; | |
4619 } | |
4620 | |
4621 void RenderBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) | 4615 void RenderBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) |
4622 { | 4616 { |
4623 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) | 4617 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) |
4624 flowThread->setPageBreak(offsetFromLogicalTopOfFirstPage() + offset, spa
ceShortage); | 4618 flowThread->setPageBreak(offsetFromLogicalTopOfFirstPage() + offset, spa
ceShortage); |
4625 } | 4619 } |
4626 | 4620 |
4627 void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh
t) | 4621 void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh
t) |
4628 { | 4622 { |
4629 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) | 4623 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) |
4630 flowThread->updateMinimumPageHeight(offsetFromLogicalTopOfFirstPage() +
offset, minHeight); | 4624 flowThread->updateMinimumPageHeight(offsetFromLogicalTopOfFirstPage() +
offset, minHeight); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4688 // From here, the fix is not straightforward because it's not easy to al
ways determine when the current line is the first in the page. | 4682 // From here, the fix is not straightforward because it's not easy to al
ways determine when the current line is the first in the page. |
4689 return; | 4683 return; |
4690 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset, ExcludePageBoundary); | 4684 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset, ExcludePageBoundary); |
4691 | 4685 |
4692 int lineIndex = lineCount(lineBox); | 4686 int lineIndex = lineCount(lineBox); |
4693 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow()
&& lineBreakToAvoidWidow() == lineIndex)) { | 4687 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow()
&& lineBreakToAvoidWidow() == lineIndex)) { |
4694 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn
dex) { | 4688 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn
dex) { |
4695 clearShouldBreakAtLineToAvoidWidow(); | 4689 clearShouldBreakAtLineToAvoidWidow(); |
4696 setDidBreakAtLineToAvoidWidow(); | 4690 setDidBreakAtLineToAvoidWidow(); |
4697 } | 4691 } |
4698 // If we have a non-uniform page height, then we have to shift further p
ossibly. | |
4699 if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHei
ght(remainingLogicalHeight, logicalOffset, lineHeight)) | |
4700 return; | |
4701 if (lineHeight > pageLogicalHeight) { | 4692 if (lineHeight > pageLogicalHeight) { |
4702 // Split the top margin in order to avoid splitting the visible part
of the line. | 4693 // Split the top margin in order to avoid splitting the visible part
of the line. |
4703 remainingLogicalHeight -= min(lineHeight - pageLogicalHeight, max<La
youtUnit>(0, logicalVisualOverflow.y() - lineBox->lineTopWithLeading())); | 4694 remainingLogicalHeight -= min(lineHeight - pageLogicalHeight, max<La
youtUnit>(0, logicalVisualOverflow.y() - lineBox->lineTopWithLeading())); |
4704 } | 4695 } |
4705 LayoutUnit totalLogicalHeight = lineHeight + max<LayoutUnit>(0, logicalO
ffset); | 4696 LayoutUnit totalLogicalHeight = lineHeight + max<LayoutUnit>(0, logicalO
ffset); |
4706 LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ?
pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalH
eight); | 4697 LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ?
pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalH
eight); |
4707 setPageBreak(logicalOffset, lineHeight - remainingLogicalHeight); | 4698 setPageBreak(logicalOffset, lineHeight - remainingLogicalHeight); |
4708 if (((lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeigh
tAtNewOffset) || (!style()->hasAutoOrphans() && style()->orphans() >= lineIndex)
) | 4699 if (((lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeigh
tAtNewOffset) || (!style()->hasAutoOrphans() && style()->orphans() >= lineIndex)
) |
4709 && !isOutOfFlowPositioned() && !isTableCell()) | 4700 && !isOutOfFlowPositioned() && !isTableCell()) |
4710 setPaginationStrut(remainingLogicalHeight + max<LayoutUnit>(0, logic
alOffset)); | 4701 setPaginationStrut(remainingLogicalHeight + max<LayoutUnit>(0, logic
alOffset)); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4907 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4898 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
4908 { | 4899 { |
4909 showRenderObject(); | 4900 showRenderObject(); |
4910 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4901 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
4911 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4902 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
4912 } | 4903 } |
4913 | 4904 |
4914 #endif | 4905 #endif |
4915 | 4906 |
4916 } // namespace WebCore | 4907 } // namespace WebCore |
OLD | NEW |