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

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

Issue 1573133002: Need to examine the *bottom* of fragmented content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Slim down the patch; back out columnSetAtBlockOffset() changes. This was already broken prior to th… Created 4 years, 11 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
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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 paginationStrut += logicalTop + marginBeforeIfFloating(); 714 paginationStrut += logicalTop + marginBeforeIfFloating();
715 setPaginationStrutPropagatedFromChild(paginationStrut); 715 setPaginationStrutPropagatedFromChild(paginationStrut);
716 if (childBlockFlow) 716 if (childBlockFlow)
717 childBlockFlow->setPaginationStrutPropagatedFromChild(LayoutUnit ()); 717 childBlockFlow->setPaginationStrutPropagatedFromChild(LayoutUnit ());
718 } else { 718 } else {
719 child.setPaginationStrut(paginationStrut); 719 child.setPaginationStrut(paginationStrut);
720 newLogicalTop += paginationStrut; 720 newLogicalTop += paginationStrut;
721 } 721 }
722 } 722 }
723 723
724 paginatedContentWasLaidOut(newLogicalTop); 724 paginatedContentWasLaidOut(newLogicalTop + child.logicalHeight());
725 725
726 // Similar to how we apply clearance. Go ahead and boost height() to be the place where we're going to position the child. 726 // Similar to how we apply clearance. Go ahead and boost height() to be the place where we're going to position the child.
727 setLogicalHeight(logicalHeight() + (newLogicalTop - logicalTop)); 727 setLogicalHeight(logicalHeight() + (newLogicalTop - logicalTop));
728 728
729 // Return the final adjusted logical top. 729 // Return the final adjusted logical top.
730 return newLogicalTop; 730 return newLogicalTop;
731 } 731 }
732 732
733 static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline Box& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit pageLogica lHeight) 733 static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline Box& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit pageLogica lHeight)
734 { 734 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (!pageLogicalHeight) 774 if (!pageLogicalHeight)
775 return; 775 return;
776 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage); 776 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage);
777 int lineIndex = lineCount(&lineBox); 777 int lineIndex = lineCount(&lineBox);
778 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) { 778 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) {
779 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logica lOffset, remainingLogicalHeight, lineHeight); 779 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logica lOffset, remainingLogicalHeight, lineHeight);
780 LayoutUnit newLogicalOffset = logicalOffset + paginationStrut; 780 LayoutUnit newLogicalOffset = logicalOffset + paginationStrut;
781 // The new offset may require us to insert a new row for columns (fragme ntainer group). 781 // The new offset may require us to insert a new row for columns (fragme ntainer group).
782 // Give the multicol machinery an opportunity to do so (before checking the height of a 782 // Give the multicol machinery an opportunity to do so (before checking the height of a
783 // column that wouldn't have existed yet otherwise). 783 // column that wouldn't have existed yet otherwise).
784 paginatedContentWasLaidOut(newLogicalOffset); 784 paginatedContentWasLaidOut(newLogicalOffset + lineHeight);
785 // Moving to a different page or column may mean that its height is diff erent. 785 // Moving to a different page or column may mean that its height is diff erent.
786 pageLogicalHeight = pageLogicalHeightForOffset(newLogicalOffset); 786 pageLogicalHeight = pageLogicalHeightForOffset(newLogicalOffset);
787 if (lineHeight > pageLogicalHeight) { 787 if (lineHeight > pageLogicalHeight) {
788 // Too tall to fit in one page / column. Give up. Don't push to the next page / column. 788 // Too tall to fit in one page / column. Give up. Don't push to the next page / column.
789 // TODO(mstensho): Get rid of this. This is just utter weirdness, bu t the other browsers 789 // TODO(mstensho): Get rid of this. This is just utter weirdness, bu t the other browsers
790 // also do something slightly similar, although in much more specifi c cases than we do here, 790 // also do something slightly similar, although in much more specifi c cases than we do here,
791 // and printing Google Docs depends on it. 791 // and printing Google Docs depends on it.
792 return; 792 return;
793 } 793 }
794 794
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 LayoutUnit strut = remainingLogicalHeight + totalLogicalOffset - pageLog icalHeight; 835 LayoutUnit strut = remainingLogicalHeight + totalLogicalOffset - pageLog icalHeight;
836 if (strut > 0) { 836 if (strut > 0) {
837 // The block starts in a previous column or page. Set a strut on the block if there's 837 // The block starts in a previous column or page. Set a strut on the block if there's
838 // room for the top border, padding and (if it's a float) margin and the line in one 838 // room for the top border, padding and (if it's a float) margin and the line in one
839 // column or page. 839 // column or page.
840 if (totalLogicalOffset + lineHeight <= pageLogicalHeight) 840 if (totalLogicalOffset + lineHeight <= pageLogicalHeight)
841 setPaginationStrutPropagatedFromChild(strut); 841 setPaginationStrutPropagatedFromChild(strut);
842 } 842 }
843 } 843 }
844 844
845 paginatedContentWasLaidOut(logicalOffset); 845 paginatedContentWasLaidOut(logicalOffset + lineHeight);
846 } 846 }
847 847
848 LayoutUnit LayoutBlockFlow::adjustForUnsplittableChild(LayoutBox& child, LayoutU nit logicalOffset) const 848 LayoutUnit LayoutBlockFlow::adjustForUnsplittableChild(LayoutBox& child, LayoutU nit logicalOffset) const
849 { 849 {
850 if (child.paginationBreakability() == AllowAnyBreaks) 850 if (child.paginationBreakability() == AllowAnyBreaks)
851 return logicalOffset; 851 return logicalOffset;
852 LayoutUnit childLogicalHeight = logicalHeightForChild(child); 852 LayoutUnit childLogicalHeight = logicalHeightForChild(child);
853 // Floats' margins do not collapse with page or column boundaries. 853 // Floats' margins do not collapse with page or column boundaries.
854 if (child.isFloating()) 854 if (child.isFloating())
855 childLogicalHeight += marginBeforeForChild(child) + marginAfterForChild( child); 855 childLogicalHeight += marginBeforeForChild(child) + marginAfterForChild( child);
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 FrameView* frameView = document().view(); 3124 FrameView* frameView = document().view();
3125 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3125 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3126 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3126 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3127 if (size().height() < visibleHeight) 3127 if (size().height() < visibleHeight)
3128 top += (visibleHeight - size().height()) / 2; 3128 top += (visibleHeight - size().height()) / 2;
3129 setY(top); 3129 setY(top);
3130 dialog->setCentered(top); 3130 dialog->setCentered(top);
3131 } 3131 }
3132 3132
3133 } // namespace blink 3133 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698