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

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

Issue 2882043002: Update our treatment of repeating headers in tables (Closed)
Patch Set: bug 720620 Created 3 years, 6 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // 1123 //
1124 // FIXME: Another problem with simply moving lines is that the available line 1124 // FIXME: Another problem with simply moving lines is that the available line
1125 // width may change (because of floats). Technically if the location we move 1125 // width may change (because of floats). Technically if the location we move
1126 // the line to has a different line width than our old position, then we need 1126 // the line to has a different line width than our old position, then we need
1127 // to dirty the line and all following lines. 1127 // to dirty the line and all following lines.
1128 LayoutUnit logical_offset = line_box.LineTopWithLeading(); 1128 LayoutUnit logical_offset = line_box.LineTopWithLeading();
1129 LayoutUnit line_height = line_box.LineBottomWithLeading() - logical_offset; 1129 LayoutUnit line_height = line_box.LineBottomWithLeading() - logical_offset;
1130 logical_offset += delta; 1130 logical_offset += delta;
1131 line_box.SetPaginationStrut(LayoutUnit()); 1131 line_box.SetPaginationStrut(LayoutUnit());
1132 line_box.SetIsFirstAfterPageBreak(false); 1132 line_box.SetIsFirstAfterPageBreak(false);
1133 if (!View()->GetLayoutState()->IsPaginated()) 1133 LayoutState* layout_state = View()->GetLayoutState();
1134 if (!layout_state->IsPaginated())
1134 return; 1135 return;
1135 LayoutUnit page_logical_height = PageLogicalHeightForOffset(logical_offset); 1136 LayoutUnit page_logical_height = PageLogicalHeightForOffset(logical_offset);
1136 if (!page_logical_height) 1137 if (!page_logical_height)
1137 return; 1138 return;
1138 LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset( 1139 LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset(
1139 logical_offset, kAssociateWithLatterPage); 1140 logical_offset, kAssociateWithLatterPage);
1140 int line_index = LineCount(&line_box); 1141 int line_index = LineCount(&line_box);
1141 if (remaining_logical_height < line_height || 1142 if (remaining_logical_height < line_height ||
1142 (ShouldBreakAtLineToAvoidWidow() && 1143 (ShouldBreakAtLineToAvoidWidow() &&
1143 LineBreakToAvoidWidow() == line_index)) { 1144 LineBreakToAvoidWidow() == line_index)) {
(...skipping 17 matching lines...) Expand all
1161 // We need to insert a break now, either because there's no room for the 1162 // We need to insert a break now, either because there's no room for the
1162 // line in the current column / page, or because we have determined that we 1163 // line in the current column / page, or because we have determined that we
1163 // need a break to satisfy widow requirements. 1164 // need a break to satisfy widow requirements.
1164 if (ShouldBreakAtLineToAvoidWidow() && 1165 if (ShouldBreakAtLineToAvoidWidow() &&
1165 LineBreakToAvoidWidow() == line_index) { 1166 LineBreakToAvoidWidow() == line_index) {
1166 ClearShouldBreakAtLineToAvoidWidow(); 1167 ClearShouldBreakAtLineToAvoidWidow();
1167 SetDidBreakAtLineToAvoidWidow(); 1168 SetDidBreakAtLineToAvoidWidow();
1168 } 1169 }
1169 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index, 1170 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index,
1170 page_logical_height)) { 1171 page_logical_height)) {
1172 DCHECK(!IsTableCell());
1173 pagination_strut += layout_state->HeightOffsetForTableHeaders();
mstensho (USE GERRIT) 2017/05/29 10:22:00 I was actually expecting this one to go away, now
1171 // Note that when setting the strut on a block, it may be propagated to 1174 // Note that when setting the strut on a block, it may be propagated to
1172 // parent blocks later on, if a block's logical top is flush with that of 1175 // parent blocks later on, if a block's logical top is flush with that of
1173 // its parent. We don't want content-less portions (struts) at the 1176 // its parent. We don't want content-less portions (struts) at the
1174 // beginning of a block before a break, if it can be avoided. After all, 1177 // beginning of a block before a break, if it can be avoided. After all,
1175 // that's the reason for setting struts on blocks and not lines in the 1178 // that's the reason for setting struts on blocks and not lines in the
1176 // first place. 1179 // first place.
1177 SetPaginationStrutPropagatedFromChild(pagination_strut + logical_offset); 1180 SetPaginationStrutPropagatedFromChild(pagination_strut + logical_offset);
1178 } else { 1181 } else {
1179 delta += pagination_strut; 1182 delta += pagination_strut;
1180 line_box.SetPaginationStrut(pagination_strut); 1183 line_box.SetPaginationStrut(pagination_strut);
1181 line_box.SetIsFirstAfterPageBreak(true); 1184 line_box.SetIsFirstAfterPageBreak(true);
1182 } 1185 }
1183 PaginatedContentWasLaidOut(new_logical_offset + line_height); 1186 PaginatedContentWasLaidOut(new_logical_offset + line_height);
1184 return; 1187 return;
1185 } 1188 }
1186 1189
1187 LayoutUnit strut_to_propagate; 1190 LayoutUnit strut_to_propagate;
1188 if (remaining_logical_height == page_logical_height) { 1191 if (remaining_logical_height == page_logical_height) {
1189 // We're at the very top of a page or column. 1192 // We're at the very top of a page or column.
1190 if (line_box != FirstRootBox()) 1193 if (line_box != FirstRootBox())
1191 line_box.SetIsFirstAfterPageBreak(true); 1194 line_box.SetIsFirstAfterPageBreak(true);
1192 // If this is the first line in the block, and the block has a top border or 1195 // If this is the first line in the block, and the block has a top border or
1193 // padding, we may want to set a strut on the block, so that everything ends 1196 // padding, we may want to set a strut on the block, so that everything ends
1194 // up in the next column or page. Setting a strut on the block is also 1197 // up in the next column or page. Setting a strut on the block is also
1195 // important when it comes to satisfying orphan requirements. 1198 // important when it comes to satisfying orphan requirements.
1196 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index, 1199 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index,
1197 page_logical_height)) 1200 page_logical_height)) {
1198 strut_to_propagate = logical_offset; 1201 DCHECK(!IsTableCell());
1202 strut_to_propagate =
1203 logical_offset + layout_state->HeightOffsetForTableHeaders();
mstensho (USE GERRIT) 2017/05/29 10:22:00 This one we need to keep, though, since CalculateP
1204 }
1199 } else if (line_box == FirstRootBox() && AllowsPaginationStrut()) { 1205 } else if (line_box == FirstRootBox() && AllowsPaginationStrut()) {
1200 // This is the first line in the block. The block may still start in the 1206 // This is the first line in the block. The block may still start in the
1201 // previous column or page, and if that's the case, attempt to pull it over 1207 // previous column or page, and if that's the case, attempt to pull it over
1202 // to where this line is, so that we don't split the top border or padding. 1208 // to where this line is, so that we don't split the top border or padding.
1203 LayoutUnit strut = 1209 LayoutUnit strut =
mstensho (USE GERRIT) 2017/05/29 10:22:00 How about here? Looks like we're going to end up p
1204 remaining_logical_height + logical_offset - page_logical_height; 1210 remaining_logical_height + logical_offset - page_logical_height;
1205 if (strut > LayoutUnit()) { 1211 if (strut > LayoutUnit()) {
1206 // The block starts in a previous column or page. Set a strut on the block 1212 // The block starts in a previous column or page. Set a strut on the block
1207 // if there's room for the top border, padding and the line in one column 1213 // if there's room for the top border, padding and the line in one column
1208 // or page. 1214 // or page.
1209 if (logical_offset + line_height <= page_logical_height) 1215 if (logical_offset + line_height <= page_logical_height)
1210 strut_to_propagate = strut; 1216 strut_to_propagate = strut;
1211 } 1217 }
1212 } 1218 }
1213 1219
(...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after
4696 return LayoutBlock::DeprecatedInvalidatePaint(paint_invalidation_state); 4702 return LayoutBlock::DeprecatedInvalidatePaint(paint_invalidation_state);
4697 } 4703 }
4698 4704
4699 void LayoutBlockFlow::InvalidateDisplayItemClients( 4705 void LayoutBlockFlow::InvalidateDisplayItemClients(
4700 PaintInvalidationReason invalidation_reason) const { 4706 PaintInvalidationReason invalidation_reason) const {
4701 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( 4707 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients(
4702 invalidation_reason); 4708 invalidation_reason);
4703 } 4709 }
4704 4710
4705 } // namespace blink 4711 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698