Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 // If we want to break before the block, one final check is needed, since so me block object |
|
leviw_travelin_and_unemployed
2015/09/22 17:20:31
This is no longer one final check, and is really t
mstensho (USE GERRIT)
2015/09/22 18:11:50
I shuffled things around a little bit, hopefully t
| |
| 785 // types cannot handle struts. | 785 // types cannot handle struts. |
| 786 return wantsStrutOnBlock && !block.isOutOfFlowPositioned() && !block.isTable Cell(); | 786 if (!wantsStrutOnBlock) |
| 787 return false; | |
| 788 if (block.isOutOfFlowPositioned()) | |
|
leviw_travelin_and_unemployed
2015/09/22 17:20:31
Combine this with the above?
mstensho (USE GERRIT)
2015/09/22 18:11:50
Done.
| |
| 789 return false; | |
| 790 // The block needs to be contained by a block container (and not e.g. a flex box, or a table | |
| 791 // (which would be the case if the block is a table cell or table caption)). The reason for | |
| 792 // this limitation is simply that block container child layout code is the o nly place where we | |
|
leviw_travelin_and_unemployed
2015/09/22 17:20:31
as you imply in your description, block container
mstensho (USE GERRIT)
2015/09/22 18:11:50
Yeah, "block container" is CSS sp33k. Changing to
| |
| 793 // pick up the struts and handle them. We could do so in other layout modes as well, but | |
| 794 // currently we don't. | |
| 795 LayoutBlock* containingBlock = block.containingBlock(); | |
| 796 return containingBlock && containingBlock->isLayoutBlockFlow(); | |
| 787 } | 797 } |
| 788 | 798 |
| 789 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta) | 799 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta) |
| 790 { | 800 { |
| 791 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as | 801 // 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 | 802 // 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 | 803 // 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 | 804 // 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). | 805 // content that paints in a previous column (and content that paints in the following column). |
| 796 // | 806 // |
| (...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3077 FrameView* frameView = document().view(); | 3087 FrameView* frameView = document().view(); |
| 3078 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); | 3088 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); |
| 3079 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); | 3089 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); |
| 3080 if (size().height() < visibleHeight) | 3090 if (size().height() < visibleHeight) |
| 3081 top += (visibleHeight - size().height()) / 2; | 3091 top += (visibleHeight - size().height()) / 2; |
| 3082 setY(top); | 3092 setY(top); |
| 3083 dialog->setCentered(top); | 3093 dialog->setCentered(top); |
| 3084 } | 3094 } |
| 3085 | 3095 |
| 3086 } // namespace blink | 3096 } // namespace blink |
| OLD | NEW |