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