OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 LayoutUnit logicalOffset = std::min(lineBox.lineTopWithLeading(), logicalVis
ualOverflow.y()); | 771 LayoutUnit logicalOffset = std::min(lineBox.lineTopWithLeading(), logicalVis
ualOverflow.y()); |
772 LayoutUnit logicalBottom = std::max(lineBox.lineBottomWithLeading(), logical
VisualOverflow.maxY()); | 772 LayoutUnit logicalBottom = std::max(lineBox.lineBottomWithLeading(), logical
VisualOverflow.maxY()); |
773 LayoutUnit lineHeight = logicalBottom - logicalOffset; | 773 LayoutUnit lineHeight = logicalBottom - logicalOffset; |
774 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(styleRef()
, &lineBox, logicalOffset, logicalBottom)); | 774 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(styleRef()
, &lineBox, logicalOffset, logicalBottom)); |
775 logicalOffset += delta; | 775 logicalOffset += delta; |
776 lineBox.setPaginationStrut(0); | 776 lineBox.setPaginationStrut(0); |
777 lineBox.setIsFirstAfterPageBreak(false); | 777 lineBox.setIsFirstAfterPageBreak(false); |
778 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 778 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
779 if (!pageLogicalHeight) | 779 if (!pageLogicalHeight) |
780 return; | 780 return; |
| 781 if (lineHeight > pageLogicalHeight) { |
| 782 // Too tall to fit in one page / column. Give up. Don't push to the next
page / column. |
| 783 // TODO(mstensho): Get rid of this. This is just utter weirdness, but th
e other browsers |
| 784 // also do something slightly similar, although in much more specific ca
ses than we do here, |
| 785 // and printing Google Docs depends on it. |
| 786 return; |
| 787 } |
781 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset, ExcludePageBoundary); | 788 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset, ExcludePageBoundary); |
782 | 789 |
783 int lineIndex = lineCount(&lineBox); | 790 int lineIndex = lineCount(&lineBox); |
784 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow()
&& lineBreakToAvoidWidow() == lineIndex)) { | 791 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow()
&& lineBreakToAvoidWidow() == lineIndex)) { |
785 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn
dex) { | 792 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn
dex) { |
786 clearShouldBreakAtLineToAvoidWidow(); | 793 clearShouldBreakAtLineToAvoidWidow(); |
787 setDidBreakAtLineToAvoidWidow(); | 794 setDidBreakAtLineToAvoidWidow(); |
788 } | 795 } |
789 if (lineHeight > pageLogicalHeight) { | 796 if (lineHeight > pageLogicalHeight) { |
790 // Split the top margin in order to avoid splitting the visible part
of the line. | 797 // Split the top margin in order to avoid splitting the visible part
of the line. |
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 FrameView* frameView = document().view(); | 3074 FrameView* frameView = document().view(); |
3068 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3075 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
3069 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3076 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
3070 if (size().height() < visibleHeight) | 3077 if (size().height() < visibleHeight) |
3071 top += (visibleHeight - size().height()) / 2; | 3078 top += (visibleHeight - size().height()) / 2; |
3072 setY(top); | 3079 setY(top); |
3073 dialog->setCentered(top); | 3080 dialog->setCentered(top); |
3074 } | 3081 } |
3075 | 3082 |
3076 } // namespace blink | 3083 } // namespace blink |
OLD | NEW |