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

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

Issue 2861653006: Fix LayoutTableRow::AddOverflowFromCell() (Closed)
Patch Set: Deflake the test 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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013
8 * Apple Inc. 8 * Apple Inc.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 void LayoutTableRow::ComputeOverflow() { 287 void LayoutTableRow::ComputeOverflow() {
288 ClearAllOverflows(); 288 ClearAllOverflows();
289 AddVisualEffectOverflow(); 289 AddVisualEffectOverflow();
290 for (LayoutTableCell* cell = FirstCell(); cell; cell = cell->NextCell()) 290 for (LayoutTableCell* cell = FirstCell(); cell; cell = cell->NextCell())
291 AddOverflowFromCell(cell); 291 AddOverflowFromCell(cell);
292 } 292 }
293 293
294 void LayoutTableRow::AddOverflowFromCell(const LayoutTableCell* cell) { 294 void LayoutTableRow::AddOverflowFromCell(const LayoutTableCell* cell) {
295 // Non-row-spanning-cells don't create overflow (they are fully contained
296 // within this row).
297 // TODO(crbug.com/603993): This seems incorrect because cell may have visual
298 // effect overflow that should be included in this row.
299 if (cell->RowSpan() == 1)
300 return;
301
302 // Cells only generates visual overflow.
303 LayoutRect cell_visual_overflow_rect =
304 cell->VisualOverflowRectForPropagation(StyleRef());
305
306 // The cell and the row share the section's coordinate system. However
307 // the visual overflow should be determined in the coordinate system of
308 // the row, that's why we shift it below.
309 cell_visual_overflow_rect.MoveBy(-Location());
310 AddContentsVisualOverflow(cell_visual_overflow_rect);
311
312 // Table row paints its background behind cells. If the cell spans multiple 295 // Table row paints its background behind cells. If the cell spans multiple
313 // rows, the row's visual rect should be expanded to cover the cell. 296 // rows, the row's visual rect should be expanded to cover the cell.
314 if (StyleRef().HasBackground()) { 297 // Here don't check background existence to avoid requirement to invalidate
298 // overflow on change of background existence.
299 if (cell->RowSpan() > 1) {
315 LayoutRect cell_background_rect = cell->FrameRect(); 300 LayoutRect cell_background_rect = cell->FrameRect();
316 cell_background_rect.MoveBy(-Location()); 301 cell_background_rect.MoveBy(-Location());
317 AddSelfVisualOverflow(cell_background_rect); 302 AddSelfVisualOverflow(cell_background_rect);
318 } 303 }
304
305 // Should propagate cell's overflow to row if the cell has row span or has
306 // overflow.
307 if (cell->RowSpan() == 1 && !cell->HasOverflowModel())
308 return;
309
310 // The cell and the row share the section's coordinate system. However
311 // the visual overflow should be determined in the coordinate system of
312 // the row, that's why we shift the rects by cell_row_offset below.
313 LayoutSize cell_row_offset = cell->Location() - Location();
314
315 LayoutRect cell_visual_overflow_rect =
316 cell->VisualOverflowRectForPropagation(StyleRef());
317 cell_visual_overflow_rect.Move(cell_row_offset);
318 AddContentsVisualOverflow(cell_visual_overflow_rect);
319
320 LayoutRect cell_layout_overflow_rect =
321 cell->LayoutOverflowRectForPropagation(StyleRef());
322 cell_layout_overflow_rect.Move(cell_row_offset);
323 AddLayoutOverflow(cell_layout_overflow_rect);
319 } 324 }
320 325
321 bool LayoutTableRow::IsFirstRowInSectionAfterHeader() const { 326 bool LayoutTableRow::IsFirstRowInSectionAfterHeader() const {
322 // If there isn't room on the page for at least one content row after the 327 // If there isn't room on the page for at least one content row after the
323 // header group, then we won't repeat the header on each page. 328 // header group, then we won't repeat the header on each page.
324 // https://drafts.csswg.org/css-tables-3/#repeated-headers reads like 329 // https://drafts.csswg.org/css-tables-3/#repeated-headers reads like
325 // it wants us to drop headers on only the pages that a single row 330 // it wants us to drop headers on only the pages that a single row
326 // won't fit but we avoid the complexity of that reading until it 331 // won't fit but we avoid the complexity of that reading until it
327 // is clarified. Tracked by crbug.com/675904 332 // is clarified. Tracked by crbug.com/675904
328 if (RowIndex()) 333 if (RowIndex())
329 return false; 334 return false;
330 LayoutTableSection* header = Table()->Header(); 335 LayoutTableSection* header = Table()->Header();
331 return header && Table()->SectionAbove(Section()) == header && 336 return header && Table()->SectionAbove(Section()) == header &&
332 header->GetPaginationBreakability() != kAllowAnyBreaks; 337 header->GetPaginationBreakability() != kAllowAnyBreaks;
333 } 338 }
334 339
335 } // namespace blink 340 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698