Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: Source/core/layout/LayoutBlockFlow.cpp

Issue 1221803003: Behave more normally for content taller than the fragmentainer it's in. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Manually rebaseline fast/repaint/multicol-with-text. Get rid of platform-specific expectations. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 // line and all following lines. 768 // line and all following lines.
769 LayoutRect logicalVisualOverflow = lineBox.logicalVisualOverflowRect(lineBox .lineTop(), lineBox.lineBottom()); 769 LayoutRect logicalVisualOverflow = lineBox.logicalVisualOverflowRect(lineBox .lineTop(), lineBox.lineBottom());
770 LayoutUnit logicalOffset = std::min(lineBox.lineTopWithLeading(), logicalVis ualOverflow.y()); 770 LayoutUnit logicalOffset = std::min(lineBox.lineTopWithLeading(), logicalVis ualOverflow.y());
771 LayoutUnit logicalBottom = std::max(lineBox.lineBottomWithLeading(), logical VisualOverflow.maxY()); 771 LayoutUnit logicalBottom = std::max(lineBox.lineBottomWithLeading(), logical VisualOverflow.maxY());
772 LayoutUnit lineHeight = logicalBottom - logicalOffset; 772 LayoutUnit lineHeight = logicalBottom - logicalOffset;
773 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(styleRef() , &lineBox, logicalOffset, logicalBottom)); 773 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(styleRef() , &lineBox, logicalOffset, logicalBottom));
774 logicalOffset += delta; 774 logicalOffset += delta;
775 lineBox.setPaginationStrut(0); 775 lineBox.setPaginationStrut(0);
776 lineBox.setIsFirstAfterPageBreak(false); 776 lineBox.setIsFirstAfterPageBreak(false);
777 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 777 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
778 bool hasUniformPageLogicalHeight = !flowThread || flowThread->columnSetsHave UniformLogicalHeight(); 778 if (!pageLogicalHeight)
779 // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflo w.height() still fits, we are
780 // still going to add a strut, so that the visible overflow fits on a single page.
781 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverf low.height() > pageLogicalHeight)) {
782 // FIXME: In case the line aligns with the top of the page (or it's slig htly shifted downwards) it will not be marked as the first line in the page.
783 // 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.
784 return; 779 return;
785 }
786 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary); 780 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary);
787 781
788 int lineIndex = lineCount(&lineBox); 782 int lineIndex = lineCount(&lineBox);
789 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) { 783 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) {
790 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn dex) { 784 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn dex) {
791 clearShouldBreakAtLineToAvoidWidow(); 785 clearShouldBreakAtLineToAvoidWidow();
792 setDidBreakAtLineToAvoidWidow(); 786 setDidBreakAtLineToAvoidWidow();
793 } 787 }
794 if (lineHeight > pageLogicalHeight) { 788 if (lineHeight > pageLogicalHeight) {
795 // Split the top margin in order to avoid splitting the visible part of the line. 789 // Split the top margin in order to avoid splitting the visible part of the line.
796 remainingLogicalHeight -= std::min(lineHeight - pageLogicalHeight, s td::max<LayoutUnit>(0, logicalVisualOverflow.y() - lineBox.lineTopWithLeading()) ); 790 remainingLogicalHeight -= std::min(lineHeight - pageLogicalHeight, s td::max<LayoutUnit>(0, logicalVisualOverflow.y() - lineBox.lineTopWithLeading()) );
797 } 791 }
798 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, log icalOffset); 792 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, log icalOffset);
799 LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalH eight); 793 LayoutUnit pageLogicalHeightAtNewOffset = pageLogicalHeightForOffset(log icalOffset + remainingLogicalHeight);
800 setPageBreak(logicalOffset, lineHeight - remainingLogicalHeight); 794 setPageBreak(logicalOffset, lineHeight - remainingLogicalHeight);
801 if (((lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeigh tAtNewOffset) || (!style()->hasAutoOrphans() && style()->orphans() >= lineIndex) ) 795 if (((lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeigh tAtNewOffset) || (!style()->hasAutoOrphans() && style()->orphans() >= lineIndex) )
802 && !isOutOfFlowPositioned() && !isTableCell()) { 796 && !isOutOfFlowPositioned() && !isTableCell()) {
803 setPaginationStrut(remainingLogicalHeight + std::max<LayoutUnit>(0, logicalOffset)); 797 setPaginationStrut(remainingLogicalHeight + std::max<LayoutUnit>(0, logicalOffset));
804 } else { 798 } else {
805 delta += remainingLogicalHeight; 799 delta += remainingLogicalHeight;
806 lineBox.setPaginationStrut(remainingLogicalHeight); 800 lineBox.setPaginationStrut(remainingLogicalHeight);
807 lineBox.setIsFirstAfterPageBreak(true); 801 lineBox.setIsFirstAfterPageBreak(true);
808 } 802 }
809 } else if (remainingLogicalHeight == pageLogicalHeight) { 803 } else if (remainingLogicalHeight == pageLogicalHeight) {
810 // We're at the very top of a page or column. 804 // We're at the very top of a page or column.
811 if (lineBox != firstRootBox()) 805 if (lineBox != firstRootBox())
812 lineBox.setIsFirstAfterPageBreak(true); 806 lineBox.setIsFirstAfterPageBreak(true);
813 if (lineBox != firstRootBox() || offsetFromLogicalTopOfFirstPage()) 807 if (lineBox != firstRootBox() || offsetFromLogicalTopOfFirstPage())
814 setPageBreak(logicalOffset, lineHeight); 808 setPageBreak(logicalOffset, lineHeight);
815 } 809 }
816 } 810 }
817 811
818 LayoutUnit LayoutBlockFlow::adjustForUnsplittableChild(LayoutBox& child, LayoutU nit logicalOffset, bool includeMargins) 812 LayoutUnit LayoutBlockFlow::adjustForUnsplittableChild(LayoutBox& child, LayoutU nit logicalOffset, bool includeMargins)
819 { 813 {
820 bool checkColumnBreaks = flowThreadContainingBlock(); 814 bool checkColumnBreaks = flowThreadContainingBlock();
821 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); 815 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight();
822 bool isUnsplittable = child.isUnsplittableForPagination() || (checkColumnBre aks && child.style()->columnBreakInside() == PBAVOID) 816 bool isUnsplittable = child.isUnsplittableForPagination() || (checkColumnBre aks && child.style()->columnBreakInside() == PBAVOID)
823 || (checkPageBreaks && child.style()->pageBreakInside() == PBAVOID); 817 || (checkPageBreaks && child.style()->pageBreakInside() == PBAVOID);
824 if (!isUnsplittable) 818 if (!isUnsplittable)
825 return logicalOffset; 819 return logicalOffset;
826 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit()); 820 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit());
827 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 821 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
828 updateMinimumPageHeight(logicalOffset, childLogicalHeight); 822 updateMinimumPageHeight(logicalOffset, childLogicalHeight);
829 if (!pageLogicalHeight || childLogicalHeight > pageLogicalHeight) 823 if (!pageLogicalHeight)
830 return logicalOffset; 824 return logicalOffset;
831 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary); 825 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary);
832 if (remainingLogicalHeight < childLogicalHeight) 826 if (remainingLogicalHeight < childLogicalHeight)
833 return logicalOffset + remainingLogicalHeight; 827 return logicalOffset + remainingLogicalHeight;
834 return logicalOffset; 828 return logicalOffset;
835 } 829 }
836 830
837 void LayoutBlockFlow::rebuildFloatsFromIntruding() 831 void LayoutBlockFlow::rebuildFloatsFromIntruding()
838 { 832 {
839 if (m_floatingObjects) 833 if (m_floatingObjects)
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 FrameView* frameView = document().view(); 3072 FrameView* frameView = document().view();
3079 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3073 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3080 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3074 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3081 if (size().height() < visibleHeight) 3075 if (size().height() < visibleHeight)
3082 top += (visibleHeight - size().height()) / 2; 3076 top += (visibleHeight - size().height()) / 2;
3083 setY(top); 3077 setY(top);
3084 dialog->setCentered(top); 3078 dialog->setCentered(top);
3085 } 3079 }
3086 3080
3087 } // namespace blink 3081 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/platform/win/fast/repaint/multicol-with-text-expected.txt ('k') | Source/core/layout/LayoutFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698