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

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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 LayoutUnit strut_to_propagate; 1188 LayoutUnit strut_to_propagate;
1188 if (remaining_logical_height == page_logical_height) { 1189 if (remaining_logical_height == page_logical_height) {
1189 // We're at the very top of a page or column. 1190 // We're at the very top of a page or column.
1190 if (line_box != FirstRootBox()) 1191 if (line_box != FirstRootBox())
1191 line_box.SetIsFirstAfterPageBreak(true); 1192 line_box.SetIsFirstAfterPageBreak(true);
1192 // If this is the first line in the block, and the block has a top border or 1193 // 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 1194 // 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 1195 // up in the next column or page. Setting a strut on the block is also
1195 // important when it comes to satisfying orphan requirements. 1196 // important when it comes to satisfying orphan requirements.
1196 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index, 1197 if (ShouldSetStrutOnBlock(*this, line_box, logical_offset, line_index,
1197 page_logical_height)) 1198 page_logical_height)) {
1198 strut_to_propagate = logical_offset; 1199 DCHECK(!IsTableCell());
1200 strut_to_propagate =
1201 logical_offset + layout_state->HeightOffsetForTableHeaders();
1202 } else if (LayoutUnit pagination_strut =
1203 layout_state->HeightOffsetForTableHeaders()) {
1204 delta += pagination_strut;
1205 line_box.SetPaginationStrut(pagination_strut);
1206 }
1199 } else if (line_box == FirstRootBox() && AllowsPaginationStrut()) { 1207 } else if (line_box == FirstRootBox() && AllowsPaginationStrut()) {
1200 // This is the first line in the block. The block may still start in the 1208 // 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 1209 // 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. 1210 // to where this line is, so that we don't split the top border or padding.
1203 LayoutUnit strut = 1211 LayoutUnit strut = remaining_logical_height + logical_offset +
1204 remaining_logical_height + logical_offset - page_logical_height; 1212 layout_state->HeightOffsetForTableHeaders() -
1213 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.
1209 if (logical_offset + line_height <= page_logical_height) 1218 if (logical_offset + line_height <= page_logical_height)
1210 strut_to_propagate = strut; 1219 strut_to_propagate = strut;
1211 } 1220 }
1212 } 1221 }
1213 1222
1214 // If we found that some preceding content (lines, border and padding) belongs 1223 // If we found that some preceding content (lines, border and padding) belongs
(...skipping 3481 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