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

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

Issue 1602773005: Respect break-inside:avoid on table rows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 10 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 23 matching lines...) Expand all
34 #include "core/frame/FrameView.h" 34 #include "core/frame/FrameView.h"
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/frame/Settings.h" 36 #include "core/frame/Settings.h"
37 #include "core/html/HTMLDialogElement.h" 37 #include "core/html/HTMLDialogElement.h"
38 #include "core/layout/HitTestLocation.h" 38 #include "core/layout/HitTestLocation.h"
39 #include "core/layout/LayoutAnalyzer.h" 39 #include "core/layout/LayoutAnalyzer.h"
40 #include "core/layout/LayoutFlowThread.h" 40 #include "core/layout/LayoutFlowThread.h"
41 #include "core/layout/LayoutMultiColumnFlowThread.h" 41 #include "core/layout/LayoutMultiColumnFlowThread.h"
42 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" 42 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
43 #include "core/layout/LayoutPagedFlowThread.h" 43 #include "core/layout/LayoutPagedFlowThread.h"
44 #include "core/layout/LayoutTableRow.h"
44 #include "core/layout/LayoutText.h" 45 #include "core/layout/LayoutText.h"
45 #include "core/layout/LayoutView.h" 46 #include "core/layout/LayoutView.h"
46 #include "core/layout/TextAutosizer.h" 47 #include "core/layout/TextAutosizer.h"
47 #include "core/layout/api/SelectionState.h" 48 #include "core/layout/api/SelectionState.h"
48 #include "core/layout/line/LineBreaker.h" 49 #include "core/layout/line/LineBreaker.h"
49 #include "core/layout/line/LineWidth.h" 50 #include "core/layout/line/LineWidth.h"
50 #include "core/layout/shapes/ShapeOutsideInfo.h" 51 #include "core/layout/shapes/ShapeOutsideInfo.h"
51 #include "core/paint/BlockFlowPainter.h" 52 #include "core/paint/BlockFlowPainter.h"
52 #include "core/paint/ClipScope.h" 53 #include "core/paint/ClipScope.h"
53 #include "core/paint/LayoutObjectDrawingRecorder.h" 54 #include "core/paint/LayoutObjectDrawingRecorder.h"
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 726
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 // 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)); 728 setLogicalHeight(logicalHeight() + (newLogicalTop - logicalTop));
728 729
729 // Return the final adjusted logical top. 730 // Return the final adjusted logical top.
730 return newLogicalTop; 731 return newLogicalTop;
731 } 732 }
732 733
733 static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline Box& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit pageLogica lHeight) 734 static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline Box& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit pageLogica lHeight)
734 { 735 {
736 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTopWit hLeading();
737 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lineLog icalOffset);
738
739 // We avoid letting table cells straddle a page boundary unless the cell is taller than the page.
740 if (block.isTableCell() && totalLogicalHeight <= pageLogicalHeight)
mstensho (USE GERRIT) 2016/02/03 14:38:48 It should be better to have allowsPaginationStrut(
741 return true;
742
735 bool wantsStrutOnBlock = false; 743 bool wantsStrutOnBlock = false;
736 if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineInde x) { 744 if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineInde x) {
737 // Not enough orphans here. Push the entire block to the next column / p age as an 745 // Not enough orphans here. Push the entire block to the next column / p age as an
738 // attempt to better satisfy the orphans requirement. 746 // attempt to better satisfy the orphans requirement.
739 wantsStrutOnBlock = true; 747 wantsStrutOnBlock = true;
740 } else if (lineBox == block.firstRootBox() && lineLogicalOffset == block.bor derAndPaddingBefore()) { 748 } else if (lineBox == block.firstRootBox() && lineLogicalOffset == block.bor derAndPaddingBefore()) {
741 // This is the first line in the block. We can take the whole block with us to the next page 749 // This is the first line in the block. We can take the whole block with us to the next page
742 // or column, rather than keeping a content-less portion of it in the pr evious one. Only do 750 // or column, rather than keeping a content-less portion of it in the pr evious one. Only do
743 // this if the line is flush with the content edge of the block, though. If it isn't, it 751 // this if the line is flush with the content edge of the block, though. If it isn't, it
744 // means that the line was pushed downwards by preceding floats that did n't fit beside the 752 // means that the line was pushed downwards by preceding floats that did n't fit beside the
745 // line, and we don't want to move all that, since it has already been e stablished that it 753 // line, and we don't want to move all that, since it has already been e stablished that it
746 // fits nicely where it is. 754 // fits nicely where it is.
747 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading();
748 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset);
749 // It's rather pointless to break before the block if the current line i sn't going to 755 // It's rather pointless to break before the block if the current line i sn't going to
750 // fit in the same column or page, so check that as well. 756 // fit in the same column or page, so check that as well.
751 if (totalLogicalHeight <= pageLogicalHeight) 757 if (totalLogicalHeight <= pageLogicalHeight)
752 wantsStrutOnBlock = true; 758 wantsStrutOnBlock = true;
753 } 759 }
754 return wantsStrutOnBlock && block.allowsPaginationStrut(); 760 return wantsStrutOnBlock && block.allowsPaginationStrut();
755 } 761 }
756 762
757 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta) 763 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta)
758 { 764 {
(...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 FrameView* frameView = document().view(); 3130 FrameView* frameView = document().view();
3125 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3131 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3126 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3132 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3127 if (size().height() < visibleHeight) 3133 if (size().height() < visibleHeight)
3128 top += (visibleHeight - size().height()) / 2; 3134 top += (visibleHeight - size().height()) / 2;
3129 setY(top); 3135 setY(top);
3130 dialog->setCentered(top); 3136 dialog->setCentered(top);
3131 } 3137 }
3132 3138
3133 } // namespace blink 3139 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698