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

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

Issue 1318653004: Never move unbreakable blocks that are at the top of a column / page. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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
« no previous file with comments | « LayoutTests/fast/multicol/unbreakable-block-too-tall-at-column-start-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 bool isUnsplittable = child.isUnsplittableForPagination() || (checkColumnBre aks && child.style()->columnBreakInside() == PBAVOID) 847 bool isUnsplittable = child.isUnsplittableForPagination() || (checkColumnBre aks && child.style()->columnBreakInside() == PBAVOID)
848 || (checkPageBreaks && child.style()->pageBreakInside() == PBAVOID); 848 || (checkPageBreaks && child.style()->pageBreakInside() == PBAVOID);
849 if (!isUnsplittable) 849 if (!isUnsplittable)
850 return logicalOffset; 850 return logicalOffset;
851 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit()); 851 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit());
852 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 852 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
853 updateMinimumPageHeight(logicalOffset, childLogicalHeight); 853 updateMinimumPageHeight(logicalOffset, childLogicalHeight);
854 if (!pageLogicalHeight) 854 if (!pageLogicalHeight)
855 return logicalOffset; 855 return logicalOffset;
856 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage); 856 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage);
857 if (remainingLogicalHeight < childLogicalHeight) 857 // Break if there's not enough space left for us, but only as long as we're not already at the
858 // top of a page. No point in leaving a page completely blank.
859 if (remainingLogicalHeight < childLogicalHeight && remainingLogicalHeight < pageLogicalHeight)
858 return logicalOffset + remainingLogicalHeight; 860 return logicalOffset + remainingLogicalHeight;
859 return logicalOffset; 861 return logicalOffset;
860 } 862 }
861 863
862 void LayoutBlockFlow::rebuildFloatsFromIntruding() 864 void LayoutBlockFlow::rebuildFloatsFromIntruding()
863 { 865 {
864 if (m_floatingObjects) 866 if (m_floatingObjects)
865 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); 867 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
866 868
867 HashSet<LayoutBox*> oldIntrudingFloatSet; 869 HashSet<LayoutBox*> oldIntrudingFloatSet;
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 FrameView* frameView = document().view(); 3069 FrameView* frameView = document().view();
3068 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3070 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3069 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3071 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3070 if (size().height() < visibleHeight) 3072 if (size().height() < visibleHeight)
3071 top += (visibleHeight - size().height()) / 2; 3073 top += (visibleHeight - size().height()) / 2;
3072 setY(top); 3074 setY(top);
3073 dialog->setCentered(top); 3075 dialog->setCentered(top);
3074 } 3076 }
3075 3077
3076 } // namespace blink 3078 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/multicol/unbreakable-block-too-tall-at-column-start-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698