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

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

Issue 1360753002: Only block container children support pagination struts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: code review 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
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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 // line, and we don't want to move all that, since it has already been e stablished that it 774 // line, and we don't want to move all that, since it has already been e stablished that it
775 // fits nicely where it is. 775 // fits nicely where it is.
776 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading(); 776 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading();
777 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset); 777 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset);
778 LayoutUnit pageLogicalHeightAtNewOffset = block.pageLogicalHeightForOffs et(lineLogicalOffset + remainingLogicalHeight); 778 LayoutUnit pageLogicalHeightAtNewOffset = block.pageLogicalHeightForOffs et(lineLogicalOffset + remainingLogicalHeight);
779 // It's rather pointless to break before the block if the current line i sn't going to 779 // It's rather pointless to break before the block if the current line i sn't going to
780 // fit in the same column or page, so check that as well. 780 // fit in the same column or page, so check that as well.
781 if (totalLogicalHeight < pageLogicalHeightAtNewOffset) 781 if (totalLogicalHeight < pageLogicalHeightAtNewOffset)
782 wantsStrutOnBlock = true; 782 wantsStrutOnBlock = true;
783 } 783 }
784 // If we want to break before the block, one final check is needed, since so me block object 784 // The block needs to be contained by a LayoutBlockFlow (and not by e.g. a f lexbox or a table
785 // types cannot handle struts. 785 // (which would be the case for table cell or table caption)). The reason fo r this limitation is
786 return wantsStrutOnBlock && !block.isOutOfFlowPositioned() && !block.isTable Cell(); 786 // simply that LayoutBlockFlow child layout code is the only place where we pick up the struts
787 // and handle them. We handle floats and regular in-flow children, and that' s all. We could
788 // handle this in other layout modes as well (and even for out-of-flow child ren), but currently
789 // we don't.
790 if (!wantsStrutOnBlock || block.isOutOfFlowPositioned())
791 return false;
792 LayoutBlock* containingBlock = block.containingBlock();
793 return containingBlock && containingBlock->isLayoutBlockFlow();
787 } 794 }
788 795
789 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta) 796 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta)
790 { 797 {
791 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as 798 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as
792 // the rest of the line, possibly overflowing the column. We currently only allow overflow above 799 // the rest of the line, possibly overflowing the column. We currently only allow overflow above
793 // the first column. We clip at all other column boundaries, and that's how it has to be for 800 // the first column. We clip at all other column boundaries, and that's how it has to be for
794 // now. The paint we have to do when a column has overflow has to be special . We need to exclude 801 // now. The paint we have to do when a column has overflow has to be special . We need to exclude
795 // content that paints in a previous column (and content that paints in the following column). 802 // content that paints in a previous column (and content that paints in the following column).
796 // 803 //
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 FrameView* frameView = document().view(); 3084 FrameView* frameView = document().view();
3078 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3085 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3079 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3086 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3080 if (size().height() < visibleHeight) 3087 if (size().height() < visibleHeight)
3081 top += (visibleHeight - size().height()) / 2; 3088 top += (visibleHeight - size().height()) / 2;
3082 setY(top); 3089 setY(top);
3083 dialog->setCentered(top); 3090 dialog->setCentered(top);
3084 } 3091 }
3085 3092
3086 } // namespace blink 3093 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/multicol/table-caption-and-cells-fixed-width-expected.html ('k') | Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698