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

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

Issue 1428063009: Fix off-by-one (or off-by-one-sixtyfourth) error when checking what a column can hold. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/first-line-in-block-with-padding-exact-fit-expected.txt ('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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // or column, rather than keeping a content-less portion of it in the pr evious one. Only do 749 // or column, rather than keeping a content-less portion of it in the pr evious one. Only do
750 // this if the line is flush with the content edge of the block, though. If it isn't, it 750 // this if the line is flush with the content edge of the block, though. If it isn't, it
751 // means that the line was pushed downwards by preceding floats that did n't fit beside the 751 // means that the line was pushed downwards by preceding floats that did n't fit beside the
752 // line, and we don't want to move all that, since it has already been e stablished that it 752 // line, and we don't want to move all that, since it has already been e stablished that it
753 // fits nicely where it is. 753 // fits nicely where it is.
754 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading(); 754 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading();
755 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset); 755 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset);
756 LayoutUnit pageLogicalHeightAtNewOffset = block.pageLogicalHeightForOffs et(lineLogicalOffset + remainingLogicalHeight); 756 LayoutUnit pageLogicalHeightAtNewOffset = block.pageLogicalHeightForOffs et(lineLogicalOffset + remainingLogicalHeight);
757 // It's rather pointless to break before the block if the current line i sn't going to 757 // It's rather pointless to break before the block if the current line i sn't going to
758 // fit in the same column or page, so check that as well. 758 // fit in the same column or page, so check that as well.
759 if (totalLogicalHeight < pageLogicalHeightAtNewOffset) 759 if (totalLogicalHeight <= pageLogicalHeightAtNewOffset)
760 wantsStrutOnBlock = true; 760 wantsStrutOnBlock = true;
761 } 761 }
762 return wantsStrutOnBlock && block.allowsPaginationStrut(); 762 return wantsStrutOnBlock && block.allowsPaginationStrut();
763 } 763 }
764 764
765 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta) 765 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta)
766 { 766 {
767 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as 767 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as
768 // the rest of the line, possibly overflowing the column. We currently only allow overflow above 768 // the rest of the line, possibly overflowing the column. We currently only allow overflow above
769 // the first column. We clip at all other column boundaries, and that's how it has to be for 769 // the first column. We clip at all other column boundaries, and that's how it has to be for
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 FrameView* frameView = document().view(); 3061 FrameView* frameView = document().view();
3062 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3062 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3063 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3063 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3064 if (size().height() < visibleHeight) 3064 if (size().height() < visibleHeight)
3065 top += (visibleHeight - size().height()) / 2; 3065 top += (visibleHeight - size().height()) / 2;
3066 setY(top); 3066 setY(top);
3067 dialog->setCentered(top); 3067 dialog->setCentered(top);
3068 } 3068 }
3069 3069
3070 } // namespace blink 3070 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/first-line-in-block-with-padding-exact-fit-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698