| 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, 2009, 2013 Apple Inc. All rights | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights |
| 8 * reserved. | 8 * reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void decreaseStart() { --m_start; } | 50 void decreaseStart() { --m_start; } |
| 51 void increaseEnd() { ++m_end; } | 51 void increaseEnd() { ++m_end; } |
| 52 | 52 |
| 53 void ensureConsistency(const unsigned); | 53 void ensureConsistency(const unsigned); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 unsigned m_start; | 56 unsigned m_start; |
| 57 unsigned m_end; | 57 unsigned m_end; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 inline bool operator==(const CellSpan& s1, const CellSpan& s2) { |
| 61 return s1.start() == s2.start() && s1.end() == s2.end(); |
| 62 } |
| 63 inline bool operator!=(const CellSpan& s1, const CellSpan& s2) { |
| 64 return !(s1 == s2); |
| 65 } |
| 66 |
| 60 class LayoutTableCell; | 67 class LayoutTableCell; |
| 61 class LayoutTableRow; | 68 class LayoutTableRow; |
| 62 | 69 |
| 63 // LayoutTableSection is used to represent table row group (display: | 70 // LayoutTableSection is used to represent table row group (display: |
| 64 // table-row-group), header group (display: table-header-group) and footer group | 71 // table-row-group), header group (display: table-header-group) and footer group |
| 65 // (display: table-footer-group). | 72 // (display: table-footer-group). |
| 66 // | 73 // |
| 67 // The object holds the internal representation of the rows (m_grid). See | 74 // The object holds the internal representation of the rows (m_grid). See |
| 68 // recalcCells() below for some extra explanation. | 75 // recalcCells() below for some extra explanation. |
| 69 // | 76 // |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 316 |
| 310 // Flip the rect so it aligns with the coordinates used by the rowPos and | 317 // Flip the rect so it aligns with the coordinates used by the rowPos and |
| 311 // columnPos vectors. | 318 // columnPos vectors. |
| 312 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; | 319 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; |
| 313 | 320 |
| 314 // Returns a row or column span covering all grid slots from each of which | 321 // Returns a row or column span covering all grid slots from each of which |
| 315 // a primary cell intersecting |visualRect| originates. | 322 // a primary cell intersecting |visualRect| originates. |
| 316 CellSpan dirtiedRows(const LayoutRect& visualRect) const; | 323 CellSpan dirtiedRows(const LayoutRect& visualRect) const; |
| 317 CellSpan dirtiedEffectiveColumns(const LayoutRect& visualRect) const; | 324 CellSpan dirtiedEffectiveColumns(const LayoutRect& visualRect) const; |
| 318 | 325 |
| 319 const HashSet<LayoutTableCell*>& overflowingCells() const { | 326 const HashSet<const LayoutTableCell*>& overflowingCells() const { |
| 320 return m_overflowingCells; | 327 return m_overflowingCells; |
| 321 } | 328 } |
| 322 bool hasMultipleCellLevels() const { return m_hasMultipleCellLevels; } | 329 bool hasMultipleCellLevels() const { return m_hasMultipleCellLevels; } |
| 323 | 330 |
| 324 const char* name() const override { return "LayoutTableSection"; } | 331 const char* name() const override { return "LayoutTableSection"; } |
| 325 | 332 |
| 326 // Whether a section has opaque background depends on many factors, e.g. | 333 // Whether a section has opaque background depends on many factors, e.g. |
| 327 // border spacing, border collapsing, missing cells, etc. For simplicity, | 334 // border spacing, border collapsing, missing cells, etc. For simplicity, |
| 328 // just conservatively assume all table sections are not opaque. | 335 // just conservatively assume all table sections are not opaque. |
| 329 bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect&, | 336 bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect&, |
| 330 unsigned) const override { | 337 unsigned) const override { |
| 331 return false; | 338 return false; |
| 332 } | 339 } |
| 333 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override { | 340 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override { |
| 334 return false; | 341 return false; |
| 335 } | 342 } |
| 336 | 343 |
| 337 int paginationStrutForRow(LayoutTableRow*, LayoutUnit logicalOffset) const; | 344 int paginationStrutForRow(LayoutTableRow*, LayoutUnit logicalOffset) const; |
| 338 | 345 |
| 339 bool mapToVisualRectInAncestorSpaceInternal( | 346 bool mapToVisualRectInAncestorSpaceInternal( |
| 340 const LayoutBoxModelObject* ancestor, | 347 const LayoutBoxModelObject* ancestor, |
| 341 TransformState&, | 348 TransformState&, |
| 342 VisualRectFlags = DefaultVisualRectFlags) const override; | 349 VisualRectFlags = DefaultVisualRectFlags) const override; |
| 343 | 350 |
| 344 bool isRepeatingHeaderGroup() const; | 351 bool isRepeatingHeaderGroup() const; |
| 345 | 352 |
| 346 void layout() override; | 353 void layout() override; |
| 347 | 354 |
| 355 CellSpan fullSectionRowSpan() const { return CellSpan(0, m_grid.size()); } |
| 356 CellSpan fullTableEffectiveColumnSpan() const { |
| 357 return CellSpan(0, table()->numEffectiveColumns()); |
| 358 } |
| 359 |
| 348 protected: | 360 protected: |
| 349 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 361 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
| 350 bool nodeAtPoint(HitTestResult&, | 362 bool nodeAtPoint(HitTestResult&, |
| 351 const HitTestLocation& locationInContainer, | 363 const HitTestLocation& locationInContainer, |
| 352 const LayoutPoint& accumulatedOffset, | 364 const LayoutPoint& accumulatedOffset, |
| 353 HitTestAction) override; | 365 HitTestAction) override; |
| 354 | 366 |
| 355 private: | 367 private: |
| 356 bool isOfType(LayoutObjectType type) const override { | 368 bool isOfType(LayoutObjectType type) const override { |
| 357 return type == LayoutObjectTableSection || LayoutBox::isOfType(type); | 369 return type == LayoutObjectTableSection || LayoutBox::isOfType(type); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 void updateBaselineForCell(LayoutTableCell*, | 425 void updateBaselineForCell(LayoutTableCell*, |
| 414 unsigned row, | 426 unsigned row, |
| 415 int& baselineDescent); | 427 int& baselineDescent); |
| 416 | 428 |
| 417 bool hasOverflowingCell() const { | 429 bool hasOverflowingCell() const { |
| 418 return m_overflowingCells.size() || m_forceSlowPaintPathWithOverflowingCell; | 430 return m_overflowingCells.size() || m_forceSlowPaintPathWithOverflowingCell; |
| 419 } | 431 } |
| 420 | 432 |
| 421 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); | 433 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); |
| 422 | 434 |
| 423 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); } | |
| 424 CellSpan fullTableEffectiveColumnSpan() const { | |
| 425 return CellSpan(0, table()->numEffectiveColumns()); | |
| 426 } | |
| 427 | |
| 428 // These two functions take a rectangle as input that has been flipped by | 435 // These two functions take a rectangle as input that has been flipped by |
| 429 // logicalRectForWritingModeAndDirection. | 436 // logicalRectForWritingModeAndDirection. |
| 430 // The returned span of rows or columns is end-exclusive, and empty if | 437 // The returned span of rows or columns is end-exclusive, and empty if |
| 431 // start==end. | 438 // start==end. |
| 432 CellSpan spannedRows(const LayoutRect& flippedRect) const; | 439 CellSpan spannedRows(const LayoutRect& flippedRect) const; |
| 433 CellSpan spannedEffectiveColumns(const LayoutRect& flippedRect) const; | 440 CellSpan spannedEffectiveColumns(const LayoutRect& flippedRect) const; |
| 434 | 441 |
| 435 void setLogicalPositionForCell(LayoutTableCell*, | 442 void setLogicalPositionForCell(LayoutTableCell*, |
| 436 unsigned effectiveColumn) const; | 443 unsigned effectiveColumn) const; |
| 437 | 444 |
| 438 void relayoutCellIfFlexed(LayoutTableCell&, int rowIndex, int rowHeight); | 445 void relayoutCellIfFlexed(LayoutTableCell&, int rowIndex, int rowHeight); |
| 439 | 446 |
| 440 int logicalHeightForRow(const LayoutTableRow&) const; | 447 int logicalHeightForRow(const LayoutTableRow&) const; |
| 441 | 448 |
| 442 // Honor breaking restrictions inside the table row, and adjust position and | 449 // Honor breaking restrictions inside the table row, and adjust position and |
| 443 // size accordingly. | 450 // size accordingly. |
| 444 void adjustRowForPagination(LayoutTableRow&, SubtreeLayoutScope&); | 451 void adjustRowForPagination(LayoutTableRow&, SubtreeLayoutScope&); |
| 445 | 452 |
| 453 bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const override; |
| 454 |
| 446 // The representation of the rows and their cells (CellStruct). | 455 // The representation of the rows and their cells (CellStruct). |
| 447 Vector<RowStruct> m_grid; | 456 Vector<RowStruct> m_grid; |
| 448 | 457 |
| 449 // The logical offset of each row from the top of the section. | 458 // The logical offset of each row from the top of the section. |
| 450 // | 459 // |
| 451 // Note that this Vector has one more entry than the number of rows so that | 460 // Note that this Vector has one more entry than the number of rows so that |
| 452 // we can keep track of the final size of the section. That is, | 461 // we can keep track of the final size of the section. That is, |
| 453 // m_rowPos[m_grid.size()] is a valid entry. | 462 // m_rowPos[m_grid.size()] is a valid entry. |
| 454 // | 463 // |
| 455 // To know a row's height at |rowIndex|, use the formula: | 464 // To know a row's height at |rowIndex|, use the formula: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 473 int m_outerBorderEnd; | 482 int m_outerBorderEnd; |
| 474 int m_outerBorderBefore; | 483 int m_outerBorderBefore; |
| 475 int m_outerBorderAfter; | 484 int m_outerBorderAfter; |
| 476 | 485 |
| 477 bool m_needsCellRecalc; | 486 bool m_needsCellRecalc; |
| 478 | 487 |
| 479 // This HashSet holds the overflowing cells for faster painting. | 488 // This HashSet holds the overflowing cells for faster painting. |
| 480 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it will | 489 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it will |
| 481 // be empty and m_forceSlowPaintPathWithOverflowingCell will be set to save | 490 // be empty and m_forceSlowPaintPathWithOverflowingCell will be set to save |
| 482 // memory. | 491 // memory. |
| 483 HashSet<LayoutTableCell*> m_overflowingCells; | 492 HashSet<const LayoutTableCell*> m_overflowingCells; |
| 484 bool m_forceSlowPaintPathWithOverflowingCell; | 493 bool m_forceSlowPaintPathWithOverflowingCell; |
| 485 | 494 |
| 486 // This boolean tracks if we have cells overlapping due to rowspan / colspan | 495 // This boolean tracks if we have cells overlapping due to rowspan / colspan |
| 487 // (see class comment above about when it could appear). | 496 // (see class comment above about when it could appear). |
| 488 // | 497 // |
| 489 // The use is to disable a painting optimization where we just paint the | 498 // The use is to disable a painting optimization where we just paint the |
| 490 // invalidated cells. | 499 // invalidated cells. |
| 491 bool m_hasMultipleCellLevels; | 500 bool m_hasMultipleCellLevels; |
| 492 | 501 |
| 493 // Whether any cell spans multiple rows or cols. | 502 // Whether any cell spans multiple rows or cols. |
| 494 bool m_hasSpanningCells; | 503 bool m_hasSpanningCells; |
| 495 }; | 504 }; |
| 496 | 505 |
| 497 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); | 506 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); |
| 498 | 507 |
| 499 } // namespace blink | 508 } // namespace blink |
| 500 | 509 |
| 501 #endif // LayoutTableSection_h | 510 #endif // LayoutTableSection_h |
| OLD | NEW |