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

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, 7 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 // We need to insert a break now, either because there's no room for the 1161 // 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 1162 // line in the current column / page, or because we have determined that we
1163 // need a break to satisfy widow requirements. 1163 // need a break to satisfy widow requirements.
1164 if (ShouldBreakAtLineToAvoidWidow() && 1164 if (ShouldBreakAtLineToAvoidWidow() &&
1165 LineBreakToAvoidWidow() == line_index) { 1165 LineBreakToAvoidWidow() == line_index) {
1166 ClearShouldBreakAtLineToAvoidWidow(); 1166 ClearShouldBreakAtLineToAvoidWidow();
1167 SetDidBreakAtLineToAvoidWidow(); 1167 SetDidBreakAtLineToAvoidWidow();
1168 } 1168 }
1169 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index, 1169 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index,
1170 page_logical_height)) { 1170 page_logical_height)) {
1171 if (!IsTableCell()) {
mstensho (USE GERRIT) 2017/05/22 19:17:34 Table cells should never accept struts, so this ch
rhogan 2017/06/01 18:45:25 Done.
1172 pagination_strut +=
1173 View()->GetLayoutState()->HeightOffsetForTableHeaders();
1174 }
1171 // Note that when setting the strut on a block, it may be propagated to 1175 // 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 1176 // 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 1177 // 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, 1178 // 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 1179 // that's the reason for setting struts on blocks and not lines in the
1176 // first place. 1180 // first place.
1177 SetPaginationStrutPropagatedFromChild(pagination_strut + logical_offset); 1181 SetPaginationStrutPropagatedFromChild(pagination_strut + logical_offset);
1178 } else { 1182 } else {
1179 delta += pagination_strut; 1183 delta += pagination_strut;
1180 line_box.SetPaginationStrut(pagination_strut); 1184 line_box.SetPaginationStrut(pagination_strut);
1181 line_box.SetIsFirstAfterPageBreak(true); 1185 line_box.SetIsFirstAfterPageBreak(true);
1182 } 1186 }
1183 PaginatedContentWasLaidOut(new_logical_offset + line_height); 1187 PaginatedContentWasLaidOut(new_logical_offset + line_height);
1184 return; 1188 return;
1185 } 1189 }
1186 1190
1187 LayoutUnit strut_to_propagate; 1191 LayoutUnit strut_to_propagate;
1188 if (remaining_logical_height == page_logical_height) { 1192 if (remaining_logical_height == page_logical_height) {
1189 // We're at the very top of a page or column. 1193 // We're at the very top of a page or column.
1190 if (line_box != FirstRootBox()) 1194 if (line_box != FirstRootBox())
1191 line_box.SetIsFirstAfterPageBreak(true); 1195 line_box.SetIsFirstAfterPageBreak(true);
1192 // If this is the first line in the block, and the block has a top border or 1196 // 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 1197 // 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 1198 // up in the next column or page. Setting a strut on the block is also
1195 // important when it comes to satisfying orphan requirements. 1199 // important when it comes to satisfying orphan requirements.
1196 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index, 1200 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index,
1197 page_logical_height)) 1201 page_logical_height)) {
1198 strut_to_propagate = logical_offset; 1202 strut_to_propagate = logical_offset;
1203 if (!IsTableCell()) {
mstensho (USE GERRIT) 2017/05/22 19:17:34 Ditto.
rhogan 2017/06/01 18:45:24 Done.
1204 strut_to_propagate +=
1205 View()->GetLayoutState()->HeightOffsetForTableHeaders();
mstensho (USE GERRIT) 2017/05/22 19:17:34 I think this is now the third time we do View()->G
rhogan 2017/06/01 18:45:25 Done.
1206 }
1207 }
1199 } else if (line_box == FirstRootBox() && AllowsPaginationStrut()) { 1208 } else if (line_box == FirstRootBox() && AllowsPaginationStrut()) {
1200 // This is the first line in the block. The block may still start in the 1209 // 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 1210 // 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. 1211 // to where this line is, so that we don't split the top border or padding.
1203 LayoutUnit strut = 1212 LayoutUnit strut =
1204 remaining_logical_height + logical_offset - page_logical_height; 1213 remaining_logical_height + logical_offset - page_logical_height;
1205 if (strut > LayoutUnit()) { 1214 if (strut > LayoutUnit()) {
1206 // The block starts in a previous column or page. Set a strut on the block 1215 // 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 1216 // if there's room for the top border, padding and the line in one column
1208 // or page. 1217 // or page.
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4696 return LayoutBlock::DeprecatedInvalidatePaint(paint_invalidation_state); 4705 return LayoutBlock::DeprecatedInvalidatePaint(paint_invalidation_state);
4697 } 4706 }
4698 4707
4699 void LayoutBlockFlow::InvalidateDisplayItemClients( 4708 void LayoutBlockFlow::InvalidateDisplayItemClients(
4700 PaintInvalidationReason invalidation_reason) const { 4709 PaintInvalidationReason invalidation_reason) const {
4701 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( 4710 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients(
4702 invalidation_reason); 4711 invalidation_reason);
4703 } 4712 }
4704 4713
4705 } // namespace blink 4714 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698